Commit b8dd19af authored by Robert Haas's avatar Robert Haas

Improve INSERT .. ON CONFLICT error message.

Peter Geoghegan, reviewed by me.
parent 869f693a
...@@ -535,8 +535,8 @@ ExecCheckIndexConstraints(TupleTableSlot *slot, ...@@ -535,8 +535,8 @@ ExecCheckIndexConstraints(TupleTableSlot *slot,
if (!indexRelation->rd_index->indimmediate) if (!indexRelation->rd_index->indimmediate)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("ON CONFLICT does not support deferred unique constraints/exclusion constraints as arbiters"), errmsg("ON CONFLICT does not support deferrable unique constraints/exclusion constraints as arbiters"),
errtableconstraint(heapRelation, errtableconstraint(heapRelation,
RelationGetRelationName(indexRelation)))); RelationGetRelationName(indexRelation))));
......
...@@ -643,7 +643,7 @@ INSERT INTO deferred_excl VALUES(1); -- fail ...@@ -643,7 +643,7 @@ INSERT INTO deferred_excl VALUES(1); -- fail
ERROR: conflicting key value violates exclusion constraint "deferred_excl_con" ERROR: conflicting key value violates exclusion constraint "deferred_excl_con"
DETAIL: Key (f1)=(1) conflicts with existing key (f1)=(1). DETAIL: Key (f1)=(1) conflicts with existing key (f1)=(1).
INSERT INTO deferred_excl VALUES(1) ON CONFLICT ON CONSTRAINT deferred_excl_con DO NOTHING; -- fail INSERT INTO deferred_excl VALUES(1) ON CONFLICT ON CONSTRAINT deferred_excl_con DO NOTHING; -- fail
ERROR: ON CONFLICT does not support deferred unique constraints/exclusion constraints as arbiters ERROR: ON CONFLICT does not support deferrable unique constraints/exclusion constraints as arbiters
BEGIN; BEGIN;
INSERT INTO deferred_excl VALUES(2); -- no fail here INSERT INTO deferred_excl VALUES(2); -- no fail here
COMMIT; -- should fail here COMMIT; -- should fail here
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment