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

Wrong identifier grouping in CREATE TABLE table_name AS SELECT .... #8

Closed
andialbrecht opened this issue Apr 18, 2012 · 0 comments
Closed

Comments

@andialbrecht
Copy link
Owner

_This is a _shadow issue* for Issue 8 on Google Code (from which this project was moved).
Added 2009-07-13T16:11:37.000Z by est...@gmail.com. Closed (Fixed).
Labels: Type-Defect, Priority-Medium, Version-0.1.1, Milestone-0.1.2.
Please make updates to the bug there.*

Original description

When parsing a query like this:

CREATE TABLE example_table AS SELECT * from example_table_2;

This token list is produced:

[<DDL 'CREATE' at 0x297c690>,
 <Whitespace ' ' at 0x297c650>,
 <Keyword 'TABLE' at 0x297c750>,
 <Whitespace ' ' at 0x297c790>,
 <Identifier 'exampl...' at 0x2b9a7c0>,
 <Whitespace ' ' at 0x297c910>,
 <Wildcard '*' at 0x297c950>,
 <Whitespace ' ' at 0x297c990>,
 <Keyword 'from' at 0x297c9d0>,
 <Whitespace ' ' at 0x297ca10>,
 <Identifier 'exampl...' at 0x2b9a830>,
 <Punctuation ';' at 0x297cad0>]

Notice that in the above list:
 <Identifier 'exampl...' at 0x2b9a7c0>,

has &quot;consumed&quot; the select DDL. Below are the tokens in <Identifier 'exampl... :

[<Name 'exampl...' at 0x297c7d0>,
 <Whitespace ' ' at 0x297c810>,
 <Keyword 'AS' at 0x297c850>,
 <Whitespace ' ' at 0x297c890>,
 <DML 'SELECT' at 0x297c8d0>]

The solution is for the identifiers to get grouped only when a non sql
reserved keyword follows.
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

1 participant