Re: CLUSTER on partitioned index - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: CLUSTER on partitioned index
Date
Msg-id 202203311054.fk6zeitz4nq5@alvherre.pgsql
Whole thread Raw
In response to Re: CLUSTER on partitioned index  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: CLUSTER on partitioned index  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
I realized after posting that we used to allow clustering toast tables,
but after my changes we no longer do.  (Justin's version had a
RELKIND_HAS_STORAGE test here instead, which seemed a little too lax.) I
don't know why we allowed it and I don't know of anyone who has ever
used that feature and we don't have any test coverage for it, but I
don't have any reason to explicitly disallow it either.  So I propose to
continue to allow it:

>From 05ba6124422fb7c2fd19575e905e444ba3eef1e5 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 31 Mar 2022 12:49:57 +0200
Subject: [PATCH] allow to cluster toast tables

---
 src/backend/commands/cluster.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 8417cbdb67..b391d7c434 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -451,7 +451,8 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
     }
 
     Assert(OldHeap->rd_rel->relkind == RELKIND_RELATION ||
-           OldHeap->rd_rel->relkind == RELKIND_MATVIEW);
+           OldHeap->rd_rel->relkind == RELKIND_MATVIEW ||
+           OldHeap->rd_rel->relkind == RELKIND_TOASTVALUE);
 
     /*
      * All predicate locks on the tuples or pages are about to be made
-- 
2.30.2

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Java is clearly an example of money oriented programming"  (A. Stepanov)



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: document the need to analyze partitioned tables
Next
From: Alvaro Herrera
Date:
Subject: Re: Commitfest Update