zzzeek / test_sqlalchemy

0 stars 0 forks source link

postgresql timestamps and intervals can have precision too #997

Closed sqlalchemy-bot closed 14 years ago

sqlalchemy-bot commented 16 years ago

Issue created by Anonymous


match and strip "(\d+)" anywhere in type string, not just at the end

Index: lib/sqlalchemy/databases/postgres.py
===================================================================
--- lib/sqlalchemy/databases/postgres.py        (revision 4337)
+++ lib/sqlalchemy/databases/postgres.py        (working copy)
@@ -467,8 +467,8 @@
             if include_columns and name not in include_columns:
                 continue

-            ## strip (30) from character varying(30)
-            attype = re.search('([^\([](^\([)+)', format_type).group(1)
+            ## strip (5) from character varying(5), timestamp(5) with time zone, etc
+            attype = re.sub('\([\d,](\d,)+\)', '', format_type)
             nullable = not notnull
             is_array = format_type.endswith('[
@@ -492,6 +492,9 @@
                 numericprec, numericscale = (32, 0)
                 charlen = False

+            if 'timestamp' in attype or 'interval' in attype:
+                charlen = False
+
             args = [](]')
)
             for a in (charlen, numericprec, numericscale):
                 if a is None:
sqlalchemy-bot commented 10 years ago

Michael Bayer (zzzeek) wrote:


Removing milestone: 0.6.0 (automated comment)

sqlalchemy-bot commented 14 years ago

Michael Bayer (zzzeek) wrote:


db052dfba8db282516c353b1dc3984668ce93538

sqlalchemy-bot commented 14 years ago

Michael Bayer (zzzeek) wrote:


PG dialect in 0.6 has "precision" fully supported for interval. its a small change to have it work for timestamp as well.

sqlalchemy-bot commented 15 years ago

Michael Bayer (zzzeek) wrote:


sqlalchemy-bot commented 10 years ago

Changes by Michael Bayer (zzzeek): removed "0.6.0" milestone

sqlalchemy-bot commented 14 years ago

Changes by Michael Bayer (zzzeek): set state to "resolved"; changed kind from "bug" to "enhancement"; changed milestone from "0.6.1" to "0.6.0"

sqlalchemy-bot commented 14 years ago

Changes by Michael Bayer (zzzeek): changed milestone from "0.5.xx" to "0.6.1"

sqlalchemy-bot commented 15 years ago

Changes by Michael Bayer (zzzeek): set milestone to "0.5.xx"