-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NamedExec issues expanding VALUES
#898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@nicjohnson145 it's a hacky workaround, but you can satisfy the regex with a commented out right parenthesis. UPDATE
foo_table f
SET
foo = v.foo
FROM (
--)
VALUES
(:id, :foo)
) AS v ( id, foo )
WHERE
f.id = v.id |
@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 👍 |
For the record, this issue has also been reported in at least the following:
PR attempts include at least: |
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: