]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use ExpressionElementRole for case targets in case()
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Nov 2021 01:26:44 +0000 (21:26 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Nov 2021 01:34:40 +0000 (21:34 -0400)
commite09934443b45d58d775fa6f847ded49c18246f63
tree661334477dbbd618df0147bd729482422d927bc7
parenteb6bddb160fd8ba1cf87b6c4548ec9a29c34c279
use ExpressionElementRole for case targets in case()

Fixed regression where the :func:`_sql.text` construct would no longer be
accepted as a target case in the "whens" list within a :func:`_sql.case`
construct. The regression appears related to an attempt to guard against
some forms of literal values that were considered to be ambiguous when
passed here; however, there's no reason the target cases shouldn't be
interpreted as open-ended SQL expressions just like anywhere else, and a
literal string or tuple will be converted to a bound parameter as would be
the case elsewhere.

Fixes: #7287
Change-Id: I75478adfa115f3292cb1362cc5b2fdf152b0ed6f
(cherry picked from commit 77a17797ecc08736ea942e29f79df4f96bd74e0c)
doc/build/changelog/unreleased_14/7287.rst [new file with mode: 0644]
lib/sqlalchemy/sql/elements.py
test/sql/test_case_statement.py
test/sql/test_text.py