aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-12-02 01:30:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-12-02 01:30:26 +0000
commit2913b95308199854e64c81e9f2f11e20d2878e0f (patch)
tree708064cd1a3f7e19e9296dfb61538a735bd34a70 /src
parent3ece85f8bf43e122fc4fa647e56c72a6511cca4f (diff)
downloadpostgresql-2913b95308199854e64c81e9f2f11e20d2878e0f.tar.gz
postgresql-2913b95308199854e64c81e9f2f11e20d2878e0f.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/nodeBitmapHeapscan.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 5d92c19ea5e..38288ec659e 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -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
/*
@@ -497,6 +492,15 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
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.
*/
return scanstate;