Skip to content

Strip psql meta-commands from schema files (fixes #4065)#4390

Merged
kyleconroy merged 1 commit intomainfrom
claude/add-comment-prefix-regex-HeATn
Apr 19, 2026
Merged

Strip psql meta-commands from schema files (fixes #4065)#4390
kyleconroy merged 1 commit intomainfrom
claude/add-comment-prefix-regex-HeATn

Conversation

@kyleconroy
Copy link
Copy Markdown
Collaborator

pg_dump 17.6+ (backported to 13.22, 14.19, 15.14, 16.10) emits
\restrict/\unrestrict meta-commands that are valid psql syntax but not
valid SQL, causing sqlc to fail when parsing schema.sql from pg_dump.

Add a regex-based preprocessor in the migrations package that strips
any line starting with a psql meta-command (<command>), and call it
from parseCatalog after RemoveRollbackStatements. Extend the pg_dump
end-to-end schema fixture with \restrict/\unrestrict lines so TestReplay
exercises this path.

pg_dump 17.6+ (backported to 13.22, 14.19, 15.14, 16.10) emits
\restrict/\unrestrict meta-commands that are valid psql syntax but not
valid SQL, causing sqlc to fail when parsing schema.sql from pg_dump.

Add a regex-based preprocessor in the migrations package that strips
any line starting with a psql meta-command (\<command>), and call it
from parseCatalog after RemoveRollbackStatements. Extend the pg_dump
end-to-end schema fixture with \restrict/\unrestrict lines so TestReplay
exercises this path.
@kyleconroy kyleconroy merged commit 394bdc7 into main Apr 19, 2026
13 checks passed
@kyleconroy kyleconroy deleted the claude/add-comment-prefix-regex-HeATn branch April 19, 2026 15:46
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 this pull request may close these issues.

2 participants