Skip to content

[FEATURE] I want to know why the delete using syntax does not support subqueries #2314

Description

@zhangconan

Grammar or Syntax Description

In the PG syntax documentation, delete using can use subqueries. The syntax is as follows:

[ WITH [ RECURSIVE ] with_query [, ...] ]
DELETE FROM [ ONLY ] table_name [ * ] [ [ AS ] alias ]
    [ USING from_item [, ...] ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING { * | output_expression [ [ AS ] output_name ] } [, ...] ]

DELETE
but I found that using in jsqlparser only supports specific tables. I want to know why it is designed like this.

SQL Example

  • Simplified Query Example, focusing on the failing feature
    DELETE FROM films f
    USING (SELECT id FROM producers WHERE active = false) p
    WHERE f.producer_id = p.id;

Tips:

If it is missing or because the previous version of pg does not support it, I would like to submit a PR to improve this special effect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions