Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: implement information_schema.{_pg_truetypid, _pg_truetypmod, _pg_char_max_length} #69913

Merged
merged 2 commits into from
Sep 14, 2021

Conversation

nvanbenschoten
Copy link
Member

Needed for #69010.

This PR adds implementations for the following three builtin functions
information_schema._pg_truetypid
information_schema._pg_truetypmod
information_schema._pg_char_max_length

The first two functions return the "true" type ID and modifier, disregarding indirection introduced by domain types. The third returns the maximum character length of a type with the provided ID and modifier.

The builtins are implemented as user-defined functions in Postgres here: https://github.com/postgres/postgres/blob/master/src/backend/catalog/information_schema.sql

Combined with #69909 and #69911, this PR unlocks these two gnarly introspection queries in PostgREST:

Release justification: None, waiting for v22.1.

@nvanbenschoten nvanbenschoten requested a review from a team September 8, 2021 06:10
@cockroach-teamcity
Copy link
Member

This change is Reviewable

pkg/sql/sem/builtins/pg_builtins.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nit: can you add these new builtins to release notes?

…a._pg_truetypmod

Needed for cockroachdb#69010.

This commit adds implementations for the `information_schema._pg_truetypid` and
`information_schema._pg_truetypmod` builtin functions. These functions return the
"true" type ID and modifier, disregarding indirection introduced by domain types.

The builtins are implemented as user-defined functions in Postgres here:
https://github.com/postgres/postgres/blob/master/src/backend/catalog/information_schema.sql

Release justification: None, waiting for v22.1.

Release note (sql change): The `information_schema._pg_truetypid` and
`information_schema._pg_truetypmod` builtin functions are now supported,
which improve compatibility with PostgreSQL.
Needed for cockroachdb#69010.

This commit adds implementations for the `information_schema._pg_char_max_length`
builtin function. This functions returns the maximum character length of a type
with the provided ID and modifier.

The builtin is implemented as a user-defined function in Postgres here:
https://github.com/postgres/postgres/blob/master/src/backend/catalog/information_schema.sql

Release justification: None, waiting for v22.1.

Release note (sql change): The `information_schema._pg_char_max_length`
builtin function is now supported, which improves compatibility with
PostgreSQL.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/pg_truetypmod branch from a8a419c to 3d9b5cd Compare September 13, 2021 22:45
@nvanbenschoten
Copy link
Member Author

nit: can you add these new builtins to release notes?

Done.

TFTRs!

@nvanbenschoten
Copy link
Member Author

bors r+

@craig
Copy link
Contributor

craig bot commented Sep 14, 2021

Build succeeded:

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.

4 participants