Re: "Cannot insert a duplicate key..." -- but where?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: "Cannot insert a duplicate key..." -- but where?
Дата
Msg-id 23502.1044588936@sss.pgh.pa.us
обсуждение исходный текст
Ответ на "Cannot insert a duplicate key..." -- but where?  (will trillich <will@serensoft.com>)
Ответы Re: "Cannot insert a duplicate key..." -- SOLVED
Список pgsql-general
will trillich <will@serensoft.com> writes:
> in trying to UPDATE a linking-table record (the middle-man in a
> many-to-many relationship) i've encountered an "ERROR:  Cannot
> insert a duplicate key into unique index _relations_p_r_v_ix"

I tried to duplicate this, and got:

...
regression-# relation.relative   = r.id AND r.lname = 'b' and
regression-# relation.relation_v = t.id AND t.name  = 'Family';
UPDATE 1
regression=#

I think there's something you left out.

Given that you tested the WHERE clause by making an equivalent SELECT,
I don't believe that the UPDATE is trying to update more than one row.
It seems more likely that you overlooked a uniqueness conflict against
some other existing row.

            regards, tom lane

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

Предыдущее
От: "kanchana"
Дата:
Сообщение: Re: start error - pgsql
Следующее
От: Neil Conway
Дата:
Сообщение: Re: PGconn thread safety