From f67fcd182277e6347ad0b97e265ccb24a4e5bd49 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 4 Oct 2007 03:19:38 +0000 Subject: - move PG RETURNING tests to postgres dialect test - added server_version_info() support for PG dialect - exclude PG versions < 8.4 for RETURNING tests --- lib/sqlalchemy/databases/postgres.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 990140c89..74b9e6f43 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -382,6 +382,13 @@ class PGDialect(default.DefaultDialect): """ % locals() return [row[0].decode(self.encoding) for row in connection.execute(s)] + def server_version_info(self, connection): + v = connection.execute("select version()").scalar() + m = re.match('PostgreSQL (\d+)\.(\d+)\.(\d+)', v) + if not m: + raise exceptions.AssertionError("Could not determine version from string '%s'" % v) + return tuple([int(x) for x in m.group(1, 2, 3)]) + def reflecttable(self, connection, table, include_columns): preparer = self.identifier_preparer if table.schema is not None: -- cgit v1.2.1