mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
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
This commit is contained in:
@ -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,
|
||||
|
||||
|
Reference in New Issue
Block a user