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

Handle DEFERRABLE and NOT DEFERRABLE constraints in CREATE TABLE statements #556

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

andrew-farries
Copy link
Collaborator

Handle DEFERRABLE and NOT DEFERRABLE constraints in CREATE TABLE statements

NOT DEFERRABLE constraints are the default, so add testcases to ensure that constraints with this modifier are converted to OpCreateTable operations.

DEFERRABLE constraints and the INITIALLY IMMEDIATE and INITIALLY DEFERRED modifiers are not supported, so fall back to raw SQL operations when these options are present.

@andrew-farries andrew-farries marked this pull request as ready for review December 19, 2024 12:27
@andrew-farries andrew-farries force-pushed the fall-back-to-sql-for-generated-columns branch from fa641ad to 01eb345 Compare December 19, 2024 12:57
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from 9e26340 to 5fcd47c Compare December 19, 2024 12:57
@andrew-farries andrew-farries force-pushed the fall-back-to-sql-for-generated-columns branch from 01eb345 to ef7cf14 Compare December 19, 2024 13:12
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from 5fcd47c to 7888983 Compare December 19, 2024 13:12
@andrew-farries andrew-farries force-pushed the fall-back-to-sql-for-generated-columns branch from ef7cf14 to ae7ba5f Compare December 19, 2024 13:17
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from 7888983 to 6d7bb59 Compare December 19, 2024 13:17
@andrew-farries andrew-farries force-pushed the fall-back-to-sql-for-generated-columns branch from ae7ba5f to 05706a1 Compare December 19, 2024 13:20
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from 6d7bb59 to 714eb1c Compare December 19, 2024 13:20
@andrew-farries andrew-farries force-pushed the fall-back-to-sql-for-generated-columns branch from 05706a1 to 6be317b Compare December 19, 2024 13:29
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from 714eb1c to f54ea25 Compare December 19, 2024 13:29
Base automatically changed from fall-back-to-sql-for-generated-columns to main December 19, 2024 13:32
`NOT DEFERRABLE` constraints are the default behhavior in PostgreSQL, so
they should be converted to the same operations as when `NOT DEFERRABLE`
is not specified.
Deferrable constraints can't be represented by `pgroll` operations, so
fall back to raw SQL for them.
@andrew-farries andrew-farries force-pushed the handle-deferable-constraints-in-create-table branch from f54ea25 to 7e8ad0f Compare December 19, 2024 13:32
@andrew-farries andrew-farries merged commit c64edc6 into main Dec 19, 2024
28 checks passed
@andrew-farries andrew-farries deleted the handle-deferable-constraints-in-create-table branch December 19, 2024 13:35
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.

2 participants