summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-11-09 15:02:44 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-09 15:27:07 -0500
commitd8c12d9f180eeed9d2c5174eeb0c74169a04262f (patch)
tree6a602b177c8f1af05f835b53a1fa7e9b1609b221 /lib/sqlalchemy/sql/compiler.py
parent9ee47d90d804dc815685d42913ad170e04c38659 (diff)
downloadsqlalchemy-d8c12d9f180eeed9d2c5174eeb0c74169a04262f.tar.gz
set within_columns_clause=False for all sub-elements of select()
Fixed issue where using the feature of using a string label for ordering or grouping described at :ref:`tutorial_order_by_label` would fail to function correctly if used on a :class:`.CTE` construct, when the CTE were embedded inside of an enclosing :class:`_sql.Select` statement that itself was set up as a scalar subquery. Fixes: #7269 Change-Id: Ied6048a1c9a622374a418230c8cfedafa8d3f87e (cherry picked from commit 89661c1a218b7117c1835698dbb81836e72015ae)
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 7db8d6b5d..0f2b5e717 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -3217,6 +3217,9 @@ class SQLCompiler(Compiled):
# passed in. for ORM use this will convert from an ORM-state
# SELECT to a regular "Core" SELECT. other composed operations
# such as computation of joins will be performed.
+
+ kwargs["within_columns_clause"] = False
+
compile_state = select_stmt._compile_state_factory(
select_stmt, self, **kwargs
)