Skip to content

Create a function to get a type's name from an oid - #39877

Open
SangJunBak wants to merge 1 commit into
jun/durable-columnfrom
jun/name-from-oid
Open

SangJunBak wants to merge 1 commit into
jun/durable-columnfrom
jun/name-from-oid

Conversation

@SangJunBak

@SangJunBak SangJunBak commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Our existing name_from_oid function (Type::from_oid) only accepts oids that rust-postgres knows about, thus we need to create a function for our custom OIDs too.

There's a chance of skew in case we add a new scalar type and don't remember to update this function. However, this function is intended to be temporary. To explain, we use this function such that our builtin relation mz_catalog.mz_columns
can get a type's name from its durably stored oid using a SQL scalar function.
However, we can replace the scalar function with a join on mz_builtin_types once it's been
migrated to a builtin materialized view.

Motivation

Part of sql-494

Verification

This is a small change that expands a function that simply maps an oid to a string.

@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

SQL-494

@SangJunBak
SangJunBak added this pull request to stack #39878 October 15, 2026 19:42
@SangJunBak
SangJunBak marked this pull request as ready for review October 15, 2026 20:47
@SangJunBak
SangJunBak requested review from a team as code owners October 15, 2026 20:47
Our existing name_from_oid function (`Type::from_oid`) only accepts `oid`s that `rust-postgres` knows about, thus we need to create a function for our custom OIDs too.

There's a chance of skew in case we add a new scalar type and don't remember to update this function. However, this function is intended to be temporary. To explain, we use this function such that our builtin relation `mz_catalog.mz_columns`
can get a type's name from its durably stored `oid` using a SQL scalar function.
However, we can replace the scalar function with a join on `mz_builtin_types` once it's been
migrated to a builtin materialized view.

This branch has not been deployed

No deployments
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.

1 participant