]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Adjust CTE recrusive col list to accommodate dupe col names
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Jul 2021 23:48:55 +0000 (19:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 13 Jul 2021 14:25:52 +0000 (10:25 -0400)
commita0953bb7095dde805de8c13699b122767ed001b9
tree767868254068073538b2049a53cb175ca7da7a52
parent673ca806b323f47ef7064dd64ffc98240818b930
Adjust CTE recrusive col list to accommodate dupe col names

Fixed issue in CTE constructs where a recursive CTE that referred to a
SELECT that has duplicate column names, which are typically deduplicated
using labeling logic in 1.4, would fail to refer to the deduplicated label
name correctly within the WITH clause.

As part of this change we are also attempting to remove the
behavior of SelectStatementGrouping forcing off the "asfrom"
contextual flag, which will have the result of additional labeling
being applied to some UNION and similar statements when they are
interpreted as subqueries.  To maintain compatibility with
"grouping", the Grouping/SelectStatementGrouping are now broken
out into two separate compiler cases, as the "asfrom" logic appears
to be tailored towards table valued SELECTS as column expressions.

Fixes: #6710
Change-Id: I8af07a5c670dbe5736cd9f16084ef82f5e4c8642
doc/build/changelog/unreleased_14/6710.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/selectable.py
test/orm/test_core_compilation.py
test/sql/test_compiler.py
test/sql/test_cte.py
test/sql/test_selectable.py