Fix subtly-wrong volatility checking in BeginCopyFrom().

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 3c24b08f9bdc191d9e389dbcd97dbfb4cdb546d4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2013-11-08T13:59:43Z
Releases: 9.3.2
Fix subtly-wrong volatility checking in BeginCopyFrom().

contain_volatile_functions() is best applied to the output of
expression_planner(), not its input, so that insertion of function
default arguments and constant-folding have been done.  (See comments
at CheckMutability, for instance.)  It's perhaps unlikely that anyone
will notice a difference in practice, but still we should do it properly.

In passing, change variable type from Node* to Expr* to reduce the net
number of casts needed.

Noted while perusing uses of contain_volatile_functions().

Files

PathChange+/−
src/backend/commands/copy.c modified +9 −5