File tree 3 files changed +14
-1
lines changed
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -865,7 +865,8 @@ InitPlan(QueryDesc *queryDesc, int eflags)
865
865
* it is a parameterless subplan (not initplan), we suggest that it be
866
866
* prepared to handle REWIND efficiently; otherwise there is no need.
867
867
*/
868
- sp_eflags = eflags & EXEC_FLAG_EXPLAIN_ONLY ;
868
+ sp_eflags = eflags
869
+ & (EXEC_FLAG_EXPLAIN_ONLY | EXEC_FLAG_WITH_NO_DATA );
869
870
if (bms_is_member (i , plannedstmt -> rewindPlanIDs ))
870
871
sp_eflags |= EXEC_FLAG_REWIND ;
871
872
Original file line number Diff line number Diff line change @@ -424,6 +424,12 @@ REFRESH MATERIALIZED VIEW mv;
424
424
REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
425
425
DROP TABLE foo CASCADE;
426
426
NOTICE: drop cascades to materialized view mv
427
+ -- allow subquery to reference unpopulated matview if WITH NO DATA is specified
428
+ CREATE MATERIALIZED VIEW mv1 AS SELECT 1 AS col1 WITH NO DATA;
429
+ CREATE MATERIALIZED VIEW mv2 AS SELECT * FROM mv1
430
+ WHERE col1 = (SELECT LEAST(col1) FROM mv1) WITH NO DATA;
431
+ DROP MATERIALIZED VIEW mv1 CASCADE;
432
+ NOTICE: drop cascades to materialized view mv2
427
433
-- make sure that types with unusual equality tests work
428
434
CREATE TABLE boxes (id serial primary key, b box);
429
435
INSERT INTO boxes (b) VALUES
Original file line number Diff line number Diff line change @@ -155,6 +155,12 @@ REFRESH MATERIALIZED VIEW mv;
155
155
REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
156
156
DROP TABLE foo CASCADE;
157
157
158
+ -- allow subquery to reference unpopulated matview if WITH NO DATA is specified
159
+ CREATE MATERIALIZED VIEW mv1 AS SELECT 1 AS col1 WITH NO DATA;
160
+ CREATE MATERIALIZED VIEW mv2 AS SELECT * FROM mv1
161
+ WHERE col1 = (SELECT LEAST(col1) FROM mv1) WITH NO DATA;
162
+ DROP MATERIALIZED VIEW mv1 CASCADE;
163
+
158
164
-- make sure that types with unusual equality tests work
159
165
CREATE TABLE boxes (id serial primary key , b box );
160
166
INSERT INTO boxes (b) VALUES
You can’t perform that action at this time.
0 commit comments