aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-03-11 12:00:24 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-03-11 12:00:24 -0400
commit41eef0ff75c3ea905513ae46f795c0409635fac8 (patch)
tree84a7b63f2590d668c5bf8f23afc2a99007d58fb9
parent38fb4d978c5bfc377ef979e2595e3472744a3b05 (diff)
downloadpostgresql-41eef0ff75c3ea905513ae46f795c0409635fac8.tar.gz
postgresql-41eef0ff75c3ea905513ae46f795c0409635fac8.zip
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.
-rw-r--r--src/backend/rewrite/rewriteHandler.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index b99b9930d6a..8abf5e438c1 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -1605,20 +1605,20 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
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
- * with a non-scannable materialized view unless it is being
- * populated, and that if it is scannable we want to use the existing
- * contents. It would be nice to have some way to confirm that we're
- * doing the right thing here, but rule expansion doesn't give us a
- * lot to work with, so we are trusting earlier validations and
- * execution steps to get it right.
+ * NOTE: This is assuming that if an MV is scannable then we always
+ * want to use the existing contents, and if it is not scannable we
+ * cannot have gotten to this point unless it is being populated
+ * (otherwise an error should be thrown). It would be nice to have
+ * some way to confirm that we're doing the right thing here, but rule
+ * expansion doesn't give us a lot to work with, so we are trusting
+ * earlier validations to throw error if needed.
*/
if (rel->rd_rel->relkind == RELKIND_MATVIEW && rel->rd_isscannable)
{
heap_close(rel, NoLock);
- break;
+ continue;
}
/*