Skip to content

fix(pgsql): embed RawExpression in UPDATE without placeholder#50

Merged
benkhalife merged 1 commit into
mainfrom
fix/pgsql-raw-expression-in-update
Jun 11, 2026
Merged

fix(pgsql): embed RawExpression in UPDATE without placeholder#50
benkhalife merged 1 commit into
mainfrom
fix/pgsql-raw-expression-in-update

Conversation

@benkhalife

Copy link
Copy Markdown
Member

PostgresGrammar::compileUpdate() was mapping over array_keys() and always emitting col = ?, ignoring RawExpression values used by increment() and decrement(). This caused a binding count mismatch on PostgreSQL.

Mirror the logic from Grammar::compileUpdate(): iterate over values, embed RawExpression directly, emit ? only for scalar values.

Adds two regression tests in GrammarTest:

  • test_pgsql_update_embeds_raw_expression_without_placeholder
  • test_pgsql_update_mixes_raw_and_normal_values

Fixes #49

PostgresGrammar::compileUpdate() was mapping over array_keys() and
always emitting `col = ?`, ignoring RawExpression values used by
increment() and decrement(). This caused a binding count mismatch
on PostgreSQL.

Mirror the logic from Grammar::compileUpdate(): iterate over values,
embed RawExpression directly, emit ? only for scalar values.

Adds two regression tests in GrammarTest:
- test_pgsql_update_embeds_raw_expression_without_placeholder
- test_pgsql_update_mixes_raw_and_normal_values

Fixes #49
@benkhalife benkhalife merged commit ebd9f16 into main Jun 11, 2026
11 checks passed
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: increment/decrement fails on PostgreSQL with binding count mismatch

1 participant