Re: how to reset the sequences of SERIAL vars?
От | Shridhar Daithankar |
---|---|
Тема | Re: how to reset the sequences of SERIAL vars? |
Дата | |
Msg-id | 3DC2A269.24192.914266C@localhost обсуждение исходный текст |
Ответ на | how to reset the sequences of SERIAL vars? (Bruno Boettcher <bboett@bboett.dyndns.org>) |
Список | pgsql-general |
On 1 Nov 2002 at 10:59, Bruno Boettcher wrote: > when inserting from backup the tables are filled with all fields, this > means alos those defined as serial, but without using nextval... > > this means that the sequences for those vars are out of synch with the > table after the backup... > > now there was a sequence to set this up and runnign again, but i cna't > find it in my papers anymore, so if someone could kindly point me out > on how to set up the correct values un the sequence i will be really > grateful. From createsequence.html in postgresql manual --------------------------------------- Update the sequence value after a COPY FROM: BEGIN; COPY distributors FROM 'input_file'; SELECT setval('serial', max(id)) FROM distributors; END; --------------------------------------- Also look at functions-sequence.html for more reference. HTH Bye Shridhar -- Barometer, n.: An ingenious instrument which indicates what kind of weather we are having. -- Ambrose Bierce, "The Devil's Dictionary"
В списке pgsql-general по дате отправления: