summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2011-11-28 03:27:24 +0000
committerTom Lane2011-11-28 03:27:24 +0000
commitdd3bab5fd74db009c946278bb314c8458a2fef11 (patch)
treef71c6c8b9d522467bacc6d34bcccc7dd2629dfff /src/include
parent91572ee0a6dfeb62dda6c375f613d1b7fdfc1383 (diff)
Ensure that whole-row junk Vars are always of composite type.
The EvalPlanQual machinery assumes that whole-row Vars generated for the outputs of non-table RTEs will be of composite types. However, for the case where the RTE is a function call returning a scalar type, we were doing the wrong thing, as a result of sharing code with a parser case where the function's scalar output is wanted. (Or at least, that's what that case has done historically; it does seem a bit inconsistent.) To fix, extend makeWholeRowVar's API so that it can support both use-cases. This fixes Belinda Cussen's report of crashes during concurrent execution of UPDATEs involving joins to the result of UNNEST() --- in READ COMMITTED mode, we'd run the EvalPlanQual machinery after a conflicting row update commits, and it was expecting to get a HeapTuple not a scalar datum from the "wholerowN" variable referencing the function RTE. Back-patch to 9.0 where the current EvalPlanQual implementation appeared. In 9.1 and up, this patch also fixes failure to attach the correct collation to the Var generated for a scalar-result case. An example: regression=# select upper(x.*) from textcat('ab', 'cd') x; ERROR: could not determine which collation to use for upper() function
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/makefuncs.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h
index 532681f8c01..c5ed6cb4133 100644
--- a/src/include/nodes/makefuncs.h
+++ b/src/include/nodes/makefuncs.h
@@ -35,7 +35,8 @@ extern Var *makeVarFromTargetEntry(Index varno,
extern Var *makeWholeRowVar(RangeTblEntry *rte,
Index varno,
- Index varlevelsup);
+ Index varlevelsup,
+ bool allowScalar);
extern TargetEntry *makeTargetEntry(Expr *expr,
AttrNumber resno,