Re: serial autoincrement and related table
От | Paul Thomas |
---|---|
Тема | Re: serial autoincrement and related table |
Дата | |
Msg-id | 20040517123133.A13721@bacon обсуждение исходный текст |
Ответ на | serial autoincrement and related table (Milos Prudek <prudek@bvx.cz>) |
Ответы |
Re: serial autoincrement and related table
|
Список | pgsql-general |
On 17/05/2004 11:24 Milos Prudek wrote: > Cmd = "INSERT INTO members ... VALUES (...);" 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 DEFAULT nextval('members_idmember_seq') defined on the idmember column). > Cmd = "SELECT currval('members_idmember_seq') FROM members LIMIT 1;" Should be : Cmd = "SELECT currval('members_idmember_seq');" Remember that there's no such thing as auto-increment fields in PostgreSQL - they are SEQUENCES. -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+
В списке pgsql-general по дате отправления: