You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When populating a values statement with multiple entries, certain query shapes are not expanding as expected. This can be shown with the following example
If foo_table has 3 columns (or any remaining columns are defaulted) then this is a legal insert statement. Instead this fails with an error similar to
pq: got 6 parameters but the statement requires 3
This is easy enough to work around in the case of an insert, just specify the columns. However this is impossible to work around in the case of an UPDATE ... FROM statement.
UPDATE
foo_table f
SET
foo =v.fooFROM (
VALUES
(:id, :foo)
) AS v ( id, foo )
WHEREf.id=v.id
I believe this is due to the regex here which incorrectly requires that a values statement be preceeded by a closing parenthesis, so the values statements do not get duplicated in the above cases.
The text was updated successfully, but these errors were encountered:
@mw9000 oof. that is terrible. But it's arguably less terrible than the "dont use named statements, and instead manually specify values lists and do parameter list flattening" that I'm doing right now to work around this. Thanks for the suggestion 👍
When populating a values statement with multiple entries, certain query shapes are not expanding as expected. This can be shown with the following example
If
foo_table
has 3 columns (or any remaining columns are defaulted) then this is a legal insert statement. Instead this fails with an error similar toThis is easy enough to work around in the case of an insert, just specify the columns. However this is impossible to work around in the case of an
UPDATE ... FROM
statement.I believe this is due to the regex here which incorrectly requires that a values statement be preceeded by a closing parenthesis, so the values statements do not get duplicated in the above cases.
The text was updated successfully, but these errors were encountered: