From 353fcc4773cd81f526adeae263d51e903411ca96 Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <peter.geoghegan86@gmail.com>
Date: Sun, 11 Oct 2015 15:55:21 -0700
Subject: [PATCH 1/2] Adjust deferrable constraints error message

The previous message indicated that deferred constraints were
unsupported, which might be interpreted to mean that ON CONFLICT
supported deferrable constraints provided immediate mode enforcement was
used.  Make it clear that ON CONFLICT does not support DEFERRABLE
INITIALLY IMMEDIATE constraints (or any kind of deferrable constraint).
---
 src/backend/executor/execIndexing.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c
index f42bd8f..7299329 100644
--- a/src/backend/executor/execIndexing.c
+++ b/src/backend/executor/execIndexing.c
@@ -535,8 +535,8 @@ ExecCheckIndexConstraints(TupleTableSlot *slot,
 
 		if (!indexRelation->rd_index->indimmediate)
 			ereport(ERROR,
-					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("ON CONFLICT does not support deferred unique constraints/exclusion constraints as arbiters"),
+					(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+					 errmsg("ON CONFLICT does not support deferrable unique constraints/exclusion constraints as arbiters"),
 					 errtableconstraint(heapRelation,
 								   RelationGetRelationName(indexRelation))));
 
-- 
1.9.1

