Re: error: duplicate key

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Marc Fromm <Marc(dot)Fromm(at)wwu(dot)edu>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: error: duplicate key
Date: 2009-06-17 17:09:46
Message-ID: dcc563d10906171009h56e02afm56ca3ac16733a6cb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Jun 17, 2009 at 10:51 AM, Marc Fromm<Marc(dot)Fromm(at)wwu(dot)edu> wrote:
> I am receiving this error when I try to add new records:
>
> INSERT INTO "public"."classification_guide_cats" ("id", "cat_title") VALUES
> (nextval(('"classification_guide_cat_id_seq"'::text)::regclass), 'temp')
>
> SQL error:
>
> ERROR:  duplicate key violates unique constraint
> "classification_guide_cats_pkey"
>
> id is a primary key
> nextval(('"classification_guide_job_id_seq"'::text)::regclass)
>
> Could the primary key count have been reset so that it is starting at 1
> again? The primary key id is up to 128.

What does

select * from classification_guide_cat_id_seq;

say? Also, what's the DDL for creating this table? You can get it
with pg_dump -s -t tablename

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Marc Fromm 2009-06-17 17:48:40 Re: error: duplicate key
Previous Message Marc Fromm 2009-06-17 16:51:49 error: duplicate key