Repository navigation
fix(pretty-print): keep qualified names in ALTER ... SET SCHEMA and RENAME - #827
Merged
Merged
Conversation
… RENAME ATTRIBUTE
psteinroe
added a commit
that referenced
this pull request
Oct 2, 2026
) Commit Postgres' own regression SQL (`src/test/regress/sql`) for every supported major version, together with the verdict Postgres gave each statement, so tests can run against real-world SQL without the network or a database. **Fixtures** `crates/pgls_postgres_regress/data/<major>/` holds the pinned tag (`REL_15_19`, `REL_16_15`, `REL_17_11`, `REL_18_6`), the upstream files verbatim, and one `line:col verdict` file per SQL file, where the verdict is `accepted`, `rejected <sqlstate>` or `skipped`. `collate.windows.win1252.sql` is left out because it is not UTF-8 and only runs on Windows. The data is marked `linguist-generated`, so the diff collapses. **Loader and recorder** The crate's loader preprocesses each file (blanking psql meta-commands and `COPY` data, so line numbers are kept), splits it with `pgls_statement_splitter` and attaches the recorded verdicts. It panics with "fixtures out of date, run `just record-regress <major>`" when the split no longer matches. `just record-regress <major> [tag]` fetches the tag, starts the matching `postgres` image in Docker, checks the server version and runs every statement in a fresh database per file. The semantics are the same as the existing type-check regression harness: 5s statement timeout, transaction control and client `COPY` skipped, `raw_sql`, roles cleaned up after each file. **First consumer: pretty-print round trip** A new `pgls_pretty_print` test formats every statement Postgres 15–17 accepted (about 92k), at widths 80 and 100, and requires the output to parse back to the same normalized AST. Versions newer than the parser are skipped. The formatter bugs it found are fixed in #825, #826, #827, #828, #829 and #830, so it passes without an allowlist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qualified object names in
ALTER ... SET SCHEMAandALTER ... RENAMEno longer print with commas, andALTER TYPE ... RENAME ATTRIBUTEkeeps its type name andCASCADE. Before this, the formatted output for these statements did not re-parse.Qualified names
The parser stores
any_nameobjects (types, domains, conversions, text search objects, collations, statistics) as a list of strings. The generic list emitter joined them with commas; they are now dot-separated, the same wayalter_owner_stmtalready handles them. InRenameStmtthis also fixes qualified names inRENAME TOand domainRENAME CONSTRAINT. Neither appears in the Postgres regression corpus, but both have the same cause.RENAME ATTRIBUTE
The composite type name lives in
relation, notobject, so it was dropped. It is now emitted withoutONLY(the RangeVar hasinh = false), andCASCADEis kept.Fixes the ALTER object-name group of the round-trip failures found in #824. The new fixtures only add snapshots; no existing snapshot changes.