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

Problem when deparsing query with renamend Columns #128

Closed
primeapple opened this issue Feb 22, 2019 · 1 comment
Closed

Problem when deparsing query with renamend Columns #128

primeapple opened this issue Feb 22, 2019 · 1 comment

Comments

@primeapple
Copy link

primeapple commented Feb 22, 2019

Hi, another one:

We have an original query like:

SELECT id as "new Test Id" from student

When we parse and deparse it, we get:

SELECT "id" AS new Test Id FROM "student"

which is not parsable anymore.

Bonus:
The queries:

SELECT id AS "TEST" from student

and

SELECT id AS TEST from student

are NOT the same, since the column is named TEST in the first one and test in the second one.

The problem is, that quote signs are removed when deparsing the query which is bad. There are multiple other situations, where this produces problems

@lfittl
Copy link
Member

lfittl commented Jul 1, 2019

Fixed by 100a0c5

Note that this tries to determine when escaping is needed (anytime an identifier is not \w+, or a keyword), and applies it only in such cases. There isn't a good way to get back to the way this was specified originally in the parse string, since we work with the the post-parse AST that doesn't keep the original text for each scan fragment.

@lfittl lfittl closed this as completed Jul 1, 2019
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