Re: Last value inserted

From: "Jerry III" <jerryiii(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Last value inserted
Date: 2004-11-12 01:51:31
Message-ID: DGUkd.24377$KJ6.18771@newsread1.news.pas.earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Which means that sometimes they do not return the correct value - if you
have a trigger that inserts another record you will not get the right value.
MSSQL has @@IDENTITY and SCOPE_IDENTITY() to handle this case, I'm new to
pgsql so I don't know if it has anything like that.

Jerry

"Richard Huxton" <dev(at)archonet(dot)com> wrote in message
news:4193B30B(dot)40905(at)archonet(dot)com(dot)(dot)(dot)
> MaRCeLO PeReiRA wrote:
>
>> How can I now (for sure) with value was generated by
>> the sequence to fill the field ID?
>>
>> (There is lots of users using the software at the same
>> time, so I am not able to use the last_value()
>> function on the sequence.)
>
> Yes you are nextval()/currval() are multi-user safe. They return the
> next/current value *in the current connection*.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel 2004-11-12 01:52:25 Re: comp.database.postgresql.*
Previous Message Joel 2004-11-12 01:36:55 Re: Important Info on comp.databases.postgresql.general