return (tuple_length > TOAST_TUPLE_THRESHOLD);
}
+/*
+ * TOAST tables for heap relations are just heap relations.
+ */
+static Oid
+heapam_relation_toast_am(Relation rel)
+{
+ return rel->rd_rel->relam;
+}
+
/* ------------------------------------------------------------------------
* Planner related callbacks for the heap AM
.relation_size = table_block_relation_size,
.relation_needs_toast_table = heapam_relation_needs_toast_table,
+ .relation_toast_am = heapam_relation_toast_am,
.relation_estimate_size = heapam_estimate_rel_size,
*/
bool (*relation_needs_toast_table) (Relation rel);
+ /*
+ * This callback should return the OID of the table AM that implements
+ * TOAST tables for this AM. If the relation_needs_toast_table callback
+ * always returns false, this callback is not required.
+ */
+ Oid (*relation_toast_am) (Relation rel);
+
/* ------------------------------------------------------------------------
* Planner related functions.
return rel->rd_tableam->relation_needs_toast_table(rel);
}
+/*
+ * Return the OID of the AM that should be used to implement the TOAST table
+ * for this relation.
+ */
+static inline Oid
+table_relation_toast_am(Relation rel)
+{
+ return rel->rd_tableam->relation_toast_am(rel);
+}
+
/* ----------------------------------------------------------------------------
* Planner related functionality