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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
Дата
Msg-id 15657.1360538559@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7865: Unexpected error code on insert of duplicate to composite primary key  (matti.aarnio@methics.fi)
Список pgsql-bugs
matti.aarnio@methics.fi writes:
> 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.

Works for me:

regression=# CREATE TABLE example (
regression(#    a   TIMESTAMP    NOT NULL,
regression(#    b   VARCHAR(256) NOT NULL,
regression(#    c   VARCHAR(256) NOT NULL,
regression(#    PRIMARY KEY(a,b,c)
regression(# );
CREATE TABLE
regression=# \set VERBOSITY verbose
regression=# insert into example values('today','today','foo');
INSERT 0 1
regression=# insert into example values('today','today','foo');
ERROR:  23505: duplicate key value violates unique constraint "example_pkey"
DETAIL:  Key (a, b, c)=(2013-02-10 00:00:00, today, foo) already exists.
SCHEMA NAME:  public
TABLE NAME:  example
CONSTRAINT NAME:  example_pkey
LOCATION:  _bt_check_unique, nbtinsert.c:398

I'm guessing you have a client-side problem, but since you've said
nothing about what the client-side software is, it's hard to venture
anything more detailed.

            regards, tom lane

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

Предыдущее
От: viswam mamilla
Дата:
Сообщение:
Следующее
От: John R Pierce
Дата:
Сообщение: Re: