File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
Expand file tree Collapse file tree 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)
865865 * it is a parameterless subplan (not initplan), we suggest that it be
866866 * prepared to handle REWIND efficiently; otherwise there is no need.
867867 */
868- sp_eflags = eflags & EXEC_FLAG_EXPLAIN_ONLY ;
868+ sp_eflags = eflags
869+ & (EXEC_FLAG_EXPLAIN_ONLY | EXEC_FLAG_WITH_NO_DATA );
869870 if (bms_is_member (i , plannedstmt -> rewindPlanIDs ))
870871 sp_eflags |= EXEC_FLAG_REWIND ;
871872
Original file line number Diff line number Diff line change @@ -424,6 +424,12 @@ REFRESH MATERIALIZED VIEW mv;
424424REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
425425DROP TABLE foo CASCADE;
426426NOTICE: 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
427433-- make sure that types with unusual equality tests work
428434CREATE TABLE boxes (id serial primary key, b box);
429435INSERT INTO boxes (b) VALUES
Original file line number Diff line number Diff line change @@ -155,6 +155,12 @@ REFRESH MATERIALIZED VIEW mv;
155155REFRESH MATERIALIZED VIEW CONCURRENTLY mv;
156156DROP TABLE foo CASCADE;
157157
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+
158164-- make sure that types with unusual equality tests work
159165CREATE TABLE boxes (id serial primary key , b box );
160166INSERT INTO boxes (b) VALUES
You can’t perform that action at this time.
0 commit comments