Avoid creating a TOAST table for a partitioned table.
authorRobert Haas <rhaas@postgresql.org>
Thu, 22 Mar 2018 17:49:38 +0000 (13:49 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 22 Mar 2018 17:49:38 +0000 (13:49 -0400)
It's useless.

Amit Langote

Discussion: http://postgr.es/m/b4c9dee6-d134-49b8-79c4-07fbd7c3b898@lab.ntt.co.jp

src/backend/catalog/toasting.c

index c4515e6c1d188ad7539afbfb4f906161828a7efa..9007dc6ebe54f04df5691e287914dffcdcdbeb01 100644 (file)
@@ -397,6 +397,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)
@@ -408,6 +409,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++)