]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Run PK/FK sync for multi-level inheritance w/ no intermediary update
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 12 Jun 2019 17:15:59 +0000 (13:15 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 12 Jun 2019 18:01:01 +0000 (14:01 -0400)
commit61a741351433453b8b0a38dcf8dc57b8092fdc60
tree573e45f2e05baa95870fcbaf252bcb3a839075c2
parentd409d255f91a90da37f615f8956d7ec51d008707
Run PK/FK sync for multi-level inheritance w/ no intermediary update

Also fix DetectKeySwitch for intermediary class relationship

Fixed a series of related bugs regarding joined table inheritance more than
two levels deep, in conjunction with modification to primary key values,
where those primary key columns are also linked together in a foreign key
relationship as is typical for joined table inheritance.  The intermediary
table in a  three-level inheritance hierachy will now get its UPDATE if
only the primary key value has changed and passive_updates=False (e.g.
foreign key constraints not being enforced), whereas before it would be
skipped; similarly, with passive_updates=True (e.g. ON UPDATE  CASCADE in
effect), the third-level table will not receive an UPDATE statement as was
the case earlier which would fail since CASCADE already modified it.   In a
related issue, a relationship linked to a three-level inheritance hierarchy
on the primary key of an intermediary table of a joined-inheritance
hierarchy will also correctly have its foreign key column updated when the
parent object's primary key is modified, even if that parent object is a
subclass of the linked parent class, whereas before these classes would
not be counted.

Fixes: #4723
Change-Id: Idc408ead67702068e64d583a15149dd4beeefc24
(cherry picked from commit 3f7840c2ade87e415c24c69ac5d0494d294750e0)
doc/build/changelog/unreleased_13/4723.rst [new file with mode: 0644]
lib/sqlalchemy/orm/dependency.py
lib/sqlalchemy/orm/persistence.py
test/orm/test_naturalpks.py