On 12/27/17 15:38, Tom Lane wrote:
> It seems possible that the "promise" technique could be useful for
> other plpgsql special variables in future. I thought briefly about
> applying it to triggers' NEW and OLD arguments, but desisted because
> (a) it's only a win if triggers will commonly not touch the variable,
> which seems unlikely to be true for NEW/OLD; and (b) it would have
> required infrastructure for attaching a promise to a DTYPE_REC
> variable, which was more pain than I wanted. But I wonder if it'd
> be useful for, say, the special variables that exception blocks create.
This might be useful for instantiating virtual generated column values
in AFTER triggers on demand. Although this would require promises on
record *fields*. Anyway, it's useful infrastructure, and could have
more uses.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services