Re: Last value inserted

Поиск
Список
Период
Сортировка
От Jeff Eckermann
Тема Re: Last value inserted
Дата
Msg-id 20041116145444.88827.qmail@web20826.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: Last value inserted  ("Jerry III" <jerryiii@hotmail.com>)
Ответы Re: Last value inserted  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Last value inserted  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
--- Jerry III <jerryiii@hotmail.com> wrote:

> 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.

If you are new to PostgreSQL, as you say, then why are
you so sure of this?  Perhaps you may profit from
looking a little more at how currval() works.

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




__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com



В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: OID's
Следующее
От: matthias@cmklein.de
Дата:
Сообщение: How to deal with almost recurring data?