v1-0001-Do-not-create-TOAST-table-for-partitioned-tables.patch

text/plain

Filename: v1-0001-Do-not-create-TOAST-table-for-partitioned-tables.patch
Type: text/plain
Part: 0
Message: TOAST table created for partitioned tables

Patch

Format: format-patch
Series: patch v1-0001
Subject: Do not create TOAST table for partitioned tables
File+
src/backend/catalog/toasting.c 4 0
From b84ee9f5aed9519d5976dc1a6c8f501d0122a686 Mon Sep 17 00:00:00 2001
From: amit <amitlangote09@gmail.com>
Date: Tue, 16 Jan 2018 19:08:11 +0900
Subject: [PATCH v1] Do not create TOAST table for partitioned tables

---
 src/backend/catalog/toasting.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c
index 0b4b5631a1..5e84f28201 100644
--- a/src/backend/catalog/toasting.c
+++ b/src/backend/catalog/toasting.c
@@ -393,6 +393,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
  * (1) there are any toastable attributes, and (2) the maximum length
  * of a tuple could exceed TOAST_TUPLE_THRESHOLD.  (We don't want to
  * create a toast table for something like "f1 varchar(20)".)
+ * No need to create a TOAST table for partitioned tables.
  */
 static bool
 needs_toast_table(Relation rel)
@@ -404,6 +405,9 @@ needs_toast_table(Relation rel)
 	int32		tuple_length;
 	int			i;
 
+	if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
+		return false;
+
 	tupdesc = rel->rd_att;
 
 	for (i = 0; i < tupdesc->natts; i++)
-- 
2.11.0