Re: [BUGS] BUG #14739: Wrong message when unique contraint fail

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #14739: Wrong message when unique contraint fail
Дата
Msg-id 2054.1499703901@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [BUGS] BUG #14739: Wrong message when unique contraint fail  (fbd@datasapiens.com)
Список pgsql-bugs
fbd@datasapiens.com writes:
> I am testing PG on this query :
> CREATE TABLE T_UNIK (ID INT UNIQUE);
> INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5);
> UPDATE T_UNIK SET ID = ID + 1;

> I know that PG is unable to do this set based operation properly because it
> does it row by row (which is a nonsense since it works on many RDBMS)

The solution for that is documented: declare the unique constraint as
deferrable.

regression=# CREATE TABLE T_UNIK (ID INT UNIQUE deferrable );
CREATE TABLE
regression=# INSERT INTO T_UNIK VALUES (1), (2), (3), (4), (5);
INSERT 0 5
regression=# UPDATE T_UNIK SET ID = ID + 1;
UPDATE 5

> But the error message is strongly stupid :
> ERROR:  invalid byte sequence for encoding "UTF8": 0xe9 0x71 0x75

I don't get that here.  It looks like you must be typing some non-ASCII
characters and not everything is on the same page about what encoding
they are in.
        regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [BUGS] BUG #14739: Wrong message when unique contraint fail
Следующее
От: Devrim Gündüz
Дата:
Сообщение: Re: [BUGS] postgresql 96 for Centos 7 download not found