Cloudberry Database version
@ a70f7ee
What happened
When compute AGG on views, an error of invalid attnum occured.
What you think should happen instead
No response
How to reproduce
begin;
create table aqumv_t2(c1 int, c2 int, c3 int) distributed by (c1);
insert into aqumv_t2 select i, i+1, i+2 from generate_series(1, 100) i;
insert into aqumv_t2 values (91, NULL, 95);
analyze aqumv_t2;
create incremental materialized view aqumv_mvt2_1 as
select c3 as mc3, c1 as mc1
from aqumv_t2 where c1 > 90;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'mc1' as the Cloudberry Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
analyze aqumv_mvt2_1;
set local enable_answer_query_using_materialized_views = off;
explain(costs off, verbose)
select count(c3) from aqumv_t2 where c1 > 90;
QUERY PLAN
-----------------------------------------------------------------------------------
Finalize Aggregate
Output: count(c3)
-> Gather Motion 3:1 (slice1; segments: 3)
Output: (PARTIAL count(c3))
-> Partial Aggregate
Output: PARTIAL count(c3)
-> Seq Scan on public.aqumv_t2
Output: c1, c2, c3
Filter: (aqumv_t2.c1 > 90)
Settings: enable_answer_query_using_materialized_views = 'off', optimizer = 'off'
Optimizer: Postgres query optimizer
(11 rows)
select count(c3) from aqumv_t2 where c1 > 90;
count
-------
11
(1 row)
set local enable_answer_query_using_materialized_views = on;
explain(costs off, verbose)
select count(c3) from aqumv_t2 where c1 > 90;
ERROR: invalid attnum 3 for relation "aqumv_t2" (ruleutils.c:7260)
select count(c3) from aqumv_t2 where c1 > 90;
ERROR: current transaction is aborted, commands ignored until end of transaction block
abort;
Operating System
Ubuntu 22.04.2 LTS
Anything else
No response
Are you willing to submit PR?
Code of Conduct
Cloudberry Database version
@ a70f7ee
What happened
When compute AGG on views, an error of invalid attnum occured.
What you think should happen instead
No response
How to reproduce
Operating System
Ubuntu 22.04.2 LTS
Anything else
No response
Are you willing to submit PR?
Code of Conduct