Repository navigation
fix(postgres): refuse a slonik client with reylo's own error - #91
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — one wording suggestion inline.
Reviewed changes
This review covers the one commit that makes .run() refuse a Slonik client up front with Reylo's own error, so Slonik's query() no longer fails on Reylo's (text, values) call.
- Slonik detection:
isSlonik()checks formaybeOneFirst()andanyFirst(). None of the supported Postgres clients have these (pg, pg-promise, postgres.js, Bun.sql, PGlite, Neon), andunderneath()only unwraps Drizzle, so a Slonik pool, connection or transaction reaches the check as it is. - Early refusal:
executeAsyncthrows beforecheckParamsand the freshness query, so nothing ever goes through Slonik'squery(). The test proves this with aquery()that fails if it is called. - Hint:
unsupported()adds a Slonik hint after the Kysely and Prisma ones. Its wording matches the existing pg-promise and postgres.js refusals insrc/decode.ts. - Docs: one sentence after the Postgres tabs points Slonik users to a
pgpool. The skill doesn't list drivers or refused clients, so it needs no change.
claude-opus-5-5 | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

A Slonik pool, connection or transaction has a
query()method, so.run()took it for a pg-shaped client and calledquery(text, values). Slonik'squery()takes only the objects itssqltag builds, so the call failed inside Slonik withTypeError: Cannot read properties of undefined (reading 'replaceAll').Reylo cannot run on Slonik exactly: Slonik's type parsers are set on its pool's connections, and a statement cannot override them, so with its defaults a
numericarrives as a float, atimestamptzortimestampas epoch milliseconds and anintervalas seconds..run()now refuses a Slonik client before calling it, with Reylo's own error, as it does for Kysely and Prisma, and points to apgpool beside it:src/execute.ts: a Slonik client is told apart bymaybeOneFirst()andanyFirst(), which its pool, connections, transactions and savepoints have and no supported client does.tests/execute.test.ts: the refusal, beforequery()is called.pgpool beside Slonik.Checked by hand on Slonik 49.11.0 against Postgres 18: the pool, a
pool.connect()connection and apool.transaction()each reject with the error above.