Mike Mascari <mascarm@mascari.com> writes:
> I've switched to using a CREATE TEMPORARY TABLE AS SELECT..,
> INSERT..SELECT to avoid the scenario.
Uh, you mean something like
select a, a from (select nextval('foo') as a) as b;
That might surprise you even more :-(
Perhaps the planner shouldn't pull up subqueries whose targetlists
include any noncachable functions. This needs more thought.
regards, tom lane