Re: Unique constaint violated without being violated

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Sebastian Tennant" <sebyte(at)smolny(dot)plus(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unique constaint violated without being violated
Date: 2008-12-06 15:36:01
Message-ID: b42b73150812060736h6d624b21gb31c8dcd8a089990@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Dec 6, 2008 at 10:27 AM, Sebastian Tennant
<sebyte(at)smolny(dot)plus(dot)com> wrote:
> itidb=> update joblist set (full_name, email_address, recruiter,
> itidb(> subscribed, verified, created_at, updated_at) =
> itidb-> ('[name hidden]', '[email address hidden]', false, true
> itidb(> true, current_timestamp(0), current_timestamp(0));
> ERROR: duplicate key value violates unique constraint "joblist_pkey"
>
> itidb=> select * from joblist where
> itidb-> email_address='[email address hidden]';
> (No rows)
>
> email_address is the primary key of this table (because the manual says
> every table should have one :-) and the unique aspect of this primary
> key is being violated when I try to enter the (hidden) email address
> above.
>
> But the email address hasn't already been entered into this table, as
> shown by the output of the select command... so why the error?

It looks to me like you are setting the whole table to the same
address in the update statement (no where clause)...so of course you'd
get the error. Maybe you want to do an insert statement?

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2008-12-06 16:00:45 Re: visibility map - what do i miss?
Previous Message Sebastian Tennant 2008-12-06 15:27:48 Unique constaint violated without being violated