From 1b0f77aa964154f50c0e024ed1e41b1f9f96e4a6 Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Fri, 15 Apr 2016 17:49:00 +0200 Subject: [PATCH] Always retain single-valued aggregated texts This makes columns which have the same value in a group to be aggregated maintain that value (rather than replacing it by the multiple-value indicator *) whatever the group value is. (Previously this happend only for small groups) --- scripts-available/CDB_Overviews.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index 9f95bdc..a9b0c7f 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -582,7 +582,7 @@ BEGIN IF unlimited_text THEN -- TODO: this should not be applied to columns containing largish text; -- it is intended only to short names/identifiers - RETURN 'CASE WHEN count(*) = 1 THEN MIN(' || qualified_column || ') WHEN ' || total_feature_count || ' < 5 THEN string_agg(distinct ' || qualified_column || ','' / '') ELSE ''*'' END::' || column_type; + RETURN 'CASE WHEN count(distinct ' || qualified_column || ') = 1 THEN MIN(' || qualified_column || ') WHEN ' || total_feature_count || ' < 5 THEN string_agg(distinct ' || qualified_column || ','' / '') ELSE ''*'' END::' || column_type; ELSE RETURN 'CASE count(*) WHEN 1 THEN MIN(' || qualified_column || ') ELSE NULL END::' || column_type; END IF;