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

Upgrade psycopg2, fixes ckan/ckan#4837 #4841

Merged
merged 2 commits into from
Jul 1, 2019

Conversation

bzar
Copy link
Contributor

@bzar bzar commented Jun 14, 2019

Fixes #4837

Proposed fixes:

Upgrade psycopg2 to version 2.8.2

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

@wardi wardi self-assigned this Jun 18, 2019
@bzar
Copy link
Contributor Author

bzar commented Jun 27, 2019

The test errors seem to result from the same source as in django: lcd1232/django-postgrespool2#11. The issue is described in a PR to the same repository lcd1232/django-postgrespool2#12. Trying to find out where to insert the same fix: https://github.com/lcd1232/django-postgrespool2/pull/12/files#diff-81ec40a918dd202e487e160513255b32R56

@amercader
Copy link
Member

We won't backport the requirement as it's too risky, but we will mention it on the CHANGELOG.
We will backport the small code change related to the connection property, which should be able to handle both versions of psycopg2 (via some AttributeError catching or similar)

Does this make sense @bzar ?

@bzar
Copy link
Contributor Author

bzar commented Jun 28, 2019

Yes, that makes sense. There's no telling what other non obvious side effects the upgrade has and it shouldn't for now be done unless it's necessary. The compatibility fix should work either way.

@amercader amercader merged commit b629833 into ckan:master Jul 1, 2019
amercader added a commit that referenced this pull request Jul 1, 2019
Some users might find libssl issues (see #4837) for which an upgrade in
psycopg2 is required. While we are not porting the requirement upgrade
to 2.8, we make this change which is backwards compatible with psycopg2
2.7.3.2 (CKAN 2.8 pinned version) in case someone needs to upgrade the
requirement in their environment.

Just in case we fall back to the old syntax if there is an
AttributeError.
@amercader
Copy link
Member

Added just the code change in 2.8 as agreed (f9aaf91). Apparently the new syntax (3 connection) is compatible with the psycopg2 version used in CKAN 2.8 (2.7.3.2), probably because the second connection is just a pool, but to be safe I added an AttributeError check.

@cesarjorgemartinez
Copy link

cesarjorgemartinez commented Nov 6, 2019

Hi, when to release a new 2.8.x version to use psycopg2 2.8.4?

Also, requests version upgrade, and in datapusher.

Regards

@wardi
Copy link
Contributor

wardi commented Feb 24, 2020

Note that for backporting as far back as 2.6 psycopg2==2.7.7 works for postgres 10 and the updated ssl libraries (e.g. on travis) but also prevents this error that happens with psycopg2==2.8.2

  File "/usr/lib/ckan/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 435, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DBAPIError: (UndefinedTable) relation "user" does not exist
LINE 2: FROM "user"
...

adborden added a commit to GSA/ckan that referenced this pull request Mar 27, 2020
amercader added a commit that referenced this pull request May 14, 2021
Some users might find libssl issues (see #4837) for which an upgrade in
psycopg2 is required. While we are not porting the requirement upgrade
to 2.8, we make this change which is backwards compatible with psycopg2
2.7.3.2 (CKAN 2.8 pinned version) in case someone needs to upgrade the
requirement in their environment.

Just in case we fall back to the old syntax if there is an
AttributeError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

psycopg2 version depends on old libssl
4 participants