From 0ad41cf537ea5f076273fcffa4c83a184bd9910f Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 14 Jan 2019 19:25:19 -0300 Subject: Fix unique INCLUDE indexes on partitioned tables We were considering the INCLUDE columns as part of the key, allowing unicity-violating rows to be inserted in different partitions. Concurrent development conflict in eb7ed3f30634 and 8224de4f42cc. Reported-by: Justin Pryzby Discussion: https://postgr.es/m/20190109065109.GA4285@telsasoft.com --- src/backend/commands/indexcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/indexcmds.c') diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index d2639036223..c8c64d9a425 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -721,7 +721,7 @@ DefineIndex(Oid relationId, errdetail("%s constraints cannot be used when partition keys include expressions.", constraint_type))); - for (j = 0; j < indexInfo->ii_NumIndexAttrs; j++) + for (j = 0; j < indexInfo->ii_NumIndexKeyAttrs; j++) { if (key->partattrs[i] == indexInfo->ii_IndexAttrNumbers[j]) { -- cgit v1.2.3