From 5add5907e5b42cf500a74544faf7b7e4de52629b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20=C3=87engel?= Date: Sat, 10 Oct 2026 14:48:25 +0300 Subject: [PATCH] feat(schema): split schema sources so unreadable statements fail alone Split each schema source at the statement separators JSqlParser's own token manager reports and parse every statement alone. A tagged dollar-quoted body ends at the next occurrence of its delimiter, and psql meta-command lines such as \restrict are blanked before lexing. A statement the parser cannot read is ignored unless it opens as table or type DDL. An unreadable ALTER TABLE whose every top-level action adds a constraint or an identity is ignored without resolving its table, which lets pg_dump identity columns load. Any other unreadable table or type statement is rejected with the parser's reason at its file line and column. Functions and procedures with bodies that are not dollar-quoted are now ignored. --- docs/postgresql.md | 168 +++++--- .../schema/parser/DefaultSchemaParser.java | 301 +++++++++----- .../schema/parser/SchemaSourceSplitter.java | 286 +++++++++++++ .../parser/DefaultSchemaParserTest.java | 384 ++++++++++++++---- 4 files changed, 921 insertions(+), 218 deletions(-) create mode 100644 sqlcj-cli/src/main/java/dev/sqlcj/schema/parser/SchemaSourceSplitter.java diff --git a/docs/postgresql.md b/docs/postgresql.md index 7df8a81..06dafdd 100644 --- a/docs/postgresql.md +++ b/docs/postgresql.md @@ -249,7 +249,7 @@ left: | `ALTER TYPE ... ADD VALUE IF NOT EXISTS '