diff options
| author | Ionuț Ciocîrlan <jdxlark@gmail.com> | 2016-11-23 09:43:47 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-11-23 09:48:34 -0500 |
| commit | 868e98bf407175b016e9e5cbc95bcf0cc859362a (patch) | |
| tree | b233d94a46691704051834716f342b26b67fd9d1 /lib/sqlalchemy | |
| parent | df9b6492e5ca47e26d539d2283fa816a2d5c8ad6 (diff) | |
| download | sqlalchemy-868e98bf407175b016e9e5cbc95bcf0cc859362a.tar.gz | |
Allow the value 0 for Postgresql TIME/TIMESTAMP precision
Change-Id: Ie38c48369222d95849645f027e2c659f503cfd53
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/322
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 4c82325f5..c5021249e 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1730,15 +1730,15 @@ class PGTypeCompiler(compiler.GenericTypeCompiler): def visit_TIMESTAMP(self, type_, **kw): return "TIMESTAMP%s %s" % ( - getattr(type_, 'precision', None) and "(%d)" % - type_.precision or "", + "(%d)" % type_.precision + if getattr(type_, 'precision', None) is not None else "", (type_.timezone and "WITH" or "WITHOUT") + " TIME ZONE" ) def visit_TIME(self, type_, **kw): return "TIME%s %s" % ( - getattr(type_, 'precision', None) and "(%d)" % - type_.precision or "", + "(%d)" % type_.precision + if getattr(type_, 'precision', None) is not None else "", (type_.timezone and "WITH" or "WITHOUT") + " TIME ZONE" ) |
