Re: functions, transactions, key violations - Mailing list pgsql-general

From Ioannis Tambouras
Subject Re: functions, transactions, key violations
Date
Msg-id 20080605132538.GA6342@akroninc.net
Whole thread Raw
In response to functions, transactions, key violations  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
 Apart from concurrency issues, it is possible that you
have sequence generation problems. Depending on how
you inserted the original rows into the 'purchases' table, it is possible
that the nextval number has not kept-up and is lagging behind.

 You need to ensure that 'purchases_purchase_id_seq' is pointing
to the correct next value! That is, if it is current nextval
is number 100, but you already have 110 rows on the table (without gaps),
it is no wonder you will receive primary key violations for the
next 10 inserts but will work fine afterwards. ( Assuming, of course,
you are the only one receiving values from the sequence.)


 Thanks
 Ioannis Tambouras

pgsql-general by date:

Previous
From: "Richard Broersma"
Date:
Subject: Re: Tripping up on my first attempt at building PG from source
Next
From: Tino Wildenhain
Date:
Subject: Re: How can I compare sql create script with running database?