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
Crash in Alembic comparator for a custom TypeDecorator column when default impl differs from a specific #395
Comments
Changes by frol (@frol):
|
Michael Bayer (@zzzeek) wrote: OK, I'm still not able to reproduce this condition. Note that Alembic is not related to the sqlalchemy-utils project so the ultimate test case cannot rely upon a symbol such as "ScalarCoercible". It does not make sense that "metadata_impl" in this case is a VARBINARY type, that's not how load_dialect_impl() works - load_dialect_impl() provides another PasswordType that has as its impl, the thing you returned from load_dialect_impl():
output:
So I'm not seeing how VARBINARY is leaking into there. Here's my test, I'm trying to get the line in question to trigger and I cannot:
to run this test after applying the patch, run |
Michael Bayer (@zzzeek) wrote: also, there's no reason metadata_impl would be needed inside the proposed comparison because the dialect-specific impl is always a simple subclass of the base type, and the built-in comparators here are only comparing very basic attributes. For more elaborate comparison needs the "compare_against_backend" hook would be used. If there is a bug here, it may very well be in TypeDecorator somehow. anyway hoping this illustrates why I don't accept one-line PRs... |
frol (@frol) wrote: Please, try to use the following in your test: + impl.compare_type(
+ Column('x', types.NUMERIC(50)),
+ Column('x', PasswordType(50))) The change I made is:
I get the crash when I run such test. |
Michael Bayer (@zzzeek) wrote: Compare to metadata_impl in compare_type() to guard against custom TypeDecorator Fixed bug where usage of a custom TypeDecorator which returns a Change-Id: I384df35be9513bf8a2ae55e7daa9a52c23108a49 → 01e9b8d |
Changes by Michael Bayer (@zzzeek):
|
frol (@frol) wrote: Thank you! |
Migrated issue, originally created by frol (@frol)
Having a custom column type, e.g.:
Alembic crashes when tries to compare the existing (the first migration is fine) column with the custom type:
I have attempted to fix this in PR: https://bitbucket.org/zzzeek/alembic/pull-requests/64/
The text was updated successfully, but these errors were encountered: