Skip to content

sql: add tests for SET DATATYPE with enum columns#50120

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
rohany:enum-alter-type
Jun 12, 2020
Merged

sql: add tests for SET DATATYPE with enum columns#50120
craig[bot] merged 1 commit intocockroachdb:masterfrom
rohany:enum-alter-type

Conversation

@rohany
Copy link
Copy Markdown
Contributor

@rohany rohany commented Jun 11, 2020

Fixes #48728.

This PR adds tests for alter column set datatype on enum columns.

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rohany rohany requested a review from RichardJCai June 11, 2020 20:58
statement error pq: foreign key violation: "enum_origin" row x='hello' has no match in "enum_referenced"
ALTER TABLE enum_origin ADD FOREIGN KEY (x) REFERENCES enum_referenced (x)

# Tests for ALTER COLUMN SET DATA TYPE.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add some tests where

  1. The conversion to enum is invalid
  2. enum to another enum
  3. maybe enum to the same enum to make sure the type equivalency check is okay and we perform a no-op.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done 1, 3. 2 isn't possible directly (pg doesnt allow enum -> enum casts), it needs USING EXPRESSION.

@rohany rohany force-pushed the enum-alter-type branch from 8413d55 to c694f76 Compare June 11, 2020 21:42
Fixes cockroachdb#48728.

This PR adds tests for alter column set datatype on enum columns.

Release note: None
@rohany rohany force-pushed the enum-alter-type branch from c694f76 to 763bdcf Compare June 12, 2020 00:02
@rohany
Copy link
Copy Markdown
Contributor Author

rohany commented Jun 12, 2020

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 12, 2020

Build failed (retrying...)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 12, 2020

Build failed (retrying...)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 12, 2020

Build succeeded

@craig craig bot merged commit 21a663b into cockroachdb:master Jun 12, 2020
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.

sql: allow schema change infrastructure to operate on user defined types

3 participants