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
Deparser incorrectly deparses DEFAULT
expression in CREATE TABLE
query
#188
Comments
@mpokryva Thanks for the report! It looks like we've omitted I think that may have happened because of the intentional parsing error that gets triggered in the regression tests (essentially to cover the case you're describing), which we didn't used to handle correctly, but we now should be able to ignore. To fix, I think we should do two things:
On the second point: We could of course just explicitly add parenthesis here around the I think what we may need to do is pass an extra flag to Do you want to try making a PR for this? |
This fixes the case raised in pganalyze/libpg_query#188.
I'll give it a shot within the next week 🤞. In crunch time right now:) |
The following query (taken from the Postgres regression tests) unfortunately produces an invalid query when ran through the deparser:
CREATE TABLE error_tbl (b1 bool DEFAULT (1 IN (1, 2)))
producesCREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2))
(note the missing parentheses).When I run the above in psql, I get
ERROR: syntax error at or near "IN"
.Let me know what I can do to help to fix the issue! This library has been super helpful, really appreciate all the work y'all have put in.
The text was updated successfully, but these errors were encountered: