From f9aaf910ae3c35579b17abab6d2bf44d9b859839 Mon Sep 17 00:00:00 2001 From: amercader Date: Mon, 1 Jul 2019 13:24:03 +0200 Subject: [PATCH] [#4841] Change statement to support psycopg2 2.8.x 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. --- ckanext/datastore/backend/postgres.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ckanext/datastore/backend/postgres.py b/ckanext/datastore/backend/postgres.py index fd4c333751a..ee27e0ab89f 100644 --- a/ckanext/datastore/backend/postgres.py +++ b/ckanext/datastore/backend/postgres.py @@ -284,7 +284,10 @@ def _cache_types(context): # redo cache types with json now available. return _cache_types(context) - register_composite('nested', connection.connection, True) + try: + register_composite('nested', connection.connection.connection, True) + except AttributeError: + register_composite('nested', connection.connection, True) def _pg_version_is_at_least(connection, version):