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

Trips up on field named reference #30

Open
alex-tan opened this issue Jun 11, 2019 · 2 comments
Open

Trips up on field named reference #30

alex-tan opened this issue Jun 11, 2019 · 2 comments

Comments

@alex-tan
Copy link

alex-tan commented Jun 11, 2019

CREATE TABLE example_table (
  reference character varying
)

line 2: ERROR: syntax error at or near "reference"

@markdrago
Copy link
Owner

This is a fun one. Apparently there is a set of keywords that are only used by ecpg, which is the tool used by pgsanity to actually verify that the SQL is valid. You can see the full list of these reserved words here:

https://github.com/postgres/postgres/blob/master/src/interfaces/ecpg/preproc/ecpg_kwlist.h

I suspect we would see similar problems with the other keywords in that list (eg descriptor, section, identified, etc.). While it should be possible for pgsanity to obfuscate these keywords before sending them through to ecpg (ie convert 'reference' to 'ecpgkw_reference' before validation), pgsanity would ideally also deobfuscate any error messages that come back from ecpg such that the original token is shown to the user instead of the obfuscated one.

@alex-tan
Copy link
Author

Ah interesting. I did a quick search in this codebase but I figured it would probably be in a dependency somewhere.

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