1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00

Rearrange code in ExecInitBitmapHeapScan so that we don't initialize the

child plan nodes until we have acquired lock on the relation to scan.
The relative order of initialization of plan nodes isn't real important in
other cases, but it's critical here because one is supposed to lock a
relation before its indexes, not vice versa.  The original coding was at
least vulnerable to deadlock against DROP INDEX, and perhaps worse things.
This commit is contained in:
Tom Lane
2005-12-02 01:30:26 +00:00
parent 3ece85f8bf
commit 2913b95308

View File

@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.4 2005/10/15 02:49:17 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.4.2.1 2005/12/02 01:30:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -442,11 +442,6 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
ExecInitExpr((Expr *) node->bitmapqualorig,
(PlanState *) scanstate);
/*
* initialize child nodes
*/
outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate);
#define BITMAPHEAPSCAN_NSLOTS 2
/*
@ -496,6 +491,15 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
ExecAssignResultTypeFromTL(&scanstate->ss.ps);
ExecAssignScanProjectionInfo(&scanstate->ss);
/*
* initialize child nodes
*
* We do this last because the child nodes will open indexscans on our
* relation's indexes, and we want to be sure we have acquired a lock
* on the relation first.
*/
outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate);
/*
* all done.
*/