]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't post-SELECT columns w/o a server default/onupdate for eager_defaults
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 9 Feb 2017 02:42:34 +0000 (21:42 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 9 Feb 2017 03:00:28 +0000 (22:00 -0500)
commit000e9603065edeb997cfcb492c4063029a931de9
treec45740be7141815f1544ebe8a1b3fd8d2ac920ef
parent7db699163bed203d8060f06097e1489eea7ba079
Don't post-SELECT columns w/o a server default/onupdate for eager_defaults

Fixed a major inefficiency in the "eager_defaults" feature whereby
an unnecessary SELECT would be emitted for column values where the
ORM had explicitly inserted NULL, corresponding to attributes that
were unset on the object but did not have any server default
specified, as well as expired attributes on update that nevertheless
had no server onupdate set up.   As these columns are not part of the
RETURNING that eager_defaults tries to use, they should not be
post-SELECTed either.

Change-Id: I0d4f1e9d3d9717d68dcc0592f69456a1f1c36df8
Fixes: #3909
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/persistence.py
test/orm/test_unitofworkv2.py