Skip to content

sql/types: remove VisibleType field and NAME downgrade logic#164412

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:cleanup-visible-type
Feb 27, 2026
Merged

sql/types: remove VisibleType field and NAME downgrade logic#164412
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:cleanup-visible-type

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Feb 26, 2026

The VisibleType field in the InternalType protobuf was a pre-19.1 mechanism for encoding type aliases (INT4, FLOAT4, VARCHAR, etc.). It was superseded by the Oid field in 19.2 but kept for backward compatibility during mixed-version clusters.

Now that MinSupported is v25.4, no mixed-version cluster will include a node older than v25.4, which already populates the Oid field. This commit removes:

  • The VisibleType field from the proto (replaced with reserved 6)
  • All visible* constants and VisibleType assignments in canonical types, constructors, and the SQL parser
  • The VisibleType-based OID inference in upgradeType(), keeping only Width-based inference for old backup compatibility
  • The downgradeType() function and NAME serialization special-casing in Marshal/MarshalTo/MarshalToSizedBuffer/Size/MarshalJSONPB
  • The VisibleType reconstruction logic in UnmarshalJSONPB
  • The duringUpgradeTo25_4 forced descriptor rewrite in the first upgrade migration
  • Related test infrastructure (VisibleType comparison filters, old format test cases)

Resolves: #152629

Release note: None

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io bot commented Feb 26, 2026

😎 Merged successfully - details.

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Feb 26, 2026

It looks like your PR touches SQL parser code but doesn't add or edit parser tests. Please make sure you add or edit parser tests if you edit the parser.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rafiss rafiss force-pushed the cleanup-visible-type branch from 3272317 to 7e49444 Compare February 27, 2026 01:11
@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Feb 27, 2026

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

It looks like your PR touches SQL parser code but doesn't add or edit parser tests. Please make sure you add or edit parser tests if you edit the parser.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@rafiss rafiss force-pushed the cleanup-visible-type branch from 7e49444 to 32944c0 Compare February 27, 2026 01:47
The `VisibleType` field in the `InternalType` protobuf was a pre-19.1
mechanism for encoding type aliases (INT4, FLOAT4, VARCHAR, etc.). It
was superseded by the `Oid` field in 19.2 but kept for backward
compatibility during mixed-version clusters.

Now that `MinSupported` is v25.4, no mixed-version cluster will include
a node older than v25.4, which already populates the `Oid` field. This
commit removes:

- The `VisibleType` field from the proto (replaced with `reserved 6`)
- All `visible*` constants and VisibleType assignments in canonical
  types, constructors, and the SQL parser
- The VisibleType-based OID inference in `upgradeType()`, keeping only
  Width-based inference for old backup compatibility
- The `downgradeType()` function and NAME serialization special-casing
  in Marshal/MarshalTo/MarshalToSizedBuffer/Size/MarshalJSONPB
- The VisibleType reconstruction logic in UnmarshalJSONPB
- The `duringUpgradeTo25_4` forced descriptor rewrite in the first
  upgrade migration
- Related test infrastructure (VisibleType comparison filters, old
  format test cases)

Resolves: cockroachdb#152629

Release note: None
Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@rafiss rafiss force-pushed the cleanup-visible-type branch from 32944c0 to a2e89c7 Compare February 27, 2026 03:11
@rafiss rafiss marked this pull request as ready for review February 27, 2026 15:27
@rafiss rafiss requested review from a team as code owners February 27, 2026 15:27
@rafiss rafiss requested review from mw5h and spilchen and removed request for a team February 27, 2026 15:27
Copy link
Copy Markdown
Contributor

@spilchen spilchen left a comment

Choose a reason for hiding this comment

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

:lgtm: nice to cleanup this tech debt

@spilchen reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on mw5h).

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Feb 27, 2026

/trunk merge

tftr!

@trunk-io trunk-io bot merged commit 4e08905 into cockroachdb:master Feb 27, 2026
27 of 31 checks passed
@rafiss rafiss deleted the cleanup-visible-type branch March 3, 2026 06:14
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.

sql/types: remove VisibleType field from InternalType proto

3 participants