]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added regexp search for "schema" in sequence reflection for [ticket:442], courtesy...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 Jan 2007 23:40:34 +0000 (23:40 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 Jan 2007 23:40:34 +0000 (23:40 +0000)
CHANGES
lib/sqlalchemy/databases/postgres.py

diff --git a/CHANGES b/CHANGES
index 827cc05898601009b4e392c052a1695d5f48c9e5..cc0c1b9067798a2fd10a13fce73bc9426c623ad2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,8 @@
 - mysql:
   - fix to reflection on older DB's that might return array() type for 
   "show variables like" statements
+- postgres:
+  - better reflection of sequences for alternate-schema Tables [ticket:442]
 
 0.3.4
 - general:
index 7eee35320f51fab2028fdbaa5f102db7ab6ee4a7..3fea2e1a586a01d0f3f6ef0136cf374a0ad0262d 100644 (file)
@@ -396,6 +396,12 @@ class PGDialect(ansisql.ANSIDialect):
                 coltype = coltype(*args, **kwargs)
                 colargs= []
                 if default is not None:
+                    match = re.search(r"""(nextval\(')([^']+)('.*$)""", default)
+                    if match is not None:
+                        # the default is related to a Sequence
+                        sch = table.schema
+                        if '.' not in match.group(2) and sch is not None:
+                            default = match.group(1) + sch + '.' + match.group(2) + match.group(3)
                     colargs.append(PassiveDefault(sql.text(default)))
                 table.append_column(schema.Column(name, coltype, nullable=nullable, *colargs))