Re: [SQL] Is this possible?

Поиск
Список
Период
Сортировка
От Peter J. Schoenster
Тема Re: [SQL] Is this possible?
Дата
Msg-id 3B016B9E.17125.A6AD29A@localhost
обсуждение исходный текст
Список pgsql-novice
On 11 May 2001, at 11:24, Roberto Mello wrote:

> On Tue, May 08, 2001 at 09:16:56PM -0400, Wei Weng wrote:
> > I have a table that has a serial for primary key. Is it possible to
> > get the new available primary key right after I insert a row of new
> > entry?
>
>  Yeah. Se the documentation on triggers.

My method is to insert into the target table(s) in advance.

my ($job_id) = $self->{dbh}->selectrow_array(qq|SELECT
NEXTVAL ('zipinfo_job_id_seq')|);

and then I use job_id as a hidden value in the form that gets printed.

Peter



---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
                -- Philip K. Dick

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

Предыдущее
От: pete@example.compulink.co.uk
Дата:
Сообщение: Re: Looking for good reference materials for SQL programming.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql