On Tue, 2007-17-07 at 00:51 +0000, Chris Bowlby wrote:
> Using a temporary table of the same name in repeated calls to a stored
> procedure are causing OID failure issues
This is a (well) known bug. The problem arises because plpgsql caches
the query plan used to access the temporary table, which includes the
temp table's OID; when a new temp is created, it is assigned a new OID,
but the cached plan is not discarded.
The bug will be fixed in 8.3 (cached plans are now invalidated when
dependent DB objects change). In the mean time, you can workaround the
problem by always accessing the temporary table with EXECUTE -- see the
list archives for prior discussion.
-Neil