Skip to content

Rule references.special_chars ignores quoted_identifiers_policy #6086

@aBBDnGus

Description

@aBBDnGus

Search before asking

  • I searched the issues and found no similar issues.

What Happened

The rule references.special_chars (RF05) does not apply the setting quoted_identifiers_policy = column_aliases correctly.

Expected Behaviour

The setting quoted_identifiers_policy under [sqlfluff:rules:references.special_chars] should behave as follows:

  • aliases: Detect quoted identifiers with special characters only in aliases, not in column aliases
  • column_aliases: Detect quotes identifiers with special characters only in column aliases, not in aliases

Observed Behaviour

Setting quoted_identifiers_policy = column_aliases detects quoted identifiers with special characters in both aliases and column aliases.

How to reproduce

Create file test.sql as:

SELECT 1 AS "special*"
FROM VALUES ((1)) AS "special*"

Run sqlfluff lint test.sql -r rf05 gives the following output:

== [models\test.sql] FAIL                                                                                                                                                                                                                          
L:   1 | P:  13 | RF05 | Do not use special characters in identifiers.
                       | [references.special_chars]
L:   2 | P:  22 | RF05 | Do not use special characters in identifiers.
                       | [references.special_chars]
All Finished 📜 🎉!

Dialect

PostgreSQL

Version

SQLFluff 3.1.0
Python 3.12.1

Configuration

[sqlfluff]
dialect = postgres

[sqlfluff:rules:references.special_chars]
quoted_identifiers_policy = aliases

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting feedbackCannot continue investigating until more information is provided.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions