diff options
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 7 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index a9fa90c68..9f8e98607 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -631,6 +631,13 @@ class PGCompiler(compiler.DefaultCompiler): } ) + functions = compiler.DefaultCompiler.functions.copy() + functions.update ( + { + 'TIMESTAMP':lambda x:'TIMESTAMP %s' % x, + } + ) + def visit_sequence(self, seq): if seq.optional: return None diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index c5ff974e5..8a2a5f2dd 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -349,7 +349,7 @@ class DefaultCompiler(engine.Compiled): name = self.function_string(func) if callable(name): - return name(*[self.process(x) for x in func.clause_expr]) + return name(*[self.process(x) for x in func.clauses]) else: return ".".join(func.packagenames + [name]) % {'expr':self.function_argspec(func)} @@ -357,7 +357,7 @@ class DefaultCompiler(engine.Compiled): return self.process(func.clause_expr) def function_string(self, func): - return self.functions.get(func.__class__, func.name + "%(expr)s") + return self.functions.get(func.__class__, self.functions.get(func.name, func.name + "%(expr)s")) def visit_compound_select(self, cs, asfrom=False, parens=True, **kwargs): stack_entry = {'select':cs} |
