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

Fix ALTER TYPE to update column types #973

merged 3 commits into from Apr 14, 2021


Copy link

Fixed an issue when ALTER TYPE <from> RENAME TO <to> does not update all the columns that uses that type. It will rename the type but currently does not rename all the column types in existing tables.

The below example currently does not work correctly. It will rename the type event to new_event but it does not rename the column status to the new_event type.

CREATE TYPE event AS enum ('START', 'STOP');

CREATE TABLE log_lines (
  status "event"  NOT NULL

ALTER TYPE event RENAME TO "new_event";

-- name: ListAuthors :many
SELECT * FROM log_lines;

@kyleconroy kyleconroy merged commit 9aad696 into kyleconroy:master Apr 14, 2021
3 checks passed
victoraugustolls pushed a commit to Streppel/sqlc that referenced this pull request May 6, 2021
* fixed alter type to update column types

* tests for alter type with update table columns

* make for loop more readable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants