Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 41eef0f

Browse files
committed
Fix thinko in matview patch.
"break" instead of "continue" suppressed view expansion for views appearing later in the range table. Per report from Erikjan Rijkers. While at it, improve the associated comment a bit.
1 parent 38fb4d9 commit 41eef0f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/backend/rewrite/rewriteHandler.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,20 +1605,20 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
16051605
rel = heap_open(rte->relid, NoLock);
16061606

16071607
/*
1608-
* Skip materialized view expansion when it is being created.
1608+
* Ignore RIR rules for a materialized view, if it is scannable.
16091609
*
1610-
* NOTE: This is assuming that we cannot have gotten to this point
1611-
* with a non-scannable materialized view unless it is being
1612-
* populated, and that if it is scannable we want to use the existing
1613-
* contents. It would be nice to have some way to confirm that we're
1614-
* doing the right thing here, but rule expansion doesn't give us a
1615-
* lot to work with, so we are trusting earlier validations and
1616-
* execution steps to get it right.
1610+
* NOTE: This is assuming that if an MV is scannable then we always
1611+
* want to use the existing contents, and if it is not scannable we
1612+
* cannot have gotten to this point unless it is being populated
1613+
* (otherwise an error should be thrown). It would be nice to have
1614+
* some way to confirm that we're doing the right thing here, but rule
1615+
* expansion doesn't give us a lot to work with, so we are trusting
1616+
* earlier validations to throw error if needed.
16171617
*/
16181618
if (rel->rd_rel->relkind == RELKIND_MATVIEW && rel->rd_isscannable)
16191619
{
16201620
heap_close(rel, NoLock);
1621-
break;
1621+
continue;
16221622
}
16231623

16241624
/*

0 commit comments

Comments
 (0)