-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Autogeneration of index with coalesce function produces invalid SQL #1492
Comments
Hi, thanks for reporting. Here the issue seems to be when compiling the statement, not autogenerate |
So the create index is managed by sqlalchemy. @zzzeek what do you think is best here? Modify what is rendered by autogenerate, so render |
I feel like this cant be the only case where some artificial parenthesis need to be added, nothing else in mysql / pg / sql server dialects? indeed, take a look at alembic/alembic/ddl/postgresql.py Lines 427 to 448 in b8e2c35
|
Good catch. I forgot to look for self_group |
Describe the bug
When we declare an index using a coalesce function, the SQL migration instruction produced is invalid because it is missing some parenthesis around the coalesce function.
Example of the invalid generated alembic instruction:
And the invalid SQL instruction produced:
Expected behavior
The valid expected SQL instruction is:
To Reproduce
Auto-generate:
Error
Versions.
Additional context
Also when doing an
alembic check
after the index creation, it prints a warning:Is it expected ? How can I fix it ?
Have a nice day!
The text was updated successfully, but these errors were encountered: