Skip to content

Postgresql: TRUNCATE does not require TABLE #1583

Closed
@d2a-raudenaerde

Description

@d2a-raudenaerde

I see this in scripts:

TRUNCATE myfancytable;

This is allowed by Postgresql:

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

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

However, the parser complains with:

net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "myfancytable" <S_IDENTIFIER>
    at line 3, column 10.

Was expecting:

    "TABLE"

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