diff options
author | Tom Lane | 2012-02-14 22:34:19 +0000 |
---|---|---|
committer | Tom Lane | 2012-02-14 22:34:56 +0000 |
commit | 398f70ec070fe60151584eaa448f04708aa77892 (patch) | |
tree | 508ae6812ca581b5e39e11bb80206aa87e115046 /src/backend/executor/nodeValuesscan.c | |
parent | c1d9df4fa227781b31be44a5a3024865a7f48049 (diff) |
Preserve column names in the execution-time tupledesc for a RowExpr.
The hstore and json datatypes both have record-conversion functions that
pay attention to column names in the composite values they're handed.
We used to not worry about inserting correct field names into tuple
descriptors generated at runtime, but given these examples it seems
useful to do so. Observe the nicer-looking results in the regression
tests whose results changed.
catversion bump because there is a subtle change in requirements for stored
rule parsetrees: RowExprs from ROW() constructs now have to include field
names.
Andrew Dunstan and Tom Lane
Diffstat (limited to 'src/backend/executor/nodeValuesscan.c')
-rw-r--r-- | src/backend/executor/nodeValuesscan.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/executor/nodeValuesscan.c b/src/backend/executor/nodeValuesscan.c index fc17677d0ac..a6c1b70cca6 100644 --- a/src/backend/executor/nodeValuesscan.c +++ b/src/backend/executor/nodeValuesscan.c @@ -25,6 +25,7 @@ #include "executor/executor.h" #include "executor/nodeValuesscan.h" +#include "parser/parsetree.h" static TupleTableSlot *ValuesNext(ValuesScanState *node); @@ -188,6 +189,8 @@ ValuesScanState * ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags) { ValuesScanState *scanstate; + RangeTblEntry *rte = rt_fetch(node->scan.scanrelid, + estate->es_range_table); TupleDesc tupdesc; ListCell *vtl; int i; @@ -239,7 +242,8 @@ ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags) /* * get info about values list */ - tupdesc = ExecTypeFromExprList((List *) linitial(node->values_lists)); + tupdesc = ExecTypeFromExprList((List *) linitial(node->values_lists), + rte->eref->colnames); ExecAssignScanType(&scanstate->ss, tupdesc); |