Search Postgresql Archives

Resetting Serial Column Sequence Number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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));

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux