Skip to content

fix(psql): preserve FROM/USING placeholder offsets (Fixes #772) - #786

Open
atzedus wants to merge 2 commits into
stephenafamo:mainfrom
atzedus:fix/psql-from-placeholder-offsets
Open

atzedus wants to merge 2 commits into
stephenafamo:mainfrom
atzedus:fix/psql-from-placeholder-offsets

Conversation

@atzedus

@atzedus atzedus commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

UPDATE and DELETE passed start+len(args) into writeFromItemList, which added len(args) again when expressing each from_item, so preceding arguments were double-counted and placeholder numbers skipped (e.g. $5,$6 instead of $3,$4 after two SET arguments).

Refactor the helper into expressFromItems following the bob.Express* conventions: it no longer takes the accumulated args slice and returns only the newly generated arguments, with callers appending them explicitly.

Fixes #772

UPDATE and DELETE passed start+len(args) into writeFromItemList, which
added len(args) again when expressing each from_item, so preceding
arguments were double-counted and placeholder numbers skipped (e.g.
$5,$6 instead of $3,$4 after two SET arguments).

Refactor the helper into expressFromItems following the bob.Express*
conventions: it no longer takes the accumulated args slice and returns
only the newly generated arguments, with callers appending them
explicitly.

Fixes stephenafamo#772
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.

PostgreSQL UPDATE FROM double-counts preceding arguments when numbering placeholders

1 participant