I executed what you suggest below, see the results below. Short conclusion: the type is there in pg_type, the relation is not there in pg_class. Is there anything I should look for more ? Cheers, Csaba. > BTW, when this happens, does the error persist? If it's a race > condition you'd expect not (because the guy who successfully created the > temp table would soon drop it again). When we saw this problem before, > we were speculating that a temp table's pg_type row had somehow not > gotten dropped during table drop, which'd lead to a persistent failure. > > Note that a "persistent" failure could still only manifest occasionally, > if the unwanted pg_type row were in a high-numbered pg_temp_NNN schema > that doesn't get used often. So i guess the correct thing to do is > "select oid, xmin from pg_type where typname = 'temp_report'" and see > if there are any long-lived entries (xmin far away from the others would > be a tipoff). test03=> select oid, xmin from pg_type where typname = 'temp_report'; oid | xmin ----------+----------- 58293995 | 220215039 (1 row) test03=> select * from pg_type where typname = 'temp_report'; typname | typnamespace | typowner | typlen | typbyval | typtype | typisdefined | typdelim | typrelid | typelem | typinput | typoutput | typreceive | typsend | typanalyze | typalign | typstorage | typnotnull | typbasetype | typtypmod | typndims | typdefaultbin | typdefault -------------+--------------+----------+--------+----------+---------+--------------+----------+----------+---------+-----------+------------+-------------+-------------+------------+----------+------------+------------+-------------+-----------+----------+---------------+------------ temp_report | 58006858 | 16386 | -1 | f | c | t | , | 58293994 | 0 | record_in | record_out | record_recv | record_send | - | d | x | f | 0 | -1 | 0 | | (1 row) test03=> select * from pg_namespace where oid=58006858; nspname | nspowner | nspacl -----------+----------+-------- pg_temp_8 | 10 | (1 row) test03=> select count(*) from pg_class where relname='temp_report'; count ------- 0 (1 row)