]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
trust user PK argument as given; don't reduce
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 23 Mar 2022 00:14:04 +0000 (20:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 23 Mar 2022 16:12:54 +0000 (12:12 -0400)
commit548e41ec5df96435d7cf4d0f7cde4cc7cd4e2f61
tree2174c4ded8df4afec1677f6b35975efcf75ed937
parent845aacd5fc8fdc7839597c0e75c447180f7b438d
trust user PK argument as given; don't reduce

Fixed issue where the :class:`_orm.Mapper` would reduce a user-defined
:paramref:`_orm.Mapper.primary_key` argument too aggressively, in the case
of mapping to a ``UNION`` where for some of the SELECT entries, two columns
are essentially equivalent, but in another, they are not, such as in a
recursive CTE. The logic here has been changed to accept a given
user-defined PK as given, where columns will be related to the mapped
selectable but no longer "reduced" as this heuristic can't accommodate for
all situations.

Fixes: #7842
Change-Id: Ie46f0a3d42cae0501641fa213da0a9d5ca26c3ad
(cherry picked from commit d051645463b169bf1535459653eff247cb772e62)
doc/build/changelog/unreleased_14/7842.rst [new file with mode: 0644]
lib/sqlalchemy/orm/mapper.py
test/orm/test_mapper.py