Repository navigation
feat(pg): generate Sync Schema migration DDL for composite types - #20912
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 235d397d37
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
b512e2f to
8d0bd52
Compare
235d397 to
38523ac
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38523acc21
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
38523ac to
5943bc8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5943bc8471
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
5943bc8 to
050a01a
Compare
050a01a to
54614dc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54614dc31c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
54614dc to
4950fe9
Compare
4950fe9 to
ef9f2aa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef9f2aad02
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
73887aa to
7c495b9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c495b9d4d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
7c495b9 to
e1da0d9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1da0d99a5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Adds composite type support to the metadata differ and the PostgreSQL metadata-migration writer, giving Sync Schema parity with the SDL flow. - CompositeTypeDiff in the shared differ: create/drop, and alter when attributes (order-sensitive), collations, or comments change - Migration DDL: CREATE TYPE ... AS in dependency order after enums; DROP TYPE in reverse dependency order before enum drops; attribute changes as real ALTER TYPE ADD/DROP ATTRIBUTE and ALTER ATTRIBUTE ... TYPE statements (reviewable, and PostgreSQL surfaces the in-use restriction at execution); attribute reordering has no DDL and emits a warning comment, mirroring the enum value-removal precedent - Type and attribute comment changes emit COMMENT ON TYPE / COLUMN DDL syntax for ADD/ALTER ATTRIBUTE with COLLATE verified against PostgreSQL 17. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e1da0d9 to
539dd1b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 539dd1bec2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".




What
Adds composite type support to the metadata differ and the PostgreSQL metadata-migration writer, giving Sync Schema parity with the SDL flow. Second PR of the BYT-9668 chain, stacked on #20911.
How
CompositeTypeDiffin the shared differ: create/drop, and alter when attributes (order-sensitive), collations, or comments change.FilterPostgresArchiveSchemafilters the new changes like every other kind.CREATE TYPE ... ASin dependency order after enums; attribute changes as realALTER TYPE ADD/DROP ATTRIBUTEandALTER ATTRIBUTE ... TYPEstatements (reviewable in the issue; PostgreSQL surfaces the in-use restriction at execution); attribute reordering — including middle insertion, whichADD ATTRIBUTEcannot express — emits a warning comment, mirroring the enum value-removal precedent.DROP TYPEmust run after its last reference is released, and a column retype releases references only in the alter phase.computeDeferredDropsresolves this with a fixpoint — retype-released composites seed a pool; dropped schemas containing pooled-referenced types join the deferred set and contribute their composites; dropped enums referenced by any pooled composite defer too. The deferred phase then drops all deferred composites in one global reverse-dependency pass (correct even for cyclic cross-schema references), then deferred enums, thenDROP SCHEMAstatements.DROP SCHEMAcould run on a non-empty schema).Testing
Sixteen focused tests covering create/drop/alter ordering, dependency and reverse-dependency ordering, enum-drop interaction, retype deferral, schema-drop deferral, cross-schema and cyclic deferred references, middle-insertion warnings, comment changes, archive-schema filtering, and skip_dump handling.
ALTER TYPE ... ADD/ALTER ATTRIBUTE ... COLLATEsyntax verified against PostgreSQL 17. Fullschema/pgsuite and lint green.🤖 Generated with Claude Code