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

sqlite: PRAGMA statement not parseable #3799

Closed
2 of 3 tasks
dr-1 opened this issue Aug 28, 2022 · 1 comment · Fixed by #4431
Closed
2 of 3 tasks

sqlite: PRAGMA statement not parseable #3799

dr-1 opened this issue Aug 28, 2022 · 1 comment · Fixed by #4431
Labels
bug Something isn't working sqlite Issues or enhancements to SQLite dialect

Comments

@dr-1
Copy link

dr-1 commented Aug 28, 2022

Search before asking

  • I searched the issues and found no similar issues.

What Happened

Parsing of an SQLite PRAGMA statement failed: "PRAGMA FOREIGN_KEYS = ON;"

Expected Behaviour

Parsing the statement successfully

Observed Behaviour

[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    statement:
[L:  1, P:  1]      |        unparsable:                                           !! Expected: 'StatementSegment'
[L:  1, P:  1]      |            raw:                                              'PRAGMA'
[L:  1, P:  7]      |            whitespace:                                       ' '
[L:  1, P:  8]      |            raw:                                              'FOREIGN_KEYS'
[L:  1, P: 20]      |            whitespace:                                       ' '
[L:  1, P: 21]      |            raw:                                              '='
[L:  1, P: 22]      |            whitespace:                                       ' '
[L:  1, P: 23]      |            raw:                                              'ON'
[L:  1, P: 25]      |    statement_terminator:                                     ';'
[L:  1, P: 26]      |    newline:                                                  '\n'
[L:  2, P:  1]      |    [META] end_of_file:

==== parsing violations ====
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'PRAGMA FOREIGN_KEYS
                       | = ON'

How to reproduce

echo "PRAGMA FOREIGN_KEYS = ON;" | sqlfluff parse --dialect=sqlite -

Dialect

sqlite

Version

sqlfluff 1.3.0
python 3.10.6

Configuration

None

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@dr-1 dr-1 added the bug Something isn't working label Aug 28, 2022
@github-actions github-actions bot added the sqlite Issues or enhancements to SQLite dialect label Aug 28, 2022
@alanmcruickshank
Copy link
Member

Confirmed. This is not present in the existing dialect. The sqllite docs for this syntax are here: https://www.sqlite.org/pragma.html

I won't be able to pick this one up myself for a while, I've got quite a lot already queued up for me. Anyone else feel able to take this on any time soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sqlite Issues or enhancements to SQLite dialect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants