Re: pg_query & pg_last_oid

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Ben-Nes Michael <miki(at)canaan(dot)co(dot)il>
Cc: postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_query & pg_last_oid
Date: 2002-08-18 13:16:03
Message-ID: 20020818231602.B19841@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I don't beleive so, since the last oid is specifically tied to the last
query you executed. Ofcourse, if you insert multiple rows at the same time,
you don't get any oid at all.

Or you could use nextval/currval and get clearly defined semantics which are
guarenteed to work in the future.

(What would pg_last_oid return on a table that doesn't have oids?)

On Fri, Aug 16, 2002 at 10:44:13AM +0200, Ben-Nes Michael wrote:
> Hi All
>
> In PHP
>
> after sending a querry Im using pg_last_oid to get the oid.
>
> Is a mix between two users that submit query simultaniusly accour ?
>
> user A: insert into .......
> user A: last oid 1
> user B: insert into .......
> user B: last oid 2
>
> user A: pg_last_oid = 2
> user B: pg_last_oid = 2
>
> Can this happen ?
> If so, what one can do to avoid it ?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-08-18 16:58:39 Re: cube_contains and indexing
Previous Message Alvar Freude 2002-08-18 12:47:18 BYTEA, indexes and "like"