Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
Дата
Msg-id 5118DFDB.4080103@vmware.com
обсуждение исходный текст
Ответ на BUG #7865: Unexpected error code on insert of duplicate to composite primary key  (matti.aarnio@methics.fi)
Ответы Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key  (Matti Aarnio <matti.aarnio@methics.fi>)
Список pgsql-bugs
On 09.02.2013 22:25, matti.aarnio@methics.fi wrote:
> CREATE TABLE example (
>     a   TIMESTAMP    NOT NULL,
>     b   VARCHAR(256) NOT NULL,
>     c   VARCHAR(256) NOT NULL,
>     PRIMARY KEY(a,b,c)
> );
>
> Inserting a duplicate record on this is returning an SQL Error, but the
> status code is 0 instead of expected 23505.
>
> This used to work fine in 8.x series, but is now causing trouble in 9.1.7,
> and 9.2.3.

Works for me:

postgres=# do $$
begin
   insert into example values ('2001-01-01', 'foo', 'bar');
   insert into example values ('2001-01-01', 'foo', 'bar');
exception
   when others then raise notice 'caught %', sqlstate;
end;
$$;
NOTICE:  caught 23505
DO

How exactly are you seeing the wrong status code? What client are you using?

- Heikki

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re:
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key