]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
track item schema names to identify name collisions w/ default schema
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Dec 2021 23:04:47 +0000 (18:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 14 Jan 2022 21:54:13 +0000 (16:54 -0500)
commit06f83c26ea3636eaec0b85fc9d733ab4bfb827ec
tree13d43b9007f956bf514d757ce6781a378125fc3e
parenta869dc8fe3cd579ed9bab665d215a6c3e3d8a4ca
track item schema names to identify name collisions w/ default schema

Added an additional lookup step to the compiler which will track all FROM
clauses which are tables, that may have the same name shared in multiple
schemas where one of the schemas is the implicit "default" schema; in this
case, the table name when referring to that name without a schema
qualification will be rendered with an anonymous alias name at the compiler
level in order to disambiguate the two (or more) names. The approach of
schema-qualifying the normally unqualified name with the server-detected
"default schema name" value was also considered, however this approach
doesn't apply to Oracle nor is it accepted by SQL Server, nor would it work
with multiple entries in the PostgreSQL search path. The name collision
issue resolved here has been identified as affecting at least Oracle,
PostgreSQL, SQL Server, MySQL and MariaDB.

Fixes: #7471
Change-Id: Id65e7ca8c43fe8d95777084e8d5ec140ebcd784d
doc/build/changelog/unreleased_20/7471.rst [new file with mode: 0644]
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/testing/suite/test_select.py
test/requirements.py
test/sql/test_compiler.py