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: add the crdb_internal.create_type_statements table #49771

Merged
merged 1 commit into from
Jun 2, 2020

Conversation

rohany
Copy link
Contributor

@rohany rohany commented Jun 1, 2020

This PR adds the crdb_internal.create_type_statments table, which
contains create statements for user defined types. This will be used
when generating create statments for cockroach dump in #47765.

This PR additionally refactors and deduplicates some code that iterates
over all user defined type descriptors in other virtual tables.

Release note (sql change): Add the
crdb_internal.create_type_statements virtual table. It holds create
statements for user defined types.

@rohany rohany requested review from jordanlewis and otan June 1, 2020 20:37
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rohany rohany requested a review from a team as a code owner June 2, 2020 01:37
This PR adds the `crdb_internal.create_type_statments` table, which
contains create statements for user defined types. This will be used
when generating create statments for `cockroach dump` in cockroachdb#47765.

This PR additionally refactors and deduplicates some code that iterates
over all user defined type descriptors in other virtual tables.

Release note (sql change): Add the
`crdb_internal.create_type_statements` virtual table. It holds create
statements for user defined types.
Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

small test request, otherwise LGTM

statement ok
SET experimental_enable_enums=true;
CREATE TYPE enum1 AS ENUM ('hello', 'hi');
CREATE TYPE enum2 AS ENUM ()
Copy link
Contributor

Choose a reason for hiding this comment

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

can you try one with an enum value inserted in between?

Copy link
Contributor

Choose a reason for hiding this comment

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

(same with pg_catalog)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, what do you mean?

Copy link
Contributor

Choose a reason for hiding this comment

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

ALTER TYPE enum1 ADD VALUE 'interjection!' AFTER 'hello'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol we don't support alter type yet. I'll go back and add cases for that everywhere once we do.

@rohany
Copy link
Contributor Author

rohany commented Jun 2, 2020

bors r=otan

@craig
Copy link
Contributor

craig bot commented Jun 2, 2020

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.

3 participants