Temp tables

Started by Pascal Tufenkjialmost 13 years ago3 messagesgeneral
Jump to latest
#1Pascal Tufenkji
ptufenkji@usj.edu.lb

Hi,

To enhance the performance of the queries, I use temp tables in my website
reports.

It seems that a temp table has not been dropped automatically in a certain
session, and now the report is giving an error since the temp table already
exists ?!

When I type the following, the database gives me an error:

dragon=# CREATE TEMP TABLE _parcours (id int);

ERROR: type "_parcours" already exists

1. How can I identify the session in which the temp table is still
locked, so I can drop it manually

2. Why does those cases happen and the temp tables don’t drop
automatically

I’d appreciate a quick reply

Thanks in advance

Pascal TUFENKJI
Service de Technologie de l'Information
Université Saint-Joseph - Rectorat
Tel: +961 1 421 132
Email: <mailto:ptufenkji@usj.edu.lb> ptufenkji@usj.edu.lb

#2Steve Crawford
scrawford@pinpointresearch.com
In reply to: Pascal Tufenkji (#1)
Re: Temp tables

On 05/23/2013 12:24 AM, Pascal Tufenkji wrote:

Hi,

To enhance the performance of the queries, I use temp tables in my
website reports.

It seems that a temp table has not been dropped automatically in a
certain session, and now the report is giving an error since the temp
table already exists ?!

When I type the following, the database gives me an error:

dragon=# CREATE TEMP TABLE _parcours (id int);

ERROR: type "_parcours" already exists

1.How can I identify the session in which the temp table is still
locked, so I can drop it manually

2.Why does those cases happen and the temp tables don't drop automatically

Two questions:

1. Is that the exact message you are getting. I would expect *relation*
"_parcours" already exists not *type*.

2. Are you using persistent connections or connection pooling?

It feels a bit like there is something leftover from a previous process
that was using the same connection.

Cheers,
Steve

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Steve Crawford (#2)
Re: Temp tables

Steve Crawford <scrawford@pinpointresearch.com> writes:

On 05/23/2013 12:24 AM, Pascal Tufenkji wrote:

When I type the following, the database gives me an error:
dragon=# CREATE TEMP TABLE _parcours (id int);
ERROR: type "_parcours" already exists

Perhaps you have a type or temp table named "parcours"? If so,
"_parcours" is the internal name of the associated array type.
You'll need to use a different name.

It feels a bit like there is something leftover from a previous process
that was using the same connection.

We have seen a small number of reports where it seemed that some catalog
entry(s) associated with temp tables didn't get dropped when they should
have been. No one's been able to create a reproducible case though.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general