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

feat(sql/catalog): Support ALTER TABLE IF EXISTS #2542

Merged
merged 6 commits into from
Jul 29, 2023

Conversation

kyleconroy
Copy link
Collaborator

@kyleconroy kyleconroy commented Jul 28, 2023

Add IF EXISTS support to the following ALTER TABLE statements:

ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ]
    action [, ... ]
ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ]
    RENAME [ COLUMN ] column_name TO new_column_name
ALTER TABLE [ IF EXISTS ] [ ONLY ] name [ * ]
    RENAME CONSTRAINT constraint_name TO new_constraint_name
ALTER TABLE [ IF EXISTS ] name
    RENAME TO new_name
ALTER TABLE [ IF EXISTS ] name
    SET SCHEMA new_schema
ALTER TABLE [ IF EXISTS ] name
    ATTACH PARTITION partition_name { FOR VALUES partition_bound_spec | DEFAULT }
ALTER TABLE [ IF EXISTS ] name
    DETACH PARTITION partition_name [ CONCURRENTLY | FINALIZE ]

Fixes #2524

@kyleconroy kyleconroy merged commit d354c0e into main Jul 29, 2023
7 checks passed
@kyleconroy kyleconroy deleted the kyle/ddl-alert-table-if-exists branch July 29, 2023 18:04
This pull request was closed.
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.

sqlc generate ignores IF EXISTS on ALTER TABLE
1 participant