Re: AutoIncrement not working on this table only - Mailing list pgsql-novice

From Kassel Ben CRBE
Subject Re: AutoIncrement not working on this table only
Date
Msg-id 1F9F67162ADED3119F18009027A8F404025FC3A2@crbeex03.dt.navy.mil
Whole thread Raw
In response to AutoIncrement not working on this table only  ("Ben Kassel" <benk@ix.netcom.com>)
List pgsql-novice
A huge thank you to all who helped me solve my problem. To synopsize for those keeping a lessons learned:

The sequence table got out of sync with the with the column being sequenced. This was mot probably caused by reloading
dataimproperly without regard for the sequence generated value.  

The sequence can be resynced using the command:

select (setval('my_seq',max(my_col)) from my_table;

or in my case the actual command which solved the problem:

SELECT setval('datadef_datadefindex_seq',MAX(datadefindex)) from datadef;

later,
ben

pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Novice DB Schema question
Next
From: "Brian Johnson"
Date:
Subject: List sequence assigned to primary key