Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> Maybe PL/pgSQL cache problem?
This is a well-known problem: plpgsql caches a query plan that refers
to the first version of the temp table, and it doesn't know it needs
to rebuild the plan. AFAIK the only workaround at present is to use
EXECUTE for queries referencing the temp table.
regards, tom lane