Skip to content

fix: bind formatQuery params by position, not textual order - #1056

Merged
tdrz merged 1 commit into
electric-sql:mainfrom
AntonOfTheWoods:fix/format-query-positional-params
Aug 12, 2026
Merged

tdrz merged 1 commit into
electric-sql:mainfrom
AntonOfTheWoods:fix/format-query-positional-params

Conversation

@AntonOfTheWoods

Copy link
Copy Markdown
Contributor

formatQuery rewrote $N placeholders as %NL, but format() reads a bare %NL as "min width N" and consumes arguments sequentially. Out-of-order placeholders therefore silently bound the wrong values (live.query and live.incrementalQuery inline params through this path), and a repeated placeholder failed with "too few arguments for format()". Emit the positional %N$L instead.

Fixes #1055

formatQuery rewrote $N placeholders as %NL, but format() reads a bare
%NL as "min width N" and consumes arguments sequentially. Out-of-order
placeholders therefore silently bound the wrong values (live.query and
live.incrementalQuery inline params through this path), and a repeated
placeholder failed with "too few arguments for format()". Emit the
positional %N$L instead.

Fixes #1055

Co-Authored-By: Claude Fable 5 <[email protected]>
@AntonOfTheWoods

Copy link
Copy Markdown
Contributor Author

@tdrz is this not obviously the right fix? If this gets merged I think can retire my fork, which would be lovely :-).

@tdrz tdrz 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.

LGTM! Thanks!

@tdrz
tdrz merged commit 354f4ae into electric-sql:main Aug 12, 2026
14 checks passed
AntonOfTheWoods added a commit to pgxsinkit/pglite that referenced this pull request Aug 18, 2026
Moved pgx-publish back onto upstream/main (0.5.5). initdb-fs-leak (electric-sql#1060)
and formatQuery positional-params (electric-sql#1056) merged upstream, so both are
dropped from the fork; the remaining stack carries only changes still
absent upstream: transaction-end sync (+ already-closed completion), the
IDBFS durability hardening and relaxed-concurrency restore, the
non-exclusive relaxed-sync latch (scoped), the opfs-ahp instrumentation,
and the close() relaxed-sync drain.

Conflicts re-applied onto the new base:
- pglite.ts close(): kept the IDBFS-hardening deferred-throw structure and
  folded upstream electric-sql#1059's process.exitCode save/restore into force_exit.
- base.ts transaction(): our flag-repositioning + rollback/already-closed
  sync guards now coexist with upstream electric-sql#1062's closed=true-before-ROLLBACK
  and checkClosed() gates.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
AntonOfTheWoods added a commit to pgxsinkit/pglite that referenced this pull request Sep 12, 2026
Moved pgx-publish back onto upstream/main (0.5.5). initdb-fs-leak (electric-sql#1060)
and formatQuery positional-params (electric-sql#1056) merged upstream, so both are
dropped from the fork; the remaining stack carries only changes still
absent upstream: transaction-end sync (+ already-closed completion), the
IDBFS durability hardening and relaxed-concurrency restore, the
non-exclusive relaxed-sync latch (scoped), the opfs-ahp instrumentation,
and the close() relaxed-sync drain.

Conflicts re-applied onto the new base:
- pglite.ts close(): kept the IDBFS-hardening deferred-throw structure and
  folded upstream electric-sql#1059's process.exitCode save/restore into force_exit.
- base.ts transaction(): our flag-repositioning + rollback/already-closed
  sync guards now coexist with upstream electric-sql#1062's closed=true-before-ROLLBACK
  and checkClosed() gates.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.

[BUG]: live.query silently binds positional params in textual order

2 participants