summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McCully <smccully@scorpion.local.nunet.net>2017-03-29 16:14:02 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-03-29 16:17:30 -0400
commita86764d99b3a440cdc27b437ef2de9d393ca8036 (patch)
tree51de8197ce849ddb5585b126c756739218a7e7a9
parent6220e09f6149bb4bc12e12c2557e1ca750fb65e5 (diff)
downloadsqlalchemy-a86764d99b3a440cdc27b437ef2de9d393ca8036.tar.gz
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
-rw-r--r--doc/build/changelog/changelog_11.rst8
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py2
-rw-r--r--test/dialect/postgresql/test_dialect.py5
3 files changed, 13 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst
index 9cefeac07..3c1d609f0 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 3b445eb58..92009450e 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 a9ef09dbd..f03b48790 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)