From: Sean McCully Date: Wed, 29 Mar 2017 20:14:02 +0000 (-0400) Subject: Support Postgresql development version numbers X-Git-Tag: rel_1_2_0b1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a86764d99b3a440cdc27b437ef2de9d393ca8036;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Support Postgresql development version numbers Added support for parsing the Postgresql version string for a development version like "PostgreSQL 10devel". Pull request courtesy Sean McCully. Change-Id: I7bc18bc4d290349c23e9796367b7d694d0873096 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/351 --- diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst index 9cefeac07d..3c1d609f0b 100644 --- a/doc/build/changelog/changelog_11.rst +++ b/doc/build/changelog/changelog_11.rst @@ -21,6 +21,14 @@ .. changelog:: :version: 1.1.8 + .. change:: + :tags: bug, postgresql + :versions: 1.2.0b1 + + Added support for parsing the Postgresql version string for + a development version like "PostgreSQL 10devel". Pull request + courtesy Sean McCully. + .. changelog:: :version: 1.1.7 :released: March 27, 2017 diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 3b445eb581..92009450e7 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2281,7 +2281,7 @@ class PGDialect(default.DefaultDialect): v = connection.execute("select version()").scalar() m = re.match( r'.*(?:PostgreSQL|EnterpriseDB) ' - r'(\d+)\.(\d+)(?:\.(\d+))?(?:\.\d+)?(?:devel)?', + r'(\d+)\.?(\d+)?(?:\.(\d+))?(?:\.\d+)?(?:devel)?', v) if not m: raise AssertionError( diff --git a/test/dialect/postgresql/test_dialect.py b/test/dialect/postgresql/test_dialect.py index a9ef09dbd2..f03b48790d 100644 --- a/test/dialect/postgresql/test_dialect.py +++ b/test/dialect/postgresql/test_dialect.py @@ -60,7 +60,10 @@ class MiscTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): '64-bit', (9, 1, 2)), ( '[PostgreSQL 9.2.4 ] VMware vFabric Postgres 9.2.4.0 ' - 'release build 1080137', (9, 2, 4))]: + 'release build 1080137', (9, 2, 4)), + ( + 'PostgreSQL 10devel on x86_64-pc-linux-gnu' + 'compiled by gcc (GCC) 6.3.1 20170306, 64-bit', (10,))]: eq_(testing.db.dialect._get_server_version_info(mock_conn(string)), version)