Unique constaint violated without being violated

Поиск
Список
Период
Сортировка
От Sebastian Tennant
Тема Unique constaint violated without being violated
Дата
Msg-id zlj9qq6j.fsf@vps203.linuxvps.org
обсуждение исходный текст
Ответы Re: Unique constaint violated without being violated  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-general
Hi all,

Here's an odd one:

 itidb=> \d joblist;
                   Table "public.joblist"
       Column       |           Type           | Modifiers
 -------------------+--------------------------+-----------
  full_name         | character varying(64)    | not null
  email_address     | character varying(64)    | not null
  username          | character varying(12)    |
  password          | character varying(12)    |
  recruiter         | boolean                  | not null
  subscribed        | boolean                  | not null
  verified          | boolean                  | not null
  created_at        | timestamp with time zone | not null
  updated_at        | timestamp with time zone | not null
  verification_code | character varying(24)    |
  alumni            | boolean                  |
 Indexes:
     "joblist_pkey" PRIMARY KEY, btree (email_address)
     "joblist_username_key" UNIQUE, btree (username)

 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?

Is my database corrupted somehow, or am I just losing my mind?

What course of action do you suggest I follow?

Sebastian

P.S. I've checked three times now, and I'm definitely using the same
     email address in the update command and the select command, i.e., a
     typo is not what's causing this.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: visibility map - what do i miss?
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Unique constaint violated without being violated