Skip to content

DELETE FROM ... USING ... LEFT JOIN is not parsable #6409

@musjj

Description

@musjj

Search before asking

  • I searched the issues and found no similar issues.

What Happened

DELETE FROM ... USING ... LEFT JOIN queries is considered invalid by SQLFluff.

Expected Behaviour

SQLFluff should not have any problem parsing this syntax.

Observed Behaviour

SQLFluff fails to parse this syntax.

How to reproduce

Try formatting this sql file:

DELETE FROM foo USING baz
    LEFT JOIN bar ON baz.bar_id = bar.id
    WHERE foo.id = bar.foo_id
        AND baz.id = 'c';

This is a completely valid and functional PostgreSQL query, you can confirm it with the below dbfiddle link:

https://www.db-fiddle.com/f/ihqdR9heP6Cgc9ECGaA2Lk/2

Dialect

postgres

Version

sqlfluff, version 3.2.4

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpostgresIssues relating to the Postgres dialect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions