Skip to content

Fall back to raw SQL for NOT VALID foreign key constraints #539

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

Conversation

andrew-farries
Copy link
Collaborator

@andrew-farries andrew-farries commented Dec 16, 2024

Update how sql2pgroll handles conversion of ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY statements.

Fall back to raw SQL if NOT VALID is specified as part of an ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY statement because OpCreateMultiColumnConstraint currently always validates foreign key constraints.

`pgroll` currently always validates foreign key constraints. If NOT
VALID is specified as part of the SQL, then fall back to a raw SQL
operation.
@andrew-farries andrew-farries marked this pull request as ready for review December 16, 2024 16:33
@andrew-farries andrew-farries merged commit c68ba72 into convert-add-check-constraint Dec 17, 2024
28 checks passed
@andrew-farries andrew-farries deleted the raw-sql-for-not-valid-fk-constraints branch December 17, 2024 07:09
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