Add prefix to bins_array to avoid name collision

This commit is contained in:
Daniel García Aubert
2017-08-08 08:41:22 +02:00
parent 994e58bef7
commit 823925d091
+5 -5
View File
@@ -211,8 +211,8 @@ var dateOverrideBasicsQueryTpl = dot.template([
var dateBinsQueryTpl = dot.template([
'bins AS (',
' SELECT',
' bins_array,',
' ARRAY_LENGTH(bins_array, 1) AS __cdb_bins_number',
' __cdb_bins_array,',
' ARRAY_LENGTH(__cdb_bins_array, 1) AS __cdb_bins_number',
' FROM (',
' SELECT',
' ARRAY(',
@@ -221,9 +221,9 @@ var dateBinsQueryTpl = dot.template([
' __cdb_end_date::timestamptz,',
' {{?it._aggregation==="quarter"}}\'3 month\'{{??}}\'1 {{=it._aggregation}}\'{{?}}::interval',
' )',
' ) AS bins_array',
' ) AS __cdb_bins_array',
' FROM basics',
' ) _cdb_bins_array',
' ) _cdb_bins_array_query',
')'
].join('\n'));
@@ -237,7 +237,7 @@ var dateHistogramQueryTpl = dot.template([
' ELSE GREATEST(1, LEAST(',
' WIDTH_BUCKET(',
' {{=it._column}}::timestamp AT TIME ZONE \'{{=it._offset}}\',',
' bins_array',
' __cdb_bins_array',
' ),',
' __cdb_bins_number',
' )) - 1',