Re: [GENERAL] How to get seq after insert]

Поиск
Список
Период
Сортировка
От Karl DeBisschop
Тема Re: [GENERAL] How to get seq after insert]
Дата
Msg-id 199904151256.IAA27305@skillet.infoplease.com
обсуждение исходный текст
Ответ на Re: [GENERAL] How to get seq after insert]  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-general
On Thu, 15 Apr 1999, Bruce Momjian wrote:

> > On Wed, 14 Apr 1999, Michael Davis wrote:
> >
> > > The safest way is to select the nextval('seq_name') and then insert using
> > > this value.
> >
> > I understand, I just thought something like, I do the insert, and then
> > grab the value with:
> >
> >  $insertid = $sth->{'insertid'};
>
> The OID is returned from the insert.  Use that, or use it to look up the
> field you want.

Actually, I think the number of rows inserted is returned from the
insert, or an error code (a negative number).  But the OID can be
obtained by $oid = sth->{'pg_oid_status'};

--
Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com  - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: [GENERAL] what is the max postgres db size & table size?
Следующее
От: darold
Дата:
Сообщение: The WWW of PostgreSQL