mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Get rid of ExecAssignResultTypeFromOuterPlan() and make all plan node types
generate their output tuple descriptors from their target lists (ie, using ExecAssignResultTypeFromTL()). We long ago fixed things so that all node types have minimally valid tlists, so there's no longer any good reason to have two different ways of doing it. This change is needed to fix bug reported by Hayden James: the fix of 2005-11-03 to emit the correct column names after optimizing away a SubqueryScan node didn't work if the new top-level plan node used ExecAssignResultTypeFromOuterPlan to generate its tupdesc, since the next plan node down won't have the correct column labels.
This commit is contained in:
parent
19ff959bff
commit
4dd2048a47
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.128 2005/11/22 18:17:10 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.129 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -435,22 +435,6 @@ ExecAssignResultType(PlanState *planstate,
|
|||||||
ExecSetSlotDescriptor(slot, tupDesc, shouldFree);
|
ExecSetSlotDescriptor(slot, tupDesc, shouldFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
|
||||||
* ExecAssignResultTypeFromOuterPlan
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
ExecAssignResultTypeFromOuterPlan(PlanState *planstate)
|
|
||||||
{
|
|
||||||
PlanState *outerPlan;
|
|
||||||
TupleDesc tupDesc;
|
|
||||||
|
|
||||||
outerPlan = outerPlanState(planstate);
|
|
||||||
tupDesc = ExecGetResultType(outerPlan);
|
|
||||||
|
|
||||||
ExecAssignResultType(planstate, tupDesc, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* ExecAssignResultTypeFromTL
|
* ExecAssignResultTypeFromTL
|
||||||
* ----------------
|
* ----------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.98 2005/11/22 18:17:10 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.99 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -164,7 +164,7 @@ ExecInitHash(Hash *node, EState *estate)
|
|||||||
* initialize tuple type. no need to initialize projection info because
|
* initialize tuple type. no need to initialize projection info because
|
||||||
* this node doesn't do projections
|
* this node doesn't do projections
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&hashstate->ps);
|
ExecAssignResultTypeFromTL(&hashstate->ps);
|
||||||
hashstate->ps.ps_ProjInfo = NULL;
|
hashstate->ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
return hashstate;
|
return hashstate;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.22 2005/10/15 02:49:17 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.23 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -327,7 +327,7 @@ ExecInitLimit(Limit *node, EState *estate)
|
|||||||
* limit nodes do no projections, so initialize projection info for this
|
* limit nodes do no projections, so initialize projection info for this
|
||||||
* node appropriately
|
* node appropriately
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&limitstate->ps);
|
ExecAssignResultTypeFromTL(&limitstate->ps);
|
||||||
limitstate->ps.ps_ProjInfo = NULL;
|
limitstate->ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
return limitstate;
|
return limitstate;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.50 2005/10/15 02:49:17 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.51 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -195,7 +195,7 @@ ExecInitMaterial(Material *node, EState *estate)
|
|||||||
* initialize tuple type. no need to initialize projection info because
|
* initialize tuple type. no need to initialize projection info because
|
||||||
* this node doesn't do projections.
|
* this node doesn't do projections.
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&matstate->ss.ps);
|
ExecAssignResultTypeFromTL(&matstate->ss.ps);
|
||||||
ExecAssignScanTypeFromOuterPlan(&matstate->ss);
|
ExecAssignScanTypeFromOuterPlan(&matstate->ss);
|
||||||
matstate->ss.ps.ps_ProjInfo = NULL;
|
matstate->ss.ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.18 2005/10/15 02:49:17 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.19 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -258,7 +258,7 @@ ExecInitSetOp(SetOp *node, EState *estate)
|
|||||||
* setop nodes do no projections, so initialize projection info for this
|
* setop nodes do no projections, so initialize projection info for this
|
||||||
* node appropriately
|
* node appropriately
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&setopstate->ps);
|
ExecAssignResultTypeFromTL(&setopstate->ps);
|
||||||
setopstate->ps.ps_ProjInfo = NULL;
|
setopstate->ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.51 2005/10/15 02:49:17 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.52 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -193,7 +193,7 @@ ExecInitSort(Sort *node, EState *estate)
|
|||||||
* initialize tuple type. no need to initialize projection info because
|
* initialize tuple type. no need to initialize projection info because
|
||||||
* this node doesn't do projections.
|
* this node doesn't do projections.
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&sortstate->ss.ps);
|
ExecAssignResultTypeFromTL(&sortstate->ss.ps);
|
||||||
ExecAssignScanTypeFromOuterPlan(&sortstate->ss);
|
ExecAssignScanTypeFromOuterPlan(&sortstate->ss);
|
||||||
sortstate->ss.ps.ps_ProjInfo = NULL;
|
sortstate->ss.ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.49 2005/11/22 18:17:10 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.50 2005/11/23 20:27:57 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -150,7 +150,7 @@ ExecInitUnique(Unique *node, EState *estate)
|
|||||||
* unique nodes do no projections, so initialize projection info for this
|
* unique nodes do no projections, so initialize projection info for this
|
||||||
* node appropriately
|
* node appropriately
|
||||||
*/
|
*/
|
||||||
ExecAssignResultTypeFromOuterPlan(&uniquestate->ps);
|
ExecAssignResultTypeFromTL(&uniquestate->ps);
|
||||||
uniquestate->ps.ps_ProjInfo = NULL;
|
uniquestate->ps.ps_ProjInfo = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.120 2005/10/15 02:49:44 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.121 2005/11/23 20:27:58 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -218,7 +218,6 @@ extern ExprContext *MakePerTupleExprContext(EState *estate);
|
|||||||
extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
|
extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
|
||||||
extern void ExecAssignResultType(PlanState *planstate,
|
extern void ExecAssignResultType(PlanState *planstate,
|
||||||
TupleDesc tupDesc, bool shouldFree);
|
TupleDesc tupDesc, bool shouldFree);
|
||||||
extern void ExecAssignResultTypeFromOuterPlan(PlanState *planstate);
|
|
||||||
extern void ExecAssignResultTypeFromTL(PlanState *planstate);
|
extern void ExecAssignResultTypeFromTL(PlanState *planstate);
|
||||||
extern TupleDesc ExecGetResultType(PlanState *planstate);
|
extern TupleDesc ExecGetResultType(PlanState *planstate);
|
||||||
extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
|
extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user