From 2fa861a0aee6df8e3239dc908fa71425a2b8bdec Mon Sep 17 00:00:00 2001 From: Ian Ward Date: Sun, 6 May 2018 21:25:23 -0400 Subject: [PATCH] [#4236] datastore_search: distinct=true records_format=lists fix --- ckanext/datastore/backend/postgres.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/datastore/backend/postgres.py b/ckanext/datastore/backend/postgres.py index 2d65a006f8..fd4c333751 100644 --- a/ckanext/datastore/backend/postgres.py +++ b/ckanext/datastore/backend/postgres.py @@ -1230,9 +1230,9 @@ def search_data(context, data_dict): ).replace('%', '%%') sql_fmt = u''' SELECT '[' || array_to_string(array_agg(j.v), ',') || ']' FROM ( - SELECT '[' || {select} || ']' v + SELECT {distinct} '[' || {select} || ']' v FROM ( - SELECT {distinct} * FROM "{resource}" {ts_query} + SELECT * FROM "{resource}" {ts_query} {where} {sort} LIMIT {limit} OFFSET {offset}) as z ) AS j''' elif records_format == u'csv':