You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix writable rules on tables has relative matview.
Though rules are not well supported in GPDB, we have
to update matview data status if there were.
Some SQL will generate like INSERT into another table
which has relative matview.
Authored-by: Zhang Mingli [email protected]
Copy file name to clipboardExpand all lines: src/test/regress/expected/matview_data.out
+55Lines changed: 55 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -324,6 +324,61 @@ select mvname, datastatus from gp_matview_aux where mvname in ('mv0','mv1', 'mv2
324
324
mv3 | e
325
325
(1 row)
326
326
327
+
--
328
+
-- test issue https://github.com/cloudberrydb/cloudberrydb/issues/582
329
+
-- test rules
330
+
begin;
331
+
create table t1_issue_582(i int, j int);
332
+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry Database data distribution key for this table.
333
+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
334
+
create table t2_issue_582(i int, j int);
335
+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry Database data distribution key for this table.
336
+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
337
+
create table t3_issue_582(i int, j int);
338
+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Cloudberry Database data distribution key for this table.
339
+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
340
+
create materialized view mv_t2_issue_582 as select j from t2_issue_582 where i = 1;
341
+
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'j' as the Cloudberry Database data distribution key for this table.
342
+
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
343
+
create rule r1 as on insert TO t1_issue_582 do also insert into t2_issue_582 values(1,1);
344
+
select count(*) from t1_issue_582;
345
+
count
346
+
-------
347
+
0
348
+
(1 row)
349
+
350
+
select count(*) from t2_issue_582;
351
+
count
352
+
-------
353
+
0
354
+
(1 row)
355
+
356
+
select mvname, datastatus from gp_matview_aux where mvname = 'mv_t2_issue_582';
357
+
mvname | datastatus
358
+
-----------------+------------
359
+
mv_t2_issue_582 | u
360
+
(1 row)
361
+
362
+
insert into t1_issue_582 values(1,1);
363
+
select count(*) from t1_issue_582;
364
+
count
365
+
-------
366
+
1
367
+
(1 row)
368
+
369
+
select count(*) from t2_issue_582;
370
+
count
371
+
-------
372
+
1
373
+
(1 row)
374
+
375
+
select mvname, datastatus from gp_matview_aux where mvname = 'mv_t2_issue_582';
0 commit comments