Re: newid() in postgres
От | Postgres User |
---|---|
Тема | Re: newid() in postgres |
Дата | |
Msg-id | b88c3460704042024n497f18edxca83d11b8558f6e2@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: newid() in postgres (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: newid() in postgres
|
Список | pgsql-general |
Marcel, A sequence represents a unique identifier. You can call the function 'nextval' to get the next unique value in the sequence. See related functions here: http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html In this code, I get the next sequence, insert it into a table, and then return the value to the calling function: DECLARE nextseq integer; BEGIN nextseq := nextval('entry_id_seq'); INSERT INTO my_table ( entry_id, entry_text, ) VALUES ( nextseq, p_entry_text, -- input param ); On 4/4/07, Peter Eisentraut <peter_e@gmx.net> wrote: > marcel.beutner wrote: > > I've searched in the groups already, but couldn't find any helpful > > information - only to use a sequence, which returns just a number and > > not a unique identifier. > > Which properties do your unique identifiers posses that are not > satisfied by a number returned by a sequence? > > -- > Peter Eisentraut > http://developer.postgresql.org/~petere/ > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >
В списке pgsql-general по дате отправления: