summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-08-11 15:52:28 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-08-14 01:18:06 -0400
commit1a990ee33239aa275567cb926a5b421b2087294b (patch)
treeedc023629e1f82a2d66e2a5ab6320681a0e91810 /lib/sqlalchemy/sql/base.py
parente331da58a6d136aff824b43312424083090a7c90 (diff)
downloadsqlalchemy-1a990ee33239aa275567cb926a5b421b2087294b.tar.gz
Ensure Oracle index w/ col DESC etc. is reflected
Fixed bug where an index reflected under Oracle with an expression like "column DESC" would not be returned, if the table also had no primary key, as a result of logic that attempts to filter out the index implicitly added by Oracle onto the primary key columns. Reworked the "filter out the primary key index" logic in oracle get_indexes() to be clearer. This changeset also adds an internal check to ColumnCollection to accomodate for the case of a column being added twice, as well as adding a private _table argument to Index such that reflection can specify the Table explicitly. The _table argument can become part of public API in a later revision or release if needed. Change-Id: I745711e03b3e450b7f31185fc70e10d3823063fa Fixes: #4042
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r--lib/sqlalchemy/sql/base.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py
index 7a04beb57..4d638ea1d 100644
--- a/lib/sqlalchemy/sql/base.py
+++ b/lib/sqlalchemy/sql/base.py
@@ -517,6 +517,10 @@ class ColumnCollection(util.OrderedProperties):
# columns collection
existing = self[key]
+
+ if existing is value:
+ return
+
if not existing.shares_lineage(value):
util.warn('Column %r on table %r being replaced by '
'%r, which has the same key. Consider '