Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL 10 compatibility #489

Closed
alexeyklyukin opened this issue Nov 21, 2016 · 2 comments
Closed

PostgreSQL 10 compatibility #489

alexeyklyukin opened this issue Nov 21, 2016 · 2 comments
Milestone

Comments

@alexeyklyukin
Copy link

When running on PostgreSQL 10devel, psycopg2 complains about inability to determine PostgreSQL version.

I think the problem lies in the following regexp

verre = re.compile(
    r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")

I did a quick and dirty patch with

diff --git a/setup.py b/setup.py
index 3f02183..eaa6a33 100644
--- a/setup.py
+++ b/setup.py
@@ -405,14 +405,19 @@ class psycopg_build_ext(build_ext):
                 pgversion = pg_config_helper.query("version").split()[1]
             except:
                 pgversion = "7.4.0"
-
-            verre = re.compile(
-                r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")
+            if not pgversion[:2].isdigit():
+                verre = re.compile(
+                    r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")
+            else:
+                verre = re.compile(
+                   r"(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")
             m = verre.match(pgversion)
             if m:
                 pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
                 if pgpatch is None or not pgpatch.isdigit():
                     pgpatch = 0
+                if pgminor is None or not pgminor.isdigit():
+                    pgminor = 0
                 pgmajor = int(pgmajor)
                 pgminor = int(pgminor)
                 pgpatch = int(pgpatch)

but I think the original regexp is wrong, since for the "devel" version it gives me an extra None group, i.e. for the "9.2devel" I'm getting ('9', '2', None, 'devel', None) instead of ('9', '2', 'devel',...).

@fogzot
Copy link
Member

fogzot commented Nov 21, 2016

The regex is fine, just returns None for version parts that are not present in the version string.
The correct fix is to make the second group optional:

(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))

and add the final part of your patch:

+                if pgminor is None or not pgminor.isdigit():
+                    pgminor = 0

@dvarrazzo dvarrazzo added this to the psycopg 2.7 milestone Feb 3, 2017
@fogzot
Copy link
Member

fogzot commented Feb 4, 2017

Will be fixed by pulling #504.

dvarrazzo added a commit to dvarrazzo/psycopg2 that referenced this issue Dec 1, 2017
Backport to psycopg 2.6 of ticket psycopg#489, ticket psycopg#632
dvarrazzo added a commit that referenced this issue Dec 1, 2017
Backport to psycopg 2.6 of ticket #489, ticket #632
dvarrazzo added a commit that referenced this issue Dec 1, 2017
- 2.6.3 has not been released (yet). Fixes for bug #420, bug #462 were
  relased in 2.7.
- Added missing report for bug #489 fixed in 2.7.
dvarrazzo added a commit that referenced this issue Dec 1, 2017
- 2.6.3 has not been released (yet). Fixes for bug #420, bug #462 were
  relased in 2.7.
- Added missing report for bug #489 fixed in 2.7.
vitorbaptista added a commit to frictionlessdata/goodtables.io that referenced this issue Jan 4, 2018
This fixes a bug where psycopg2 is unable to determine postgresql versions
>10.x (see psycopg/psycopg2#489).
vitorbaptista added a commit to frictionlessdata/goodtables.io that referenced this issue Jan 4, 2018
This fixes a bug where psycopg2 is unable to determine postgresql versions
>10.x (see psycopg/psycopg2#489).
vitorbaptista added a commit to frictionlessdata/goodtables.io that referenced this issue Jan 4, 2018
This fixes a bug where psycopg2 is unable to determine postgresql versions
>10.x (see psycopg/psycopg2#489).
vitorbaptista added a commit to frictionlessdata/goodtables.io that referenced this issue Jan 4, 2018
This fixes a bug where psycopg2 is unable to determine postgresql versions
>10.x (see psycopg/psycopg2#489).
jnga added a commit to newfs/gobotany-app that referenced this issue Jan 24, 2018
…g to Dev. (see #673)

The bug was an error message, apparently triggered by
the bump of the Python runtime clearing things out and
reinstalling. Bug:
psycopg/psycopg2#489
rickmak added a commit to rickmak/py-skygear that referenced this issue Feb 7, 2018
This commit objective mainly mute the version parsing error, not
intended to provide official support on postgres10
refs psycopg/psycopg2#489
carmenlau pushed a commit to SkygearIO/py-skygear that referenced this issue Feb 8, 2018
This commit objective mainly mute the version parsing error, not
intended to provide official support on postgres10
refs psycopg/psycopg2#489
sachinelli added a commit to sachinelli/prosaic that referenced this issue Oct 18, 2018
psycopg2 keeps failing because it sees the latest version of postgresql as 10.5 and cannot interpret that as a version number correctly. 

Changed the version of psycopg2 to 2.7.5 as per psycopg/psycopg2#489 because the maintainers have no desire to backport the fix. Here's hoping it doesn't fail now for some other reason on postgresql 10.5
openstack-gerrit pushed a commit to openstack/neutron-fwaas that referenced this issue Mar 19, 2019
This patch updates lower constraints of neutron-fwaas to be
same as for neutron project.
It also bumps neutron version to lates 14.0.0 beta3 and
psycopg2 package to 2.7.3 to fix issue [1].

[1] psycopg/psycopg2#489

Change-Id: I4c78da3a593a9f02a328c6ba02688de04ff98d5a
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Mar 19, 2019
* Update neutron-fwaas from branch 'master'
  - Update lower-constraints to be same as in Neutron
    
    This patch updates lower constraints of neutron-fwaas to be
    same as for neutron project.
    It also bumps neutron version to lates 14.0.0 beta3 and
    psycopg2 package to 2.7.3 to fix issue [1].
    
    [1] psycopg/psycopg2#489
    
    Change-Id: I4c78da3a593a9f02a328c6ba02688de04ff98d5a
philipmat added a commit to philipmat/discogs-xml2db that referenced this issue Apr 2, 2019
Addresses an issue with PG discovery: psycopg/psycopg2#489
philipmat added a commit to philipmat/discogs-xml2db that referenced this issue Apr 2, 2019
Switching psycopg2 to 2.7 to fix an issue with psycopg: psycopg/psycopg2#489
openstack-gerrit pushed a commit to openstack/monasca-notification that referenced this issue Apr 8, 2019
There is a bug in 2.6 line of psycopg2 that does not properly detect
Postgresql 10 versions.

psycopg/psycopg2#489

Change-Id: If5f773fb9e1ee2cb4e3fff71cd65539caa065e10
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Apr 8, 2019
* Update monasca-notification from branch 'master'
  - Bump psycopg2 lowest version
    
    There is a bug in 2.6 line of psycopg2 that does not properly detect
    Postgresql 10 versions.
    
    psycopg/psycopg2#489
    
    Change-Id: If5f773fb9e1ee2cb4e3fff71cd65539caa065e10
openstack-gerrit pushed a commit to openstack/monasca-notification that referenced this issue Apr 8, 2019
There is a bug in 2.6 line of psycopg2 that does not properly detect
Postgresql 10 versions.

psycopg/psycopg2#489

Change-Id: If5f773fb9e1ee2cb4e3fff71cd65539caa065e10
(cherry picked from commit 85d7d65)
openstack-gerrit pushed a commit to openstack/networking-sfc that referenced this issue Apr 18, 2019
1 - Bump version from 2.6.2 to 2.7.7.
This should fix issue blocking all new patches in
openstack-tox-lower-constraints:
> Error: could not determine PostgreSQL version from '10.7'

More info at psycopg/psycopg2#489

2 - All constants should be consumed from neutron_lib

Change-Id: I3801641d44040c83631339318c4bd92e8e9ff520
Signed-off-by: Manuel Buil <mbuil@suse.com>
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Apr 18, 2019
* Update networking-sfc from branch 'master'
  - Combine two patches to fix gates
    
    1 - Bump version from 2.6.2 to 2.7.7.
    This should fix issue blocking all new patches in
    openstack-tox-lower-constraints:
    > Error: could not determine PostgreSQL version from '10.7'
    
    More info at psycopg/psycopg2#489
    
    2 - All constants should be consumed from neutron_lib
    
    Change-Id: I3801641d44040c83631339318c4bd92e8e9ff520
    Signed-off-by: Manuel Buil <mbuil@suse.com>
mjumbewu added a commit to mjumbewu/councilmatic-starter-template that referenced this issue Jun 28, 2019
Prior to psycopg2 2.7, the package was not able to detect PostgreSQL
versions 10+ (regex issues: psycopg/psycopg2#489)
kshtsk added a commit to kshtsk/paddles that referenced this issue Oct 6, 2019
psycopg2 v2.6.1 does not support postresql 10
see psycopg/psycopg2#489

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@gmail.com>
kshtsk added a commit to kshtsk/paddles that referenced this issue Oct 6, 2019
psycopg2 v2.6.1 does not support postresql 10
see psycopg/psycopg2#489

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants