diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-04-27 17:48:57 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-04-27 17:48:57 -0400 |
commit | 5194024d72f33fb209e10f9ab0ada7cc67df45b7 (patch) | |
tree | 81de10ef02d808084d0b62d2ed2bd609954be176 /src/backend/executor/nodeSeqscan.c | |
parent | f5d576c6d278a61beec282b9b276a3a3cb2aec50 (diff) | |
download | postgresql-5194024d72f33fb209e10f9ab0ada7cc67df45b7.tar.gz postgresql-5194024d72f33fb209e10f9ab0ada7cc67df45b7.zip |
Incidental cleanup of matviews code.
Move checking for unscannable matviews into ExecOpenScanRelation, which is
a better place for it first because the open relation is already available
(saving a relcache lookup cycle), and second because this eliminates the
problem of telling the difference between rangetable entries that will or
will not be scanned by the query. In particular we can get rid of the
not-terribly-well-thought-out-or-implemented isResultRel field that the
initial matviews patch added to RangeTblEntry.
Also get rid of entirely unnecessary scannability check in the rewriter,
and a bogus decision about whether RefreshMatViewStmt requires a parse-time
snapshot.
catversion bump due to removal of a RangeTblEntry field, which changes
stored rules.
Diffstat (limited to 'src/backend/executor/nodeSeqscan.c')
-rw-r--r-- | src/backend/executor/nodeSeqscan.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index c6f2eabedee..c4edec0750b 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -29,7 +29,7 @@ #include "executor/nodeSeqscan.h" #include "utils/rel.h" -static void InitScanRelation(SeqScanState *node, EState *estate); +static void InitScanRelation(SeqScanState *node, EState *estate, int eflags); static TupleTableSlot *SeqNext(SeqScanState *node); /* ---------------------------------------------------------------- @@ -118,12 +118,11 @@ ExecSeqScan(SeqScanState *node) /* ---------------------------------------------------------------- * InitScanRelation * - * This does the initialization for scan relations and - * subplans of scans. + * Set up to access the scan relation. * ---------------------------------------------------------------- */ static void -InitScanRelation(SeqScanState *node, EState *estate) +InitScanRelation(SeqScanState *node, EState *estate, int eflags) { Relation currentRelation; HeapScanDesc currentScanDesc; @@ -133,8 +132,10 @@ InitScanRelation(SeqScanState *node, EState *estate) * open that relation and acquire appropriate lock on it. */ currentRelation = ExecOpenScanRelation(estate, - ((SeqScan *) node->ps.plan)->scanrelid); + ((SeqScan *) node->ps.plan)->scanrelid, + eflags); + /* initialize a heapscan */ currentScanDesc = heap_beginscan(currentRelation, estate->es_snapshot, 0, @@ -143,6 +144,7 @@ InitScanRelation(SeqScanState *node, EState *estate) node->ss_currentRelation = currentRelation; node->ss_currentScanDesc = currentScanDesc; + /* and report the scan tuple slot's rowtype */ ExecAssignScanType(node, RelationGetDescr(currentRelation)); } @@ -196,7 +198,7 @@ ExecInitSeqScan(SeqScan *node, EState *estate, int eflags) /* * initialize scan relation */ - InitScanRelation(scanstate, estate); + InitScanRelation(scanstate, estate, eflags); scanstate->ps.ps_TupFromTlist = false; |