Re: view table pkey values

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Scott Frankel <leknarf(at)pacbell(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: view table pkey values
Date: 2009-08-24 16:48:39
Message-ID: 4A92C467.1070308@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 24/08/2009 17:31, Scott Frankel wrote:
> The insert that yields the error seems innocuous enough:
>
> INSERT INTO foo (color_id, ordinal, person_id) VALUES (1, 1019, 2);
>
> It seems as if there's a sequence (foo_pkey) that's got some weird
> values in it. The table itself looks like this:
>
>
> CREATE TABLE foo (
> foo_id SERIAL PRIMARY KEY,

If the sequence's current value is lower than the highest foo_id in the
table, then you'll get collisions - I'd imagine that's what's happening
to you. You can fix that by using setval() to set the sequence value to
a number higher than any currently in foo_id.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Frankel 2009-08-24 17:37:45 Re: view table pkey values
Previous Message james bardin 2009-08-24 16:45:44 warm standby and reciprocating failover