@@ -20,7 +20,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
20
20
HINT: Create an index on the immv for efficient incremental maintenance.
21
21
create_immv
22
22
-------------
23
-
23
+ 4
24
24
(1 row)
25
25
26
26
SELECT * FROM mv_ivm_1 ORDER BY 1,2,3;
@@ -86,7 +86,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
86
86
HINT: Create an index on the immv for efficient incremental maintenance.
87
87
create_immv
88
88
-------------
89
-
89
+ 1
90
90
(1 row)
91
91
92
92
SELECT create_immv('mv_ivm_no_tbl', 'SELECT 1');
@@ -95,7 +95,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
95
95
HINT: Create an index on the immv for efficient incremental maintenance.
96
96
create_immv
97
97
-------------
98
-
98
+ 1
99
99
(1 row)
100
100
101
101
ROLLBACK;
@@ -107,14 +107,14 @@ DETAIL: This target list does not have all the primary key columns, or this vie
107
107
HINT: Create an index on the immv for efficient incremental maintenance.
108
108
create_immv
109
109
-------------
110
-
110
+ 5
111
111
(1 row)
112
112
113
113
SELECT create_immv('mv_ivm_distinct', 'SELECT DISTINCT j FROM mv_base_a');
114
114
NOTICE: created index "mv_ivm_distinct_index" on immv "mv_ivm_distinct"
115
115
create_immv
116
116
-------------
117
-
117
+ 5
118
118
(1 row)
119
119
120
120
INSERT INTO mv_base_a VALUES(6,20);
@@ -175,7 +175,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
175
175
HINT: Create an index on the immv for efficient incremental maintenance.
176
176
create_immv
177
177
-------------
178
-
178
+ 3
179
179
(1 row)
180
180
181
181
SELECT * FROM mv_self ORDER BY v1;
@@ -230,7 +230,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
230
230
HINT: Create an index on the immv for efficient incremental maintenance.
231
231
create_immv
232
232
-------------
233
-
233
+ 3
234
234
(1 row)
235
235
236
236
SELECT * FROM mv ORDER BY v1;
@@ -273,7 +273,7 @@ SELECT create_immv('mv_ri(i1, i2)', 'SELECT ri1.i, ri2.i FROM ri1 JOIN ri2 USING
273
273
NOTICE: created index "mv_ri_index" on immv "mv_ri"
274
274
create_immv
275
275
-------------
276
-
276
+ 3
277
277
(1 row)
278
278
279
279
SELECT * FROM mv_ri ORDER BY i1;
@@ -304,7 +304,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
304
304
HINT: Create an index on the immv for efficient incremental maintenance.
305
305
create_immv
306
306
-------------
307
-
307
+ 2
308
308
(1 row)
309
309
310
310
SELECT * FROM mv ORDER BY i;
@@ -331,7 +331,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
331
331
HINT: Create an index on the immv for efficient incremental maintenance.
332
332
create_immv
333
333
-------------
334
-
334
+ 0
335
335
(1 row)
336
336
337
337
SELECT * FROM mv ORDER BY i;
@@ -392,7 +392,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
392
392
HINT: Create an index on the immv for efficient incremental maintenance.
393
393
create_immv
394
394
-------------
395
-
395
+ 0
396
396
(1 row)
397
397
398
398
INSERT INTO t_mytype VALUES ('1'::mytype);
@@ -510,7 +510,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
510
510
HINT: Create an index on the immv for efficient incremental maintenance.
511
511
create_immv
512
512
-------------
513
-
513
+ 1
514
514
(1 row)
515
515
516
516
SELECT id, data, owner FROM ivm_rls ORDER BY 1,2,3;
@@ -535,7 +535,7 @@ DETAIL: This target list does not have all the primary key columns, or this vie
535
535
HINT: Create an index on the immv for efficient incremental maintenance.
536
536
create_immv
537
537
-------------
538
-
538
+ 2
539
539
(1 row)
540
540
541
541
RESET SESSION AUTHORIZATION;
@@ -560,6 +560,15 @@ drop cascades to table ivm_rls2
560
560
DROP TABLE num_tbl CASCADE;
561
561
DROP USER ivm_user;
562
562
DROP USER ivm_admin;
563
+ -- prevent IMMV chanages
564
+ INSERT INTO mv_ivm_1 VALUES(1,1,1);
565
+ ERROR: cannot change materialized view "mv_ivm_1"
566
+ UPDATE mv_ivm_1 SET k = 1 WHERE i = 1;
567
+ ERROR: cannot change materialized view "mv_ivm_1"
568
+ DELETE FROM mv_ivm_1;
569
+ ERROR: cannot change materialized view "mv_ivm_1"
570
+ TRUNCATE mv_ivm_1;
571
+ ERROR: cannot change materialized view "mv_ivm_1"
563
572
DROP TABLE mv_base_b CASCADE;
564
573
NOTICE: drop cascades to 3 other objects
565
574
DETAIL: drop cascades to table mv_ivm_1
0 commit comments