You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] JSQLParser 5.3 : PostgreSQL : COMMENT ON ... IS NULL (comment removal) fails to parse #2562
COMMENT ON <object> IS NULL cannot be parsed. In PostgreSQL, writing NULL in place of the text string is the way to remove a comment — per the COMMENT docs: "To remove a comment, write NULL in place of the text string." So a DDL stream that drops comments cannot be processed.
SQL Example:
COMMENT ON TABLE app.t IS NULL
fails on 5.3 and on current master (6c726d8) with:
net.sf.jsqlparser.parser.ParseException: Encountered: <K_NULL> / "NULL", at line 1, column 27, in lexical state DEFAULT.
Was expecting this terminal within expansion starting at 15161:20:
<S_CHAR_LITERAL> ...
COMMENT ON COLUMN app.t.name IS NULL and COMMENT ON VIEW app.v IS NULL fail the same way. All string-literal forms parse fine, including the empty string (IS 'hello', IS '').
Software Information:
JSqlParser 5.3 (current Maven Central release); reproduced on master 6c726d8
PostgreSQL 18 (verified: COMMENT ON TABLE t IS NULL removes the comment, i.e. deletes the pg_description row; IS '' behaves the same)
I'll follow up with a PR (grammar + round-trip tests).
Activity
fix(parser): parse COMMENT ON ... IS NULL as comment removal (#2562) (#…