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.