Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql: TRUNCATE does not require TABLE #1583

Closed
d2a-raudenaerde opened this issue Jul 1, 2022 · 0 comments · Fixed by #1585
Closed

Postgresql: TRUNCATE does not require TABLE #1583

d2a-raudenaerde opened this issue Jul 1, 2022 · 0 comments · Fixed by #1585

Comments

@d2a-raudenaerde
Copy link
Contributor

d2a-raudenaerde commented Jul 1, 2022

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"
d2a-raudenaerde added a commit to d2a-raudenaerde/JSqlParser that referenced this issue Jul 6, 2022
d2a-raudenaerde added a commit to d2a-raudenaerde/JSqlParser that referenced this issue Jul 7, 2022
d2a-raudenaerde added a commit to d2a-raudenaerde/JSqlParser that referenced this issue Jul 8, 2022
wumpz pushed a commit that referenced this issue Jul 14, 2022
* Closes #1583

* Closes #1583, removed unnecessary local variable.

* Closes #1583, proper support for deparsing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant