[BUGS] ON CONFLICT with constraint name doesn't work
От | Nikolay Samokhvalov |
---|---|
Тема | [BUGS] ON CONFLICT with constraint name doesn't work |
Дата | |
Msg-id | CANNMO++7+uVMj+ZPGKB_zuRpKE0sNthy2Z-_oKSS=oE3_rN7QA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: [BUGS] ON CONFLICT with constraint name doesn't work
Re: [BUGS] ON CONFLICT with constraint name doesn't work |
Список | pgsql-bugs |
Hi,
I'm trying to explicitly use the constraint name of my UNIQUE INDEX but it doesn't work (Postgres 9.6.2):
[local]:5432 nikolay@test=# create table constr(id serial, msg text);
CREATE TABLE
[local]:5432 nikolay@test=# create unique index i_constr_msg on constr using btree(md5(msg));
CREATE INDEX
[local]:5432 nikolay@test=# insert into constr (msg) values ('hoho') on conflict on constraint i_constr_msg do nothing;
ERROR: constraint "i_constr_msg" for table "constr" does not exist
[local]:5432 nikolay@test=# \d constr
Table "public.constr"
Column | Type | Modifiers
--------+---------+-----------------------------------------------------
id | integer | not null default nextval('constr_id_seq'::regclass)
msg | text |
Indexes:
"i_constr_msg" UNIQUE, btree (md5(msg))
This works:
[local]:5432 nikolay@test=# insert into constr (msg) values ('hoho') on conflict (md5(msg)) do nothing;
INSERT 0 1
I don't see anything in the current docs https://www.postgresql.org/docs/9.6/static/sql-insert.html saying that I cannot use the unique index' name here. So it definitely looks like a bug.
В списке pgsql-bugs по дате отправления: