Re: Return serial from insert
От | Rod Kreisler |
---|---|
Тема | Re: Return serial from insert |
Дата | |
Msg-id | JNEGKNDJGBKLBDGPOPFOKEDPDEAA.rod@23net.net обсуждение исходный текст |
Ответ на | Return serial from insert (Rory Campbell-Lange <mail@campbell-lange.net>) |
Ответы |
Re: Return serial from insert
|
Список | pgsql-novice |
You should get the nextval() from the sequence and use that for the new insert and all related inserts. > -----Original Message----- > From: pgsql-novice-owner@postgresql.org > [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Rory > Campbell-Lange > Sent: Friday, November 08, 2002 10:30 AM > To: pgsql-novice@postgresql.org > Subject: [NOVICE] Return serial from insert > > > I would like to return the autoincremented serial number resulting from > a new insert into a table, ideally as a result from the insert > statement. > > Presumably this is the way to avoid race conditions between inserts into > the database, because if I do 1) insert then 2) get max sequence val, 2 > might be wrong. > > Thanks > Rory > > -- > Rory Campbell-Lange > <rory@campbell-lange.net> > <www.campbell-lange.net> > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > >
В списке pgsql-novice по дате отправления: