feat(pg): install composite types in walk-through and query-span catalogs by h3n4l · Pull Request #20913 · bytebase/bytebase · GitHub
Skip to content

feat(pg): install composite types in walk-through and query-span catalogs - #20913

Merged
h3n4l merged 1 commit into
mainfrom
claude/byt-9668-pr3-loaders
Jul 15, 2026
Merged

h3n4l merged 1 commit into
mainfrom
claude/byt-9668-pr3-loaders

Conversation

@h3n4l

@h3n4l h3n4l commented Jul 15, 2026

Copy link
Copy Markdown
Member

What

Extends the two metadata-driven catalog loaders — walk-through (SQL review / task checks) and query-span (masking, lineage) — to install composite types. Third PR of the BYT-9668 chain, stacked on #20911 and independent of #20912.

Why

Once sync populates composite_types, these catalogs were silently incomplete: metadata said a type existed while the catalogs used to validate user DDL and resolve (col).field access did not know it — the same metadata-infidelity failure class BYT-9668 is about, one layer up.

How

  • Both loaders gain a composite object kind sharing the type: key namespace with enums (PostgreSQL types share one namespace, so no collision is possible). Real install goes through omni's DefineCompositeType with attributes parsed from the always-qualified metadata type strings, including collations via CollClause.
  • Dependency edges from attribute types cover composite→composite, composite→enum, and composite→table/view row types (rel: keys), feeding the existing SCC/topological install order.
  • Pseudo fallbacks: query-span keeps its _broken composite; the walk-through gains an attribute-less fallback so a broken composite degrades instead of vanishing, preserving the every-object-present invariant.
  • Walk-through diff application maps omni CompositeTypes diff entries back onto metadata: creates and modifies rebuild attributes from the catalog (FormatType + collation) while preserving type/attribute comments and the emit-ready qualified collation reference from the previous metadata when the collation is unchanged; a genuinely changed collation takes the catalog's current value.

Known accepted limitation (documented in code): the catalog records only bare collation names, so switching an attribute between two same-named collations in different schemas keeps the previous schema qualifier in walk-through metadata.

Testing

  • TestWalkThroughLoadsCompositeTypes — dependency-ordered install with adversarial names, enum references, and a table using a composite column.
  • TestWalkThroughAppliesCompositeTypeChanges — CREATE/DROP/ALTER TYPE round-trip through diff application, asserting added attributes appear while type comments, attribute comments, and collations survive modification.
  • TestLoaderInstallsCompositeTypes — query-span loader installs real attributes and resolves nested composites.
  • Full schema/pg and parser/pg suites plus lint green; full server build passes.

🤖 Generated with Claude Code

@h3n4l
h3n4l requested a review from a team as a code owner July 15, 2026 04:40
@cla-bot cla-bot Bot added the cla-signed label Jul 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7889aa7340

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_loader.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 7889aa7 to bdd6fda Compare July 15, 2026 04:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdd6fda6ed

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from bdd6fda to cbb4da7 Compare July 15, 2026 04:57
@d-bytebase
d-bytebase requested a review from rebelice July 15, 2026 05:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbb4da75ce

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from cbb4da7 to 3ff5a4b Compare July 15, 2026 05:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ff5a4b68c

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 3ff5a4b to 524c0bf Compare July 15, 2026 05:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 524c0bfe47

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 524c0bf to e869c12 Compare July 15, 2026 05:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e869c12b1f

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_loader.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from e869c12 to bba0c3d Compare July 15, 2026 05:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bba0c3d671

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_loader.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch 7 times, most recently from bba0c3d to 54b66d4 Compare July 15, 2026 05:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54b66d4b81

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_loader.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 54b66d4 to 589a061 Compare July 15, 2026 05:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 589a061ccf

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 589a061 to 577afe6 Compare July 15, 2026 05:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 577afe623c

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 577afe6 to 2ddc09c Compare July 15, 2026 06:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ddc09ce70

ℹ️ 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".

Comment thread backend/plugin/schema/pg/walk_through_apply.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a357c05443

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni.go
Comment thread backend/plugin/schema/pg/walk_through_apply.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from a357c05 to 7c320db Compare July 15, 2026 09:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c320dbac2

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 7c320db to 0b834c6 Compare July 15, 2026 09:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b834c623d

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 0b834c6 to af4bcc1 Compare July 15, 2026 10:02
@h3n4l
h3n4l enabled auto-merge (squash) July 15, 2026 10:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af4bcc1e15

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from af4bcc1 to 0257697 Compare July 15, 2026 10:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0257697785

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go Outdated
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 0257697 to 436b85a Compare July 15, 2026 10:43

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 436b85acf7

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 436b85a to 9c1e183 Compare July 15, 2026 10:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c1e183609

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 9c1e183 to eaad42b Compare July 15, 2026 11:08

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eaad42b2e9

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from eaad42b to 653faf4 Compare July 15, 2026 11:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 653faf4747

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 653faf4 to bd81ff0 Compare July 15, 2026 11:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd81ff0d98

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch 2 times, most recently from 06f0a69 to 3615f37 Compare July 15, 2026 11:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3615f372e8

ℹ️ 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".

Comment thread backend/plugin/parser/pg/query_span_omni_plpgsql.go
…logs

The walk-through (SQL review / task check) and query-span (masking,
lineage) catalog loaders previously ignored composite_types metadata, so
statements referencing composite types were checked against catalogs
unaware of them.

- Both loaders gain a composite object kind sharing the "type:"
  namespace with enums: real install via omni DefineCompositeType with
  attributes parsed from the always-qualified metadata type strings,
  dependency edges from attribute types (composite→composite and
  composite→enum), and the existing "_broken" pseudo composite as the
  install-failure fallback in query span
- Walk-through diff application maps omni CompositeTypes diff entries
  back onto metadata (create/modify via catalog FormatType, drop by
  name), so post-DDL metadata reflects composite changes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@h3n4l
h3n4l force-pushed the claude/byt-9668-pr3-loaders branch from 3615f37 to 8679cef Compare July 15, 2026 12:02
@sonarqubecloud

Copy link
Copy Markdown

@h3n4l
h3n4l merged commit 5847601 into main Jul 15, 2026
15 checks passed
@h3n4l
h3n4l deleted the claude/byt-9668-pr3-loaders branch July 15, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants