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

Don't consider partial unique index creation as making a column not nullable #280

Conversation

devend711
Copy link
Contributor

@devend711 devend711 commented Feb 1, 2024

One more fix related to #250: the current regex match only makes an exception for "CREATE INDEX" but not "CREATE UNIQUE INDEX", which is safe for the same reasons

Same idea as the fix in #258

@devend711 devend711 marked this pull request as ready for review February 1, 2024 15:34
Copy link
Collaborator

@David-Wobrock David-Wobrock left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

@@ -308,6 +308,10 @@ def test_create_index_concurrently_where(self):
sql = 'CREATE INDEX CONCURRENTLY "index_name" ON "table_name" ("a_column") WHERE ("some_column" IS NOT NULL);'
self.assertValidSql(sql)

def test_create_unique_index_concurrently_where(self):
sql = 'CREATE UNIQUE INDEX CONCURRENTLY "index_name" ON "table_name" ("a_column") WHERE ("some_column" IS NOT NULL);'
self.assertValidSql(sql)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@devend711 devend711 Feb 5, 2024

Choose a reason for hiding this comment

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

good catch, I think tests should be updated now to assert that it's at least raising the uniqueness error and not the not null error

@David-Wobrock David-Wobrock self-assigned this Feb 4, 2024
@David-Wobrock David-Wobrock force-pushed the 250-adding-a-unique-index-with-a-not-null-condition-incorrectly-triggers-not_null-rule branch from 427a2d2 to 3197651 Compare March 30, 2024 10:40
@David-Wobrock David-Wobrock force-pushed the 250-adding-a-unique-index-with-a-not-null-condition-incorrectly-triggers-not_null-rule branch from 3197651 to 5b20f43 Compare March 30, 2024 10:41
@David-Wobrock David-Wobrock merged commit a230681 into 3YOURMIND:main Mar 30, 2024
8 checks passed
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.

None yet

2 participants