]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
rework wraps_column_expression logic to be purely compile time checking
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 16 Jun 2025 23:53:30 +0000 (19:53 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 19 Jun 2025 14:34:52 +0000 (10:34 -0400)
commit0f59ed6f37674e70caf7da18aab0c8f68db78ce0
tree6cacacd91396503c958de2b64980d49035bd3a2a
parent267b99c7848d578c494a66c56929635f2397967e
rework wraps_column_expression logic to be purely compile time checking

Fixed issue where :func:`.select` of a free-standing, unnamed scalar expression that
has a unary operator applied, such as negation, would not apply result
processors to the selected column even though the correct type remains in
place for the unary expression.

This change opened up a typing rabbithole where we were led to also
improve and harden the typing for the Exists element, in particular
in that the Exists now always refers to a ScalarSelect object, and
no longer a SelectStatementGrouping within the _regroup() cases; there
did not seem to be any reason for this inconsistency.

Fixes: #12681
Change-Id: If9131807941030c627ab31ede4ccbd86e44e707f
(cherry picked from commit c96805a43aa76bc3ec5134832a5050d527e432fe)
doc/build/changelog/unreleased_20/12681.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/assertions.py
test/sql/test_labels.py
test/sql/test_operators.py
test/sql/test_selectable.py
test/sql/test_types.py