Here is a mini-patch on top of yours to fix a few cosmetic things.

I don't understand the variable name "third".  I don't see a "first" or
"second" nearby.

I find some of the columns in pg_constraint confusing.  For a primary
key on a partitioned table, for the PK on the partition I get

conislocal = false, coninhcount = 1, connoinherit = true

The last part is confusing to me.

I don't know if that's really on this patch.  But perhaps it could be
documented better.

Peter Eisentraut    
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From 69fbe467e554f6f70195d0f40898eba62ddb9641 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <>
Date: Tue, 13 Feb 2018 22:53:55 -0500
Subject: [PATCH] fixup! allow indexes on partitioned tables to be unique

 doc/src/sgml/ref/alter_table.sgml  | 5 ++---
 doc/src/sgml/ref/create_table.sgml | 3 +--
 src/backend/catalog/index.c        | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/ref/alter_table.sgml 
index 2d3b6d3960..5be56d4b28 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -839,9 +839,8 @@ <title>Description</title>
       This form attaches an existing table (which might itself be partitioned)
       as a partition of the target table. The table can be attached
-      as a partition for specific values using <literal>FOR VALUES
-      </literal> or as a default partition by using
-      <literal>DEFAULT</literal>.
+      as a partition for specific values using <literal>FOR VALUES</literal>
+      or as a default partition by using <literal>DEFAULT</literal>.
       For each index in the target table, a corresponding
       one will be created in the attached table; or, if an equivalent
       index already exists, will be attached to the target table's index,
diff --git a/doc/src/sgml/ref/create_table.sgml 
index 83d3472da2..b7bf7bc1c8 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -546,8 +546,7 @@ <title>Parameters</title>
-      Partitioned tables do not support
-      <literal>EXCLUDE</literal>, or
+      Partitioned tables do not support <literal>EXCLUDE</literal> or
       <literal>FOREIGN KEY</literal> constraints; however, you can define
       these constraints on individual partitions.
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index a5fa3540a7..5fb50a3a0e 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1325,7 +1325,7 @@ index_constraint_create(Relation heapRelation,
        if (OidIsValid(parentConstraintId))
-               ObjectAddress   third;
+               ObjectAddress   third; // ???
                ObjectAddressSet(third, ConstraintRelationId, 
                recordDependencyOn(&referenced, &third, 

Reply via email to