select from a procedure that modifies rows, now work
with server-side cursor mode (the named cursor isn't
used for such statements.)
+
+ - postgresql dialect can properly detect pg "devel" version
+ strings, i.e. "8.5devel" [ticket:1636]
- mysql
- New dialects: oursql, a new native dialect,
def _get_server_version_info(self, connection):
v = connection.execute("select version()").scalar()
- m = re.match('PostgreSQL (\d+)\.(\d+)\.(\d+)', v)
+ m = re.match('PostgreSQL (\d+)\.(\d+)(?:\.(\d+))?(?:devel)?', v)
if not m:
raise AssertionError("Could not determine version from string '%s'" % v)
- return tuple([int(x) for x in m.group(1, 2, 3)])
+ return tuple([int(x) for x in m.group(1, 2, 3) if x is not None])
@reflection.cache
def get_table_oid(self, connection, table_name, schema=None, **kw):
assert t2.c.date2.type.timezone is False
finally:
m1.drop_all()
-
+
+ def test_version_parsing(self):
+ class MockConn(object):
+ def __init__(self, res):
+ self.res = res
+
+ def execute(self, str):
+ return self
+
+ def scalar(self):
+ return self.res
+
+ for string, version in [
+ ("PostgreSQL 8.3.8 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)", (8, 3, 8)),
+ ("PostgreSQL 8.5devel on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2, 64-bit", (8, 5)),
+ ]:
+
+ eq_(testing.db.dialect._get_server_version_info(MockConn(string)), version)
+
def test_pg_weirdchar_reflection(self):
meta1 = MetaData(testing.db)
subject = Table("subject", meta1,