Skip to content
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 cast in EXCLUDE expression in CREATE TABLE query #189

Open
mpokryva opened this issue May 4, 2023 · 1 comment

Comments

@mpokryva
Copy link

mpokryva commented May 4, 2023

The following query (taken from the Postgres regression tests) unfortunately produces an invalid query when ran through the deparser:
Original query:

CREATE TABLE circles (
  c1 CIRCLE,
  c2 TEXT,
  EXCLUDE USING gist
    (c1 WITH &&, (c2::circle) WITH &&)
    WHERE (circle_center(c1) <> '(0,0)')
);

Deparser output:

CREATE TABLE circles (c1 circle, c2 text, EXCLUDE USING gist (c1 WITH &&, c2::circle WITH &&) WHERE (circle_center(c1) <> '(0,0)'))

(note the missing parentheses around c2::circle which are present in the original query).

When I run the above in psql, I get ERROR: syntax error at or near "::"

This might be a similar fix to #188 (which I haven't had time to address yet 🙃 ).

@lfittl
Copy link
Member

lfittl commented May 4, 2023

@mpokryva Yeah, that sounds eerily familiar to #188 - just different type of constraint, but same issue with the parenthesis not being added around a constraint's expression.

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

No branches or pull requests

2 participants