postgresql/src/include/nodes
Tom Lane dd3bab5fd7 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
2011-11-27 22:27:24 -05:00
..
bitmapset.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
execnodes.h Rearrange the implementation of index-only scans. 2011-10-11 14:21:30 -04:00
makefuncs.h Ensure that whole-row junk Vars are always of composite type. 2011-11-27 22:27:24 -05:00
memnodes.h Pull up isReset flag from AllocSetContext to MemoryContext struct. This 2011-05-21 14:47:19 -04:00
nodeFuncs.h Revise collation derivation method and expression-tree representation. 2011-03-19 20:30:08 -04:00
nodes.h Further consolidation of DROP statement handling. 2011-11-17 21:32:34 -05:00
params.h pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
parsenodes.h Further code review for range types patch. 2011-11-20 23:50:27 -05:00
pg_list.h pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
plannodes.h Fix handling of PlaceHolderVars in nestloop parameter management. 2011-11-03 00:50:58 -04:00
primnodes.h Fix unsupported options in CREATE TABLE ... AS EXECUTE. 2011-11-24 23:21:45 -05:00
print.h Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
readfuncs.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
relation.h Fix handling of PlaceHolderVars in nestloop parameter management. 2011-11-03 00:50:58 -04:00
replnodes.h Clean up ill-advised attempt to invent a private set of Node tags. 2011-08-06 14:53:49 -04:00
tidbitmap.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
value.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00