aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 8d1d0aa927d..e1b280a065c 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -85,7 +85,6 @@ static char *ExecBuildSlotValueDescription(TupleTableSlot *slot,
int maxfieldlen);
static void EvalPlanQualStart(EPQState *epqstate, EState *parentestate,
Plan *planTree);
-static bool RelationIdIsScannable(Oid relid);
/* end of local decls */
@@ -495,63 +494,6 @@ ExecutorRewind(QueryDesc *queryDesc)
/*
- * ExecCheckRelationsScannable
- * Check that relations which are to be accessed are in a scannable
- * state.
- *
- * Currently the only relations which are not are materialized views which
- * have not been populated by their queries.
- */
-static void
-ExecCheckRelationsScannable(List *rangeTable)
-{
- ListCell *l;
-
- foreach(l, rangeTable)
- {
- RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
-
- if (rte->rtekind != RTE_RELATION)
- continue;
-
- if (rte->relkind != RELKIND_MATVIEW)
- continue;
-
- /* It is OK to target an unpopulated materialized for results. */
- if (rte->isResultRel)
- continue;
-
- if (!RelationIdIsScannable(rte->relid))
- ereport(ERROR,
- (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("materialized view \"%s\" has not been populated",
- get_rel_name(rte->relid)),
- errhint("Use the REFRESH MATERIALIZED VIEW command.")));
- }
-}
-
-/*
- * Tells whether a relation is scannable based on its OID.
- *
- * Currently only non-populated materialized views are not. This is likely to
- * change to include other conditions.
- *
- * This should only be called while a lock is held on the relation.
- */
-static bool
-RelationIdIsScannable(Oid relid)
-{
- Relation relation;
- bool result;
-
- relation = heap_open(relid, NoLock);
- result = RelationIsScannable(relation);
- heap_close(relation, NoLock);
-
- return result;
-}
-
-/*
* ExecCheckRTPerms
* Check access permissions for all relations listed in a range table.
*
@@ -942,20 +884,6 @@ InitPlan(QueryDesc *queryDesc, int eflags)
planstate = ExecInitNode(plan, estate, eflags);
/*
- * Unless we are creating a view or are creating a materialized view WITH
- * NO DATA, ensure that all referenced relations are scannable. The
- * omitted cases will be checked as SELECT statements in a different
- * phase, so checking again here would be wasteful and it would generate
- * errors on a materialized view referenced as a target.
- *
- * NB: This is being done after all relations are locked, files have been
- * opened, etc., to avoid duplicating that effort or creating deadlock
- * possibilities.
- */
- if ((eflags & EXEC_FLAG_WITH_NO_DATA) == 0)
- ExecCheckRelationsScannable(rangeTable);
-
- /*
* Get the tuple descriptor describing the type of tuples to return.
*/
tupType = ExecGetResultType(planstate);