1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

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
This commit is contained in:
Robert Haas
2019-05-21 11:57:13 -04:00
parent cf92226e9f
commit 1171d7d585
3 changed files with 76 additions and 47 deletions

View File

@@ -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
* ----------------------------------------------------------------------------