Обсуждение: pg_query & pg_last_oid

Поиск
Список
Период
Сортировка

pg_query & pg_last_oid

От
"Ben-Nes Michael"
Дата:
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 ?


Re: pg_query & pg_last_oid

От
Martijn van Oosterhout
Дата:
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@postgresql.org)

--
Martijn van Oosterhout   <kleptog@svana.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.