Skip to content

[BUG] JSQLParser Version 5.0 : PostgreSQL : TRUNCATE statements do not parse with multiple tables provided #2047

Closed
@nick-redfearn

Description

@nick-redfearn

Failing SQL Feature:

TRUNCATE or TRUNCATE TABLE statements do not parse with multiple tables provided

This is allowed by PostgreSQL:
https://www.postgresql.org/docs/current/sql-truncate.html

TRUNCATE [ TABLE ] [ ONLY ] name [ * ] [, ... ]
    [ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]

SQL Example:

TRUNCATE table1, table2, table3

OR

TRUNCATE TABLE table1, table2, table3

These both fail with the error message below

net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "," ","
    at line 2, column 11.

Was expecting one of:

    "CASCADE"
    <EOF>
    <ST_SEMICOLON>

Software Information:

  • JSqlParser version 5.0
  • PostgreSQL

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