summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ansisql.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r--lib/sqlalchemy/ansisql.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py
index 322af1562..f13a7b84f 100644
--- a/lib/sqlalchemy/ansisql.py
+++ b/lib/sqlalchemy/ansisql.py
@@ -262,7 +262,10 @@ class ANSICompiler(sql.Compiled):
# redefine the generated name of the bind param in the case
# that we have multiple conflicting bind parameters.
while self.binds.setdefault(key, bindparam) is not bindparam:
- key = "%s_%d" % (bindparam.key, count)
+ # insure the name doesn't expand the length of the string
+ # in case we're at the edge of max identifier length
+ tag = "_%d" % count
+ key = bindparam.key[0 : len(bindparam.key) - len(tag)] + tag
count += 1
bindparam.key = key
self.strings[bindparam] = self.bindparam_string(key)