Skip to content

fix: support pg_dump restrict commands - #966

Merged
nene merged 1 commit into
masterfrom
unknown repository
Aug 30, 2026
Merged

fix: support pg_dump restrict commands#966
nene merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 30, 2026

Copy link
Copy Markdown

The pg_dump clients shipped with PostgreSQL 17.6, 16.10, 15.14, 14.19, and 13.22 began wrapping plain-text dump scripts in \restrict <key> and \unrestrict <key> guards. sql-formatter 15.7.0 rejects these scripts at the opening guard. pg_dumpall and SQL scripts generated by pg_restore --file use the same guards.

This change recognizes the \restrict and \unrestrict prefixes as opaque line directives. It preserves each generated key, formats the enclosed SQL, and leaves other psql meta-commands unsupported.

Fixes #935

@nene

nene commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Thanks! Looks like this was surprisingly simple to achieve.

@nene
nene merged commit aaee3f1 into sql-formatter-org:master Aug 30, 2026
1 check passed
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.

[FORMATTING] Fails for psql meta-commands like \restrict

1 participant