Re: Re : Re : Re : Re : Select in temporary table

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Sylvain Lara <sly_lara(at)yahoo(dot)com>
Cc: jose javier parra sanchez <jojapasa(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re : Re : Re : Re : Select in temporary table
Date: 2010-04-01 10:01:30
Message-ID: 300D20DC-4655-4EC2-B4AB-447A025E1B9E@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1 Apr 2010, at 10:47, Sylvain Lara wrote:
> De : jose javier parra sanchez <jojapasa(at)gmail(dot)com>
> Cc : pgsql-general(at)postgresql(dot)org
> Envoyé le : Jeu 1 avril 2010, 9 h 26 min 27 s
> Objet : Re: Re : Re : Re : [GENERAL] Select in temporary table
>
> Not sure about how de C# driver you use to connect, but if you have
> multiple connections, then you have multiple sessions.
>
> -----------------------------------------------
>
> I've got multiple connections, but when selecting data in my temp table (when it works, once, twice, three times and more before the error), I've got my data when selecting into the temp table.
>
> Whereas if I connect the same base, at the same time, from another client, it doesn't display the same data, which is correct for me.
>
> Each client has it's own temporary table data.
>
> But my problem is that this temporary table is randomly accessible by the same client.
> And it's seems that if I wait a moment between two executions (I put a breakpoint and browse my NpgSQLConnection object), I can access my temp table without any problem...

Sounds like there's a connection pooler in there somewhere and you sometimes get a different connection than the one your temp table lives in. Only the connection that created the temp table will be able to see it.

Other possibilities I can think of:

Are you rolling back the transaction with which you created the temp table? In that case the temp table is gone after you rolled back, so if later code is trying to access it it won't find it.

Is your client multi-threaded? Is it possible that you're trying to access the temp table from another thread before it finished creating?
That's probably not the case, or you'd either need to serialize your database access to be able to use the same connection - in which case this situation can't occur - or you're using multiple parallel connections from the same client and we're back at the multiple-connection answer. If you'd be using one connection in parallel threads without serializing them then you're having more serious issues to deal with...

It's most probably a problem in your client or your connection library, other people are using temp tables without a problem. Temp tables are not exactly a new feature either.

Alban Hertroys

PS. Considering the way you quote your mails you seem to have an absolutely terrible mail client. If you have a choice, consider getting something decent.

--
Screwing up is an excellent way to attach something to the ceiling.

!DSPAM:737,4bb46f1610411569890503!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2010-04-01 10:01:55 Re: [HACKERS] Postgres 9.1 - Release Theme
Previous Message Magnus Hagander 2010-04-01 09:57:37 Re: prevent connection using pgpass.conf