Re: Last Insert

From: Steve Lane <slane(at)fmpro(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Last Insert
Date: 2002-03-14 16:56:25
Message-ID: B8B63259.A125%slane@fmpro.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/14/02 1:06 AM, "Martijn van Oosterhout" <kleptog(at)svana(dot)org> wrote:

> On Wed, Mar 13, 2002 at 09:35:25PM -0600, Steve Lane wrote:
>> In general I'm accessing postgres through PHP-based applications that use a
>> persistent connection. I use PHP as an Apache module, which means that the
>> connections are one-per-process. But as far as I understand, it's perfectly
>> possible that in the middle of PHP script X that's being serviced by process
>> 37, some other user's web request could get handed off to process 37 and use
>> that connection at any time.
>
> Really? I thought a single process in Apache could only handle one request
> at a time. That's why apache has multiple processes. However, I'm not sure
> sure a multi-threaded version of Apache would deal with this.

Oh, right. When you put it that way I'm sure that's the way it works. Each
Apache process is single-threaded to the best of my knowledge.

> The OID is not unsafe, I mean that it can't be used in a system where you
> use psql < file to do your updates. There is no programmatical construct for
> OID_OF_LAST_INSERT. Like in:
>
> insert into a select blah ... ;
> insert into b select a.id, blah ... where a.oid = OID_OF_LAST_INSERT;
>
> You need a program to extract the oid from the result of the query and send
> a modify the query appropriatly. This may not be applicable in your case.

Ah, now I see you what you meant by a file query. Makes perfect sense.

Thanks again.

-- sgl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Enrico Mangano 2002-03-14 17:20:44 UPDATE and SELECT result difference
Previous Message Doug McNaught 2002-03-14 16:48:29 Re: JDBC Prepared Statement Bug