Re: serial autoincrement and related table

Поиск
Список
Период
Сортировка
От Milos Prudek
Тема Re: serial autoincrement and related table
Дата
Msg-id 40A8A797.4000708@bvx.cz
обсуждение исходный текст
Ответ на Re: serial autoincrement and related table  (Paul Thomas <paul@tmsl.demon.co.uk>)
Список pgsql-general
 > If you want PostgreSQL to populate your idmember field with the next
 > value from the sequence, you need to specify the keyword DEFAULT as its
 > value or omit it from the INSERT list of coulumns (this assumes you have

I do omit it.

 > DEFAULT nextval('members_idmember_seq') defined on the idmember column).

I use CREATE TABLE "members" (idmember" SERIAL PRIMARY KEY, ...);

 > Should be :
 >
 > Cmd = "SELECT currval('members_idmember_seq');"

Ah, thanks for the shorter syntax.

 > Remember that there's no such thing as auto-increment fields in
 > PostgreSQL - they are SEQUENCES.

I know.

So, it's the best or reasonable practice(TM), isn't it?

--
Milos Prudek


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

Предыдущее
От: Paul Thomas
Дата:
Сообщение: Re: serial autoincrement and related table
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: serial autoincrement and related table