]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Raise at Core / ORM concrete inh level for label overlap
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Mar 2021 15:59:16 +0000 (11:59 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Mar 2021 17:12:34 +0000 (13:12 -0400)
commitdfce8c35d3f95c401957f4d0ddaf8c7f49f52ece
tree44bd505932dab87b629110c52afd1c05d497f307
parent3fec5028e695ad138aa46a0ae66c55e8bcb653f6
Raise at Core / ORM concrete inh level for label overlap

Fixed regression where the :class:`.ConcreteBase` would fail to map at all
when a mapped column name overlapped with the discriminator column name,
producing an assertion error. The use case here did not function correctly
in 1.3 as the polymorphic union would produce a query that ignored the
discriminator column entirely, while emitting duplicate column warnings. As
1.4's architecture cannot easily reproduce this essentially broken behavior
of 1.3 at the ``select()`` level right now, the use case now raises an
informative error message instructing the user to use the
``.ConcreteBase._concrete_discriminator_name`` attribute to resolve the
conflict. To assist with this configuration,
``.ConcreteBase._concrete_discriminator_name`` may be placed on the base
class only where it will be automatically used by subclasses; previously
this was not the case.

Fixes: #6090
Change-Id: I8b7d01e4c9ea0dc97f30b8cd658b3505b24312a7
doc/build/changelog/unreleased_14/6090.rst [new file with mode: 0644]
lib/sqlalchemy/ext/declarative/extensions.py
lib/sqlalchemy/orm/util.py
lib/sqlalchemy/sql/elements.py
test/ext/declarative/test_inheritance.py
test/sql/test_selectable.py