Re: Duplicated entries are not ignored even if a "do instead nothing" rule is added.

Поиск
Список
Период
Сортировка
От Jon Nelson
Тема Re: Duplicated entries are not ignored even if a "do instead nothing" rule is added.
Дата
Msg-id CAKuK5J3wJ4-nTiJPqKfcMrCUnAxc_-1OyADovFQ3mw56maJZ1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Duplicated entries are not ignored even if a "do instead nothing" rule is added.  (邓尧 <torshie@gmail.com>)
Ответы Re: Duplicated entries are not ignored even if a "do instead nothing" rule is added.  (邓尧 <torshie@gmail.com>)
Список pgsql-general
On Sun, Jan 8, 2012 at 7:13 PM, 邓尧 <torshie@gmail.com> wrote:
> I have enabled the autocommit feature of psycopg2, and removed all the
> transactions in source code, also changed the sql statement to the
> following:
>
> insert into ACCOUNT(HOME)
>     select "v1" as HOME
>     where not exists (select 1 from ACCOUNT where HOME = "v1")
>
> Surprisingly, I still got the unique constraint violation error, but much
> fewer than before ( only 3 during the last 3 days).
> Any suggestions? Could it be a bug in psycopg2 or postgresql?

Presumably, you need to add a distinct.
insert into ... select DISTINCT .... where not exists.


--
Jon

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Time to move table to new tablespace
Следующее
От: Ondrej Ivanič
Дата:
Сообщение: Re: Time to move table to new tablespace