Key updating after insert is triggering validations

Issue #3167 resolved
Mario Benito Ríos created an issue

With MySQL backend, on commit after creating a new object with "autoincrement" PK, key updating is triggering validator. See https://bitbucket.org/zzzeek/sqlalchemy/src/2de7f94739ec1873e1dce48797e1e6f12044cf4c/lib/sqlalchemy/orm/persistence.py?at=master#cl-650

Documentation says only user assignments trigger validations, so this case shouldn't trigger validation.

Comments (4)

  1. Mike Bayer repo owner
    • Fixed bug where attribute "set" events or columns with @validates would have events triggered within the flush process, when those columns were the targets of a "fetch and populate" operation, such as an autoincremented primary key, a Python side default, or a server-side default "eagerly" fetched via RETURNING. fixes #3167

    → <<cset 530d3f07e0c1>>

  2. Mike Bayer repo owner
    • marked as major
    • changed milestone to 1.0

    the fix here changes some internal behaviors quite a bit, not to mention who knows if an app sort of expects this behavior, so targeting this at 1.0.

  3. Log in to comment