Re: SERIAL Field

Поиск
Список
Период
Сортировка
От Rajesh Kumar Mallah.
Тема Re: SERIAL Field
Дата
Msg-id 200205061856.10924.mallah@trade-india.com
обсуждение исходный текст
Ответ на SERIAL Field  ("Gaetano Mendola" <mendola@bigfoot.com>)
Ответы Re: SERIAL Field
Список pgsql-admin
Hi Gaetano,

Postgresql implements serial field using sequences.

detailed description of sequences are avaliable at
http://www.postgresql.org/idocs/index.php?functions-sequence.html


a NICE flash tutorial is also available at:
http://techdocs.postgresql.org/college/001_sequences/

the specific answer to your question is the function "currval(sequence_name)"
can be used.
you can get the name of sequenced being used for the serial field by
describing the table (\d tablename).

But the very idea of inserting the value and then retriving the sequence
number sounds fishy to me. Why not get the sequence number first and than
insert using that seqnce number (more on the flash tutorial ).


regds
mallah.


On Monday 06 May 2002 04:16 pm, Gaetano Mendola wrote:
> Hi all,
>
> having a table with a serial field what is the corrected method
> to retrieve the value after an insert ?
>
>
>
>
> Ciao
> Gaetano

--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.



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

Предыдущее
От: "Joel Burton"
Дата:
Сообщение: Re: SERIAL Field
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Dying PostgreSQL backend