pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Jesper Pedersen <jesper.pedersen@redhat.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: unique indexes on partitioned tables
Date: Tue, 13 Feb 2018 22:58:35 -0500
Message-ID: <d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com> (raw)
In-Reply-To: <20180212202615.q33ula7dpeyti2ee@alvherre.pgsql>
References: <20180212202615.q33ula7dpeyti2ee@alvherre.pgsql>

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              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 69fbe467e554f6f70195d0f40898eba62ddb9641 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
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 b/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>
      <para>
       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 b/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>
      </para>
 
      <para>
-      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.
      </para>
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, parentConstraintId);
 		recordDependencyOn(&referenced, &third, DEPENDENCY_INTERNAL_AUTO);
-- 
2.16.1

Attachments:

  [text/plain] 0001-fixup-allow-indexes-on-partitioned-tables-to-be-uniq.patch (2.3K, ../d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com/2-0001-fixup-allow-indexes-on-partitioned-tables-to-be-uniq.patch)
  download | inline diff:
From 69fbe467e554f6f70195d0f40898eba62ddb9641 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
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 b/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>
      <para>
       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 b/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>
      </para>
 
      <para>
-      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.
      </para>
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, parentConstraintId);
 		recordDependencyOn(&referenced, &third, DEPENDENCY_INTERNAL_AUTO);
-- 
2.16.1

view thread (21+ messages)  latest in thread

Message-ID: <d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com>
Permalink:  ../d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com/
Also on:    postgresql.org/message-id/d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, alvherre@alvh.no-ip.org, jesper.pedersen@redhat.com, Langote_Amit_f8@lab.ntt.co.jp
  Subject: Re: unique indexes on partitioned tables
  In-Reply-To: <d3e5cfa4-15aa-48a4-7b9e-49825a35b75c@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox