From: Jamie Tufnell <diesql@googlemail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Insert problem
Date: Mon, 10 Mar 2008 00:14:12 +0000
Message-ID: <b0a4f3350803091714n2b89425ev48410eb86451b973@mail.gmail.com> (raw)
In-Reply-To: <47D4507D.8010709@lota.us>
References: <47D4507D.8010709@lota.us>
On 3/9/08, A. R. Van Hook <hook@lota.us> wrote:
> The script worked fine untill I tried in on the following entries:
>
> 1841 | 2 | 9228 : Caty Case : SO:Bra:.....
> 1841 | 3 | 9621 : Kelsie Greenlee : PROM.....
>
> 2072 | 3 | null : Cookie Jared Cook :..........
> 2072 | 4 | null : Cookie Jared Cook :........
> 2072 | 5 | null : Cookie Jared Cook :........
>
> insert into schItem (scid, value, iflag, outalts, sidate, istid)
>
> ERROR: duplicate key violates unique constraint "schitem_pkey"
>
> table defination
>
> create sequence schItem_item_seq
> create table schItem
> (scid int NOT NULL references schedule ON DELETE CASCADE,
> item int NOT NULL default nextval('schItem_item_seq'),
[snip]
It looks like there's already a row where scid=2072 and
item=nextval('schItem_item_seq').
Try:
SELECT setval('schItem_item_seq', (SELECT max(item)+1 FROM schItem));
And then run your query again.
Cheers,
J.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: diesql@googlemail.com
Subject: Re: Insert problem
In-Reply-To: <b0a4f3350803091714n2b89425ev48410eb86451b973@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox