8000 fix(postgres): refuse a slonik client with reylo's own error by colinhacks · Pull Request #91 · colinhacks/reylo · GitHub
[go: up one dir, main page]

Skip to content

fix(postgres): refuse a slonik client with reylo's own error - #91

Merged
colinhacks merged 2 commits into
mainfrom
refuse-slonik
Oct 23, 2026
Merged

colinhacks merged 2 commits into
mainfrom
refuse-slonik

Conversation

@colinhacks
Copy link
Copy Markdown
Owner

A Slonik pool, connection or transaction has a query() method, so .run() took it for a pg-shaped client and called query(text, values). Slonik's query() takes only the objects its sql tag builds, so the call failed inside Slonik with TypeError: 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 numeric arrives as a float, a timestamptz or timestamp as epoch milliseconds and an interval as 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 a pg pool beside it:

reylo cannot run a postgres statement on an object with any, anyFirst, connect, end, … . It takes a client with … . Slonik decodes the values of its queries itself, by type parsers set for its whole pool, and does not hand out its connection: run Reylo's queries on a pg Pool beside it.
  • src/execute.ts: a Slonik client is told apart by maybeOneFirst() and anyFirst(), which its pool, connections, transactions and savepoints have and no supported client does.
  • tests/execute.test.ts: the refusal, before query() is called.
  • The supported drivers section says to use a pg pool beside Slonik.

Checked by hand on Slonik 49.11.0 against Postgres 18: the pool, a pool.connect() connection and a pool.transaction() each reject with the error above.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 21:38
@vercel
vercel Bot commented Oct 23, 2026 •
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 23, 2026 9:46pm UTC

Request Review

Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@pullfrog pullfrog Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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 for maybeOneFirst() and anyFirst(). None of the supported Postgres clients have these (pg, pg-promise, postgres.js, Bun.sql, PGlite, Neon), and underneath() only unwraps Drizzle, so a Slonik pool, connection or transaction reaches the check as it is.
  • Early refusal: executeAsync throws before checkParams and the freshness query, so nothing ever goes through Slonik's query(). The test proves this with a query() 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 in src/decode.ts.
  • Docs: one sentence after the Postgres tabs points Slonik users to a pg pool. The skill doesn't list drivers or refused clients, so it needs no change.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit 3b81a0b into main Oct 23, 2026
6 checks passed
@colinhacks
colinhacks deleted the refuse-slonik branch October 23, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0