Resetting Serial Column Sequence Number

Поиск
Список
Период
Сортировка
От Adam
Тема Resetting Serial Column Sequence Number
Дата
Msg-id 000b01c6ef48$c3029d10$0200a8c0@PANASONIULSWMR
обсуждение исходный текст
Ответ на Versioning/updating schema  ("Jan Cruz" <malebug@gmail.com>)
Ответы Re: Resetting Serial Column Sequence Number  (Andreas Kretschmer <akretschmer@spamfence.net>)
Список pgsql-general
I just emptied my table and I want all my new inserts to start with a 'location_id' of '1'.  The table is named "locations" with a SERIAL column "location_id"
 
I tried the below SQL to rest the sequence ID but it's not working.  What am I doing wrong?
 
SELECT setval('locations_location_id_seq', (SELECT max(location_id) + 1 FROM locations));

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

Предыдущее
От: "Jan Cruz"
Дата:
Сообщение: Re: Versioning/updating schema
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Resetting Serial Column Sequence Number