Re: SERIAL Field

Поиск
Список
Период
Сортировка
Искать
От
Rajesh Kumar Mallah.
Тема
Re: SERIAL Field
Дата
в 10:10:41
Msg-id
200205061856.10924.mallah@trade-india.com
Ответ на
SERIAL Field (Gaetano Mendola)
Список
Дерево обсуждения
Re: SERIAL Field Brian McCane <bmccane@mccons.net>
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
FAQ