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

Fixed #26034 -- Fixed incorrect index handling on PostgreSQL on Char/TextField with unique=True and db_index=True. #5947

Merged
merged 2 commits into from Jan 8, 2016

Conversation

timgraham
Copy link
Member

@@ -111,13 +111,13 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
new_db_params, strict,
)
# Added an index? Create any PostgreSQL-specific indexes.
if ((not old_field.db_index and new_field.db_index) or (not old_field.unique and new_field.unique)):
if not old_field.db_index and not old_field.unique and (new_field.db_index or new_field.unique):
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious as to why we're even checking unique.

Does not old_field.db_index and new_field.db_index works?

Copy link
Member

Choose a reason for hiding this comment

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

Oh are we creating the _like indexes even when unique=True? I wasn't expecting that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct

@charettes
Copy link
Member

It would be great if you actually inspected the index details to make sure the correct ones are created.

@timgraham
Copy link
Member Author

As you noted, I think there are other bugs here, but the one in the ticket should be fixed.

@charettes
Copy link
Member

Looking at the index name should be good enough, LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants