Re: Strange error related to temporary tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange error related to temporary tables
Date: 2006-08-31 22:16:20
Message-ID: 24750.1157062580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Csaba Nagy <nagy(at)ecircle-ag(dot)com> writes:
> create temp table temp_report ...;
> ... do some processing using this table...
> drop table temp_report;
> commit;

> This code occasionally triggered the following error (couldn't reliably
> reproduce):
> ERROR: type "temp_report" already exists

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).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2006-08-31 22:43:03 Re: Tsearch2 & Hebrew
Previous Message Bruce Momjian 2006-08-31 21:48:55 Re: [GENERAL] Thought provoking piece on