Commit 41eef0ff authored by Tom Lane's avatar Tom Lane

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.
parent 38fb4d97
...@@ -1605,20 +1605,20 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown) ...@@ -1605,20 +1605,20 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
rel = heap_open(rte->relid, NoLock); rel = heap_open(rte->relid, NoLock);
/* /*
* Skip materialized view expansion when it is being created. * Ignore RIR rules for a materialized view, if it is scannable.
* *
* NOTE: This is assuming that we cannot have gotten to this point * NOTE: This is assuming that if an MV is scannable then we always
* with a non-scannable materialized view unless it is being * want to use the existing contents, and if it is not scannable we
* populated, and that if it is scannable we want to use the existing * cannot have gotten to this point unless it is being populated
* contents. It would be nice to have some way to confirm that we're * (otherwise an error should be thrown). It would be nice to have
* doing the right thing here, but rule expansion doesn't give us a * some way to confirm that we're doing the right thing here, but rule
* lot to work with, so we are trusting earlier validations and * expansion doesn't give us a lot to work with, so we are trusting
* execution steps to get it right. * earlier validations to throw error if needed.
*/ */
if (rel->rd_rel->relkind == RELKIND_MATVIEW && rel->rd_isscannable) if (rel->rd_rel->relkind == RELKIND_MATVIEW && rel->rd_isscannable)
{ {
heap_close(rel, NoLock); heap_close(rel, NoLock);
break; continue;
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment