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

Parser not working when double apostrophes are used inside of a comment (escaped apostrophe) #166

Open
devxor opened this issue Oct 31, 2022 · 2 comments

Comments

@devxor
Copy link

devxor commented Oct 31, 2022

Describe the bug
In the SNOWFLAKE database, when you are using an apostrophe in a comment, the apostrophe is escaped with another apostrophe like:

  • comment on a field level is "Grouping of hierarchy L1's.". Is what you see with DESC TABLE...
  • in DDL is like "Grouping of hierarchy L1''s."

I have tested the parser and it seems, that this double apostrophes in comments are making issues and the parser returns an empty list or in case if there is a PK constraint in DDL, it returns a list with PK only - no columns etc, nothing more is returned.

To Reproduce
Please try to parse the below DDL statement:

create or replace table MYTABLE (
    FIELD_1 NUMBER(38, 0) NOT NULL COMMENT 'some comment.',
    FIELD_2 VARCHAR(250) COMMENT 'some comment with apostrophes - grouping of hierarchy L1''s',
);

Expected behavior
DDL parsed.

@xnuinside
Copy link
Owner

@devxor I know about this issue))) but tried to ignore it too much as possible. It's hard to fix because of how parser identify a strings with quotes, I will try to figure out how to fix it with less pain

@devxor
Copy link
Author

devxor commented Nov 4, 2022

@xnuinside thx! For my use case I don't care about comments, so I will use a workaround of simply removing double apostrophes '' from the DDL and the parser will still work.
Of course it's not a solution for you. People would probably like to see their comments with apostrophes :).

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