Search Postgresql Archives

Re: Last value inserted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx> wrote in message 
news:4193B30B.40905@xxxxxxxxxxxxxxx
> 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
> 



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux