Closed edongashi closed 4 years ago
Minimal reproduction:
select count(*)
from my_table
Fails with
ERROR 42703 (undefined_column) column my_table.__ac_nlc__1 does not exist
query: SELECT "__ac_regular_stats"."__ac_count_duid","__ac_regular_stats"."__ac_agg_0_count","__ac_regular_stats"."__ac_agg_0_sum","__ac_regular_stats"."__ac_agg_0_min","__ac_regular_stats"."__ac_agg_0_max","__ac_regular_stats"."__ac_agg_0_stddev","__ac_regular_stats"."__ac_grouping_id","__ac_regular_stats"."__ac_min_uid","__ac_regular_stats"."__ac_max_uid","__ac_regular_stats"."__ac_nlc__0" AS "__ac_nlc__0","__ac_regular_stats"."__ac_nlc__1" AS "__ac_nlc__1" FROM (SELECT "__ac_uid_grouping"."__ac_grouping_id" AS "__ac_grouping_id",COUNT("__ac_uid_grouping"."uid") AS "__ac_count_duid",MIN("__ac_uid_grouping"."uid") AS "__ac_min_uid",MAX("__ac_uid_grouping"."uid") AS "__ac_max_uid",COUNT("__ac_uid_grouping"."__ac_agg_0") AS "__ac_agg_0_count",SUM("__ac_uid_grouping"."__ac_agg_0") AS "__ac_agg_0_sum",MIN("__ac_uid_grouping"."__ac_agg_0") AS "__ac_agg_0_min",MAX("__ac_uid_grouping"."__ac_agg_0") AS "__ac_agg_0_max",STDDEV("__ac_uid_grouping"."__ac_agg_0") AS "__ac_agg_0_stddev",MIN("__ac_uid_grouping"."__ac_nlc__0") AS "__ac_nlc__0",MAX("__ac_uid_grouping"."__ac_nlc__1") AS "__ac_nlc__1" FROM (SELECT "my_table"."uid" AS "uid",COUNT(*) AS "__ac_agg_0",0 AS "__ac_grouping_id",MIN("my_table"."__ac_nlc__0") AS "__ac_nlc__0",MAX("my_table"."__ac_nlc__1") AS "__ac_nlc__1" FROM "__ac_4TMoutZmn1BRr89fXhHXU/vAR" AS "my_table" WHERE "my_table"."uid" IS NOT NULL GROUP BY "my_table"."uid") AS "__ac_uid_grouping" GROUP BY "__ac_uid_grouping"."__ac_grouping_id") AS "__ac_regular_stats"
hint: Perhaps you meant to reference the column "my_table.__ac_nlc__0".
my_table
definition:
SELECT uid, max(age) as oldest FROM demographics
WHERE age BETWEEN 0 AND 10
GROUP BY uid
The cloak stores the analyst table like this:
Column | Type | Collation | Nullable | Default
-------------+---------+-----------+----------+---------
uid | integer | | |
oldest | integer | | |
__ac_nlc__0 | integer | | |
https://aircloak.atlassian.net/browse/SUP-69
When doing this query
it fails with
whereas the analyst table only has