aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/tableam.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2019-05-21 11:57:13 -0400
committerRobert Haas <rhaas@postgresql.org>2019-05-21 11:57:13 -0400
commit1171d7d58545f26a402f76a05936d572bf29d53b (patch)
tree5850b9d8f0ad037579c1f39d91fbae972b9b4825 /src/include/access/tableam.h
parentcf92226e9f7f985a678287167b954a831a3b660c (diff)
downloadpostgresql-1171d7d58545f26a402f76a05936d572bf29d53b.tar.gz
postgresql-1171d7d58545f26a402f76a05936d572bf29d53b.zip
tableam: Move heap-specific logic from needs_toast_table below tableam.
This allows table AMs to completely suppress TOAST table creation, or to modify the conditions under which they are created. Patch by me. Reviewed by Andres Freund. Discussion: http://postgr.es/m/CA+Tgmoa4O2n=yphqD2pERUnYmUO84bH1SqMsA-nSxBGsZ7gWfA@mail.gmail.com
Diffstat (limited to 'src/include/access/tableam.h')
-rw-r--r--src/include/access/tableam.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 06eae2337a3..53b58c51da2 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -573,6 +573,16 @@ typedef struct TableAmRoutine
uint64 (*relation_size) (Relation rel, ForkNumber forkNumber);
+ /*
+ * This callback should return true if the relation requires a TOAST table
+ * and false if it does not. It may wish to examine the relation's
+ * tuple descriptor before making a decision, but if it uses some other
+ * method of storing large values (or if it does not support them) it can
+ * simply return false.
+ */
+ bool (*relation_needs_toast_table) (Relation rel);
+
+
/* ------------------------------------------------------------------------
* Planner related functions.
* ------------------------------------------------------------------------
@@ -1585,6 +1595,16 @@ table_relation_size(Relation rel, ForkNumber forkNumber)
return rel->rd_tableam->relation_size(rel, forkNumber);
}
+/*
+ * table_needs_toast_table - does this relation need a toast table?
+ */
+static inline bool
+table_relation_needs_toast_table(Relation rel)
+{
+ return rel->rd_tableam->relation_needs_toast_table(rel);
+}
+
+
/* ----------------------------------------------------------------------------
* Planner related functionality
* ----------------------------------------------------------------------------