Re: Sequence Current Value Resetting

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Douglas Doolittle <DDoolittle(at)nbbc(dot)edu>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Sequence Current Value Resetting
Date: 2006-04-11 01:18:34
Message-ID: 70C328AB-415E-494B-A896-794EEECBDD09@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


On Apr 4, 2006, at 2:02 PM, Douglas Doolittle wrote:

> Twice a year we import class information into table class. My
> first time doing this was with the spring import in August and the
> import failed because the Current Value was less than the Max ID in
> the table. I changed the Current Value to the Max ID and was able
> to do the import. After the import, the new Current Value matched
> the Max ID and I thought I had solved my problem. I did not expect
> any problem today when I when to do the fall import. I was unable
> to do the import and discovered that the Current Value was 156 less
> than the Max ID. I advanced the current value to 21557, was able
> to import 276 rows, and the current value properly became 21832.
> Any thoughts as to why this value keeps “slipping?” Thanks.

I doubt there is anything wrong with the sequence. Do the records you
are importing already have an which could be coming from somewhere
other than the sequence you mentioned? If the imported records have a
value for this column, the sequence will not be advanced. Are you
doing inserts anywhere where the ID value is provided rather than
using the sequence value?

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message John DeSoi 2006-04-11 01:20:19 Re: how to encrypt trigger function
Previous Message Alan Hodgson 2006-04-11 01:04:03 Re: PostgreSQL a slow DB?