]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
establish consistency for RETURNING column labels
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 7 Nov 2022 23:40:03 +0000 (18:40 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Nov 2022 19:48:49 +0000 (14:48 -0500)
commitf44e233dccd7739a9f73a2ea16ce6b5b8d7d0f5f
tree170febc81dd799e96f7c304c887224c84d6c6daa
parent1175768618d3a84578b90befe73240b417ebeb78
establish consistency for RETURNING column labels

For the PostgreSQL and SQL Server dialects only, adjusted the compiler so
that when rendering column expressions in the RETURNING clause, the "non
anon" label that's used in SELECT statements is suggested for SQL
expression elements that generate a label; the primary example is a SQL
function that may be emitting as part of the column's type, where the label
name should match the column's name by default. This restores a not-well
defined behavior that had changed in version 1.4.21 due to :ticket:`6718`,
:ticket:`6710`. The Oracle dialect has a different RETURNING implementation
and was not affected by this issue. Version 2.0 features an across the
board change for its widely expanded support of RETURNING on other
backends.

Fixed issue in the Oracle dialect where an INSERT statement that used
``insert(some_table).values(...).returning(some_table)`` against a full
:class:`.Table` object at once would fail to execute, raising an exception.

Fixes: #8770
Change-Id: I2ab078a214a778ffe1720dbd864ae4c105a0691d
(cherry picked from commit c8a7b67181d31634355150fc0379ec0e780ff728)
doc/build/changelog/unreleased_14/8770.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/oracle/cx_oracle.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/selectable.py
test/dialect/mssql/test_compiler.py
test/dialect/oracle/test_compiler.py
test/dialect/postgresql/test_compiler.py
test/sql/test_labels.py
test/sql/test_returning.py