summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/sqlite/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-19 00:34:30 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-19 00:34:30 -0400
commit9e3458c4793e863737df371774b39c4c05858abd (patch)
tree66f0e323bc04d35fc7794b7a33cb75068be9a0b3 /lib/sqlalchemy/dialects/sqlite/base.py
parentb76995600a633ed769530a00b6489560456e7b0c (diff)
downloadsqlalchemy-9e3458c4793e863737df371774b39c4c05858abd.tar.gz
- [bug] Adjusted a very old bugfix which attempted
to work around a SQLite issue that itself was "fixed" as of sqlite 3.6.14, regarding quotes surrounding a table name when using the "foreign_key_list" pragma. The fix has been adjusted to not interfere with quotes that are *actually in the name* of a column or table, to as much a degree as possible; sqlite still doesn't return the correct result for foreign_key_list() if the target table actually has quotes surrounding its name, as *part* of its name (i.e. """mytable"""). [ticket:2568]
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index 717d6b49a..651fa05e5 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -723,7 +723,6 @@ class SQLiteDialect(default.DefaultDialect):
(name, type_, nullable, default, has_default, primary_key) = \
(row[1], row[2].upper(), not row[3],
row[4], row[4] is not None, row[5])
- name = re.sub(r'^\"|\"$', '', name)
match = re.match(r'(\w+)(\(.*?\))?', type_)
if match:
coltype = match.group(1)
@@ -780,9 +779,12 @@ class SQLiteDialect(default.DefaultDialect):
# was created with REFERENCES <tablename>, no col
if rcol is None:
rcol = lcol
- rtbl = re.sub(r'^\"|\"$', '', rtbl)
- lcol = re.sub(r'^\"|\"$', '', lcol)
- rcol = re.sub(r'^\"|\"$', '', rcol)
+
+ # see http://www.sqlalchemy.org/trac/ticket/2568
+ # as well as http://www.sqlite.org/src/info/600482d161
+ if self.dbapi.sqlite_version_info < (3, 6, 14):
+ rtbl = re.sub(r'^\"|\"$', '', rtbl)
+
try:
fk = fks[numerical_id]
except KeyError: