Skip to content

Commit 99848ed

Browse files
committed
Add missing handling of PlannedStmt.transientPlan in copyfuncs/outfuncs.
_outPlannedStmt is only debug support, so the omission there was not very serious, but the omission in _copyPlannedStmt is a real bug. The consequence would be that a copied plan tree would never be marked as a transient plan, so that we would forget we ought to replan it after some not-yet-ready index becomes ready for use. This might explain some past complaints about indexes created with CREATE INDEX CONCURRENTLY not being used right away. Problem spotted by Yeb Havinga. Back-patch to 8.3, where the field was added.
1 parent ef71375 commit 99848ed

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/backend/nodes/copyfuncs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.467 2010/08/07 02:44:06 tgl Exp $
18+
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.468 2010/08/18 15:21:54 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -79,6 +79,7 @@ _copyPlannedStmt(PlannedStmt *from)
7979
COPY_SCALAR_FIELD(commandType);
8080
COPY_SCALAR_FIELD(hasReturning);
8181
COPY_SCALAR_FIELD(canSetTag);
82+
COPY_SCALAR_FIELD(transientPlan);
8283
COPY_NODE_FIELD(planTree);
8384
COPY_NODE_FIELD(rtable);
8485
COPY_NODE_FIELD(resultRelations);

src/backend/nodes/outfuncs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.388 2010/08/07 02:44:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.389 2010/08/18 15:21:54 tgl Exp $
1212
*
1313
* NOTES
1414
* Every node type that can appear in stored rules' parsetrees *must*
@@ -244,6 +244,7 @@ _outPlannedStmt(StringInfo str, PlannedStmt *node)
244244
WRITE_ENUM_FIELD(commandType, CmdType);
245245
WRITE_BOOL_FIELD(hasReturning);
246246
WRITE_BOOL_FIELD(canSetTag);
247+
WRITE_BOOL_FIELD(transientPlan);
247248
WRITE_NODE_FIELD(planTree);
248249
WRITE_NODE_FIELD(rtable);
249250
WRITE_NODE_FIELD(resultRelations);

0 commit comments

Comments
 (0)