From 358bc9db1c86fc26d89ed726305a109af14e2572 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 8 Dec 2009 02:31:59 +0000 Subject: [PATCH] - removed needless "counter" behavior with select() labelnames that match a column name in the table, i.e. generates "tablename_id" for "id", instead of "tablename_id_1" in an attempt to avoid naming conflicts, when the table has a column actually named "tablename_id" - this is because the labeling logic is always applied to all columns so a naming conflict will never occur. --- CHANGES | 9 +++++++++ lib/sqlalchemy/sql/expression.py | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 0cfc4f4631..87f484f69c 100644 --- a/CHANGES +++ b/CHANGES @@ -241,6 +241,15 @@ CHANGES with underscores for dots, i.e. "dbo_master_table_column". This is a "friendly" label that behaves better in result sets. [ticket:1428] + + - removed needless "counter" behavior with select() + labelnames that match a column name in the table, + i.e. generates "tablename_id" for "id", instead of + "tablename_id_1" in an attempt to avoid naming + conflicts, when the table has a column actually + named "tablename_id" - this is because + the labeling logic is always applied to all columns + so a naming conflict will never occur. - Deprecated or removed: * "scalar" flag on select() is removed, use diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 1b9f89ae13..b7708c338d 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -3022,14 +3022,6 @@ class ColumnClause(_Immutable, ColumnElement): label = _escape_for_generated(self.table.name) + "_" + \ _escape_for_generated(self.name) - if label in self.table.c: - # TODO: coverage does not seem to be present for this - _label = label - counter = 1 - while _label in self.table.c: - _label = label + "_" + str(counter) - counter += 1 - label = _label return _generated_label(label) else: -- 2.47.3