Re: temp tables

From: "Schuhmacher, Bret" <Bret(dot)Schuhmacher(at)Aspect(dot)com>
To: "John DeSoi" <desoi(at)pgedit(dot)com>, "Cima" <ruel(dot)cima(at)facinf(dot)uho(dot)edu(dot)cu>
Cc: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: temp tables
Date: 2005-04-28 14:01:42
Message-ID: 98E4F4D46DACD0479C96D7356D5C37356B0784@sac1exch3.aspect.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Is this safe? What happens if multiple users hit the PHP page nearly simultaneously (or at least just after someone else) and the temp table exists? I avoided the temp table approach in an app for exactly this reason... What does PG do in this case? Do the temp tables belong to the session/connection and they're insulated from each other?

Thanks,

Bret

> -----Original Message-----
> From: pgsql-novice-owner(at)postgresql(dot)org
> [mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of John DeSoi
> Sent: Thursday, April 28, 2005 8:18 AM
> To: Cima
> Cc: PostgreSQL Novice
> Subject: Re: [NOVICE] temp tables
>
>
> On Apr 28, 2005, at 12:45 AM, Cima wrote:
>
> >
> > im working with php 4 and postgresql 8 and in my php script
> id like to
> > create a temp table on my database server. how do i do
> this? how do i
> > verify it was created?
> >  
> > i tried the following:
> >  
> > $sql = "create temp table s_info(a int, b text) on commit
> delete rows 
> > ";
> >  
> > pg_query($dbh,$sql);
> >  
> >  
> > $dbh is my connection.
> >  
> > any help will be highly appreciated.
>
>
> You can verify it was created by checking the result from
> pg_query and looking at pg_last_error. The table is
> automatically dropped at the end of the connection, most
> likely when your PHP script ends.
>
>
> John DeSoi, Ph.D.
> http://pgedit.com/
> Power Tools for PostgreSQL
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so
> that your
> message can get through to the mailing list cleanly
>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Marc Mamin 2005-04-28 14:53:47 connect from perl: error in Carp.pm
Previous Message John DeSoi 2005-04-28 13:48:20 Re: pg8.0.2 win install