You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using a Computed column in a Postgresql database and created a migration. The next migration I create with automigration returns a warning: alembic\autogenerate\compare.py:1034: UserWarning: Computed default on table.search_vector cannot be modified
The string generated for comparison by _normalize_computed_default: setweightto_tsvectorenglish,title,a setweightto_tsvectorenglish::regconfig,title::text,a::char
Proposed solution
Remove groups of text starting with :: by adding another regex substitution.
def_normalize_computed_default(sqltext: str) ->str:
"""we want to warn if a computed sql expression has changed. however we don't want false positives and the warning is not that critical. so filter out most forms of variability from the SQL text. """normalized_sqltext=re.sub(r"[ \(\)'\"`\[\]]", "", sqltext).lower()
returnre.sub(r"::\w+", "", normalized_sqltext)
The text was updated successfully, but these errors were encountered:
seems like a sensible solution. There is already some code that's trying to compare the index expression in the postgresql dialect, so maybe that could be re-used.
Describe the bug
I am using a Computed column in a Postgresql database and created a migration. The next migration I create with automigration returns a warning:
alembic\autogenerate\compare.py:1034: UserWarning: Computed default on table.search_vector cannot be modified
The string generated for comparison by
_normalize_computed_default
:setweightto_tsvectorenglish,title,a
setweightto_tsvectorenglish::regconfig,title::text,a::char
The code responsible for this:
alembic/alembic/autogenerate/compare.py
Lines 979 to 986 in 44965f0
Proposed solution
Remove groups of text starting with
::
by adding another regex substitution.The text was updated successfully, but these errors were encountered: