JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

[FEATURE] Support multi-table truncate.

Open onukristo opened this issue 2 years ago • 1 comments

Grammar or Syntax Description

JSQLParser fails to parse Postgres queries with multi-parameter "TRUNCATE" statement.

SQL Example

TRUNCATE TABLE transfer_state, transfer_state_change_log
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
    at line 1, column 30.

Additional context

JSQLParser version: 4.6. I also tested with 4.7 SNAPSHOT Postgres sql.

https://www.postgresql.org/docs/12/sql-truncate.html

The multi-table truncate statement is necessary in case the two tables are referencing each other by some constraints. In that case Postgres returns an error if you try to truncate each table individually.

onukristo avatar Jul 06 '23 14:07 onukristo

Greetings.

This is Postgres specific and not standard compliant. I would like to recommend writing standard compliant SQL.

If you still need support for any RDBMS specific feature then either provide or sponsor an implementation.

manticore-projects avatar Jul 07 '23 00:07 manticore-projects

Should be solved via #2048

manticore-projects avatar Jul 26 '24 11:07 manticore-projects