]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix type of CASE expressions which include NULLs
authorDavid Evans <dave@evansd.net>
Mon, 15 Jan 2024 15:13:53 +0000 (10:13 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 15 Jan 2024 17:08:10 +0000 (12:08 -0500)
commit8f4ac0c0f07509d2f8a4bce9cbb07ac08ad04044
treeb507abd980550de67bd939fc2bc7b3bd3f16e6e0
parent2c8a05244a8f7919c3954e0b6e1efaa996792772
Fix type of CASE expressions which include NULLs

Fixed issues in :func:`_sql.case` where the logic for determining the
type of the expression could result in :class:`.NullType` if the last
element in the "whens" had no type, or in other cases where the type
could resolve to ``None``.  The logic has been updated to scan all
given expressions so that the first non-null type is used, as well as
to always ensure a type is present.  Pull request courtesy David Evans.

updates to test suite to use modern fixture patterns by Mike

Fixes: #10843
Closes: #10847
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10847
Pull-request-sha: 4fd5c39ab56de046e68c08f6c20cd1f7b2cb0e0d

Change-Id: I40f905ac336a8a42b617ff9473dbd9c22ac57505
doc/build/changelog/unreleased_20/10843.rst [new file with mode: 0644]
lib/sqlalchemy/sql/elements.py
test/sql/test_case_statement.py