From: Tom Lane <tgl@sss.pgh.pa.us>
To: Scott Cain <cain@cshl.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Cannot insert dup id in pk
Date: Tue, 15 Jul 2003 11:25:59 -0400
Message-ID: <22800.1058282759@sss.pgh.pa.us> (raw)
In-Reply-To: <1058274025.1451.6.camel@localhost.localdomain>
References: <1058274025.1451.6.camel@localhost.localdomain>
Scott Cain <cain@cshl.org> writes:
> Note that I do not try to insert anything into fid, the primary key on
> this table. Why does Postgres think I am?
But you *are* trying to insert something into fid, namely the default
value:
default nextval('public.fdata _fid_seq'::text)
My guess is that you have been inconsistent about whether you used the
sequence or explicit assignment to fid, and now you have some rows in
the table that have fid values higher than the current sequence value.
I'd suggest adjusting the sequence, along the lines of
SELECT setval('public.fdata _fid_seq', max(fid)+1) FROM fdata;
regards, tom lane
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: tgl@sss.pgh.pa.us, cain@cshl.org
Subject: Re: Cannot insert dup id in pk
In-Reply-To: <22800.1058282759@sss.pgh.pa.us>
* 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