aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/heapam_handler.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-01-07 14:23:25 -0500
committerRobert Haas <rhaas@postgresql.org>2020-01-07 14:23:25 -0500
commit83322e38da1aa054e1b144cb37e6074a86854199 (patch)
tree5237d3c2080280646d010936d816fc586be72311 /src/backend/access/heap/heapam_handler.c
parent814727858918154bdde9dbdfb99c544b52eb8818 (diff)
downloadpostgresql-83322e38da1aa054e1b144cb37e6074a86854199.tar.gz
postgresql-83322e38da1aa054e1b144cb37e6074a86854199.zip
tableam: Allow choice of toast AM.
Previously, the toast table had to be implemented by the same AM that was used for the main table, which was bad, because the detoasting code won't work with anything but heap. This commit doesn't fix the latter problem, although there's another patch coming which does, but it does let you pick something that works (i.e. heap, right now). Patch by me, reviewed by Andres Freund. Discussion: http://postgr.es/m/CA+TgmoZv-=2iWM4jcw5ZhJeL18HF96+W1yJeYrnGMYdkFFnEpQ@mail.gmail.com
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r--src/backend/access/heap/heapam_handler.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index a6c369eaea7..1ed60f4f4e5 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -2037,6 +2037,15 @@ heapam_relation_needs_toast_table(Relation rel)
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
@@ -2535,6 +2544,7 @@ static const TableAmRoutine heapam_methods = {
.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,