mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user