diff --git a/ckanext/datastore/backend/postgres.py b/ckanext/datastore/backend/postgres.py index ea1473a076b..0e56ce8e81d 100644 --- a/ckanext/datastore/backend/postgres.py +++ b/ckanext/datastore/backend/postgres.py @@ -1719,7 +1719,6 @@ def datastore_search(self, context, data_dict, fields_types, query_dict): select_cols = [] records_format = data_dict.get(u'records_format') - json_values = records_format in (u'objects', u'lists') for field_id in field_ids: fmt = u'to_json({0})' if records_format == u'lists' else u'{0}' typ = fields_types.get(field_id) @@ -1727,7 +1726,7 @@ def datastore_search(self, context, data_dict, fields_types, query_dict): fmt = u'({0}).json' elif typ == u'timestamp': fmt = u"to_char({0}, 'YYYY-MM-DD\"T\"HH24:MI:SS')" - if json_values: + if records_format == u'lists': fmt = u"to_json({0})".format(fmt) elif typ.startswith(u'_') or typ.endswith(u'[]'): fmt = u'array_to_json({0})'