Skip to content

Conversation

joaostorrer
Copy link
Contributor

Since Postgres accepts full qualified table name USER in statements.

Closes #6693

Brief summary of the change made

Are there any other side effects of this change that we should be aware of?

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

Copy link
Contributor

github-actions bot commented Mar 4, 2025

Coverage Results ✅

Name    Stmts   Miss  Cover   Missing
-------------------------------------
TOTAL   19339      0   100%

248 files skipped due to complete coverage.

@laroo
Copy link

laroo commented Mar 4, 2025

This only solves the reserved keyword USER, but it also applies on the ORDER keyword:

$ cat order_migration.sql
CREATE INDEX CONCURRENTLY IF NOT EXISTS order_my_column_idx ON my_schema.order (my_column);
$ sqlfluff lint --dialect postgres order_migration.sql
== [order_migration.sql] FAIL
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'CREATE
                       | INDEX CONCURRENTLY IF NOT EXISTS ...'
WARNING: Parsing errors found and dialect is set to 'postgres'. Have you configured your dialect correctly?
All Finished 📜 🎉!

Not sure removing the reserved keyword is a solution here. Would be helpful to get a clearer error message.

Referencing #6693

Copy link
Contributor

@WittierDinosaur WittierDinosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WittierDinosaur WittierDinosaur added this pull request to the merge queue Mar 6, 2025
Merged via the queue into sqlfluff:main with commit 1d3a0f0 Mar 6, 2025
29 checks passed
@joaostorrer joaostorrer deleted the postgres_user_keyword branch March 6, 2025 14:44
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

Successfully merging this pull request may close these issues.

Any table reference to user table with explicit schema is unparseable for postgres
3 participants