Skip to content

[FEATURE] Support multi-table truncate. #1821

Closed
@onukristo

Description

@onukristo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions