-
-
Notifications
You must be signed in to change notification settings - Fork 873
Closed
Labels
bugSomething isn't workingSomething isn't workingpostgresIssues relating to the Postgres dialectIssues relating to the Postgres dialect
Description
Search before asking
- I searched the issues and found no similar issues.
What Happened
PostgreSQL offers sophisticated full text search capabilities. It does so via the text search operator @@
. For example:
=> select to_tsvector('examples') @@ websearch_to_tsquery('example');
?column?
----------
t
(1 row)
However, SQLFluff currently cannot parse this query.
Expected Behaviour
Parsing this file should succeed:
select to_tsvector('examples') @@ websearch_to_tsquery('example');
Observed Behaviour
$ sqlfluff parse test-search.sql
[L: 1, P: 1] |file:
[L: 1, P: 1] | statement:
[L: 1, P: 1] | select_statement:
[L: 1, P: 1] | select_clause:
[L: 1, P: 1] | keyword: 'select'
[L: 1, P: 7] | [META] indent:
[L: 1, P: 7] | whitespace: ' '
[L: 1, P: 8] | select_clause_element:
[L: 1, P: 8] | function:
[L: 1, P: 8] | function_name:
[L: 1, P: 8] | function_name_identifier: 'to_tsvector'
[L: 1, P: 19] | bracketed:
[L: 1, P: 19] | start_bracket: '('
[L: 1, P: 20] | [META] indent:
[L: 1, P: 20] | expression:
[L: 1, P: 20] | quoted_literal: "'examples'"
[L: 1, P: 30] | [META] dedent:
[L: 1, P: 30] | end_bracket: ')'
[L: 1, P: 31] | whitespace: ' '
[L: 1, P: 32] | unparsable: !! Expected: 'Nothing...'
[L: 1, P: 32] | raw: '@'
[L: 1, P: 33] | raw: '@'
[L: 1, P: 34] | whitespace: ' '
[L: 1, P: 35] | code: 'websearch_to_tsquery'
[L: 1, P: 55] | bracketed:
[L: 1, P: 55] | start_bracket: '('
[L: 1, P: 56] | single_quote: "'example'"
[L: 1, P: 65] | end_bracket: ')'
[L: 1, P: 66] | [META] dedent:
[L: 1, P: 66] | statement_terminator: ';'
[L: 1, P: 67] | newline: '\n'
[L: 2, P: 1] | [META] end_of_file:
==== parsing violations ====
L: 1 | P: 32 | PRS | Line 1, Position 32: Found unparsable section: "@@
| websearch_to_tsquery('example')"
WARNING: Parsing errors found and dialect is set to 'postgres'. Have you configured your dialect correctly?
How to reproduce
test-search.sql
:
select to_tsvector('examples') @@ websearch_to_tsquery('example');
sqlfluff parse test-search.sql
Dialect
postgres
Version
$ sqlfluff --version
sqlfluff, version 2.0.7
$ python --version
Python 3.10.6
Configuration
[sqlfluff]
dialect = postgres
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
- I agree to follow this project's Code of Conduct
loafofpiecrust and alpha-beta-soup
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpostgresIssues relating to the Postgres dialectIssues relating to the Postgres dialect