Skip to content

fix: getting all books 500s on postgres - #35

Merged
Faustvii merged 1 commit into
Faustvii:developfrom
RestorerRabbit:fix/postgres-quoted-subquery-aliases
Sep 2, 2026
Merged

Faustvii merged 1 commit into
Faustvii:developfrom
RestorerRabbit:fix/postgres-quoted-subquery-aliases

Conversation

@RestorerRabbit

@RestorerRabbit RestorerRabbit commented Jul 31, 2026 •

Copy link
Copy Markdown

Database Migration

NO

Description

On PostgreSQL, GetAllBooks() throws, so the unpaged book listing at GET /api/v1/book returns a 500.

Two aliases in the raw SQL are declared unquoted but referenced quoted:

SELECT "BookId", MIN("Id") as MinId
    FROM "SeriesBookLink"
    GROUP BY "BookId"
) first_series ON sbl."BookId" = first_series."BookId" AND sbl."Id" = first_series."MinId"

Postgres lowercases the unquoted declaration to minid, while the quoted reference is case-sensitive, so it resolves to nothing:

42703: column first_series.MinId does not exist

SeriesTitle has the same mismatch: declared as SeriesTitle, consumed as sbl."SeriesTitle".

This quotes the two declarations so they match their references. SQLite is unaffected because it treats identifiers case-insensitively, so the query behaves identically there before and after.

Screenshot (if UI related)

N/A

Todos

  • Tests: unit suite on this branch matches unmodified develop. The 4 failures are stale assertions against live Goodreads metadata that has since changed.
  • Translation Keys: N/A, no user-facing strings.
  • Wiki Updates: N/A.

Issues Fixed or Closed by this PR

N/A

@RestorerRabbit
RestorerRabbit marked this pull request as ready for review July 31, 2026 00:39
@Faustvii
Faustvii merged commit 387f917 into Faustvii:develop Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.9.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants