Re: Strange error related to temporary tables

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange error related to temporary tables
Date: 2006-08-31 15:34:44
Message-ID: 1157038484.3033.66.camel@coppola.muc.ecircle.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2006-08-31 at 17:25, Alban Hertroys wrote:
> Csaba Nagy wrote:
> > The code is possible to be executed in parallel by multiple threads, on
> > different connections, or in sequence on the same connection. I would
> > expect it in both cases to work correctly... in manual tests I was able
> > to create in parallel temporary tables named identically in different
> > connections, and on the same connection after rolling back the
> > transaction which created the first table... so I don't know what to try
> > to trigger this.
> >
> > Any ideas what's the problem ?
>
> Are you sure that you're not re-using an existing connection from a pool?

Of course I'm re-using a connection from a pool... but if you look at
the pseudo-code from the OP, the temporary table is either dropped or
the transaction which creates it is rolled back, before the connection
is returned to the pool. When another thread is reusing the connection,
the table should be dropped either way, and manual tests show that it
works both ways, so I guess it is some race condition somewhere else.

In any case, the error message is strange in itself, as if I try to
create the temporary table when it exists, the error I get in manual
trial is:

ERROR: relation "test_temp_table" already exists
^^^^^^^^

compared to the error from the OP which I cite here for reference:

ERROR: type "temp_report" already exists
^^^^

So it was complaining about an already existing type, not relation.

Any ideas ? I'm still clueless.

Cheers,
Csaba.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ardian Xharra 2006-08-31 15:44:27 Re: Fatal error while installing
Previous Message Shane Ambler 2006-08-31 15:26:34 Re: Listening on more than one port?