Commits

Éric Lemoine committed 98d457c Draft

support for reflecting PostGIS columns

Comments (0)

Files changed (1)

lib/sqlalchemy/dialects/postgresql/base.py

         for name, format_type, default, notnull, attnum, table_oid in rows:
             ## strip (5) from character varying(5), timestamp(5)
             # with time zone, etc
-            attype = re.sub(r'\([\d,]+\)', '', format_type)
+            attype = re.sub(r'\(.*\)', '', format_type)
 
             # strip '[]' from integer[], etc.
             attype = re.sub(r'\[\]', '', attype)
             charlen = re.search('\(([\d,]+)\)', format_type)
             if charlen:
                 charlen = charlen.group(1)
+            args = re.search('\((.*)\)', format_type)
+            if args:
+                args = tuple(args.group(1).split(','))
+            else:
+                args = ()
             kwargs = {}
-            args = None
 
             if attype == 'numeric':
                 if charlen:
                 args = ()
             elif charlen:
                 args = (int(charlen),)
-            else:
-                args = ()
 
             while True:
                 if attype in self.ischema_names: