-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Postgresql get_indexes() is erroneously returning EXCLUDE constraints, look to duplicates_index flag as an indicator to skip #461
Comments
Michael Bayer (@zzzeek) wrote: this is an enhancement as there are many things autogenerate does not detect (See the last paragraph where constraint types such as EXCLUDE are mentioned). |
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Fredrik Blomqvist (@fgblomqvist) wrote: Okay that makes sense. However, shouldn't alembic at least just ignore them for now? As in, if it finds an exclude constraint in the DB, just do nothing (I assume that would be a lot less code to write than the actual proper detection)? |
Michael Bayer (@zzzeek) wrote: it's total news to me that postgresql.get_indexes() is finding EXCLUDE constraints. See https://bitbucket.org/zzzeek/sqlalchemy/issues/4122/postgresql-get_indexes-is-returning-a |
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: OK SQLAlchemy is doing the right thing here, fix for Alembic is coming through in https://gerrit.sqlalchemy.org/587 |
Fredrik Blomqvist (@fgblomqvist) wrote: Great, thanks! |
Michael Bayer (@zzzeek) wrote: Resolve Postgresql implicit indexes via duplicates_constraint Fixed bug where autogenerate would produce a DROP statement for the index Change-Id: I7362c8045f69553c6090dd3cb236569b0c9b1e67 → 7426729 |
Changes by Michael Bayer (@zzzeek):
|
Migrated issue, originally created by Fredrik Blomqvist (@fgblomqvist)
When autogenerating migrations alembic wants to drop the excludeconstraint from my DB.
The database in use is PostgreSQL 9.6.5.
The ExcludeConstraint is defined in the table_args at the end of the model, and it is created when doing SQLAlchemy create_all.
The import:
The table args:
This is the code alembic generates:
If this does not ring a bell, I can try to put together an MCV example.
The text was updated successfully, but these errors were encountered: