PostgreSQL Source Code  git master
toasting.c File Reference
#include "postgres.h"
#include "access/tuptoaster.h"
#include "access/xact.h"
#include "catalog/binary_upgrade.h"
#include "catalog/dependency.h"
#include "catalog/heap.h"
#include "catalog/index.h"
#include "catalog/namespace.h"
#include "catalog/pg_am.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_type.h"
#include "catalog/toasting.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "storage/lock.h"
#include "utils/builtins.h"
#include "utils/rel.h"
#include "utils/syscache.h"
Include dependency graph for toasting.c:

Go to the source code of this file.

Functions

static void CheckAndCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check)
 
static bool create_toast_table (Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check)
 
static bool needs_toast_table (Relation rel)
 
void AlterTableCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode)
 
void NewHeapCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode)
 
void NewRelationCreateToastTable (Oid relOid, Datum reloptions)
 
void BootstrapToastTable (char *relName, Oid toastOid, Oid toastIndexOid)
 

Variables

Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid
 

Function Documentation

◆ AlterTableCreateToastTable()

void AlterTableCreateToastTable ( Oid  relOid,
Datum  reloptions,
LOCKMODE  lockmode 
)

Definition at line 59 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by ATRewriteCatalogs().

60 {
61  CheckAndCreateToastTable(relOid, reloptions, lockmode, true);
62 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:77

◆ BootstrapToastTable()

void BootstrapToastTable ( char *  relName,
Oid  toastOid,
Oid  toastIndexOid 
)

Definition at line 95 of file toasting.c.

References AccessExclusiveLock, create_toast_table(), elog, ereport, errcode(), errmsg(), ERROR, heap_close, heap_openrv(), makeRangeVar(), NoLock, RelationData::rd_rel, RELKIND_MATVIEW, and RELKIND_RELATION.

96 {
97  Relation rel;
98 
99  rel = heap_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
100 
101  if (rel->rd_rel->relkind != RELKIND_RELATION &&
102  rel->rd_rel->relkind != RELKIND_MATVIEW)
103  ereport(ERROR,
104  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
105  errmsg("\"%s\" is not a table or materialized view",
106  relName)));
107 
108  /* create_toast_table does all the work */
109  if (!create_toast_table(rel, toastOid, toastIndexOid, (Datum) 0,
110  AccessExclusiveLock, false))
111  elog(ERROR, "\"%s\" does not require a toast table",
112  relName);
113 
114  heap_close(rel, NoLock);
115 }
#define RELKIND_MATVIEW
Definition: pg_class.h:165
int errcode(int sqlerrcode)
Definition: elog.c:575
#define heap_close(r, l)
Definition: heapam.h:97
Form_pg_class rd_rel
Definition: rel.h:114
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:126
#define ERROR
Definition: elog.h:43
#define NoLock
Definition: lockdefs.h:34
#define ereport(elevel, rest)
Definition: elog.h:122
uintptr_t Datum
Definition: postgres.h:372
Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: heapam.c:1318
#define AccessExclusiveLock
Definition: lockdefs.h:45
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define elog
Definition: elog.h:219
#define RELKIND_RELATION
Definition: pg_class.h:160
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:421

◆ CheckAndCreateToastTable()

static void CheckAndCreateToastTable ( Oid  relOid,
Datum  reloptions,
LOCKMODE  lockmode,
bool  check 
)
static

Definition at line 77 of file toasting.c.

References create_toast_table(), heap_close, heap_open(), InvalidOid, and NoLock.

Referenced by AlterTableCreateToastTable(), NewHeapCreateToastTable(), and NewRelationCreateToastTable().

78 {
79  Relation rel;
80 
81  rel = heap_open(relOid, lockmode);
82 
83  /* create_toast_table does all the work */
84  (void) create_toast_table(rel, InvalidOid, InvalidOid, reloptions, lockmode, check);
85 
86  heap_close(rel, NoLock);
87 }
#define heap_close(r, l)
Definition: heapam.h:97
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:126
#define NoLock
Definition: lockdefs.h:34
Relation heap_open(Oid relationId, LOCKMODE lockmode)
Definition: heapam.c:1290
#define InvalidOid
Definition: postgres_ext.h:36

◆ create_toast_table()

static bool create_toast_table ( Relation  rel,
Oid  toastOid,
Oid  toastIndexOid,
Datum  reloptions,
LOCKMODE  lockmode,
bool  check 
)
static

Definition at line 126 of file toasting.c.

References AccessExclusiveLock, Assert, binary_upgrade_next_toast_pg_class_oid, binary_upgrade_next_toast_pg_type_oid, BTREE_AM_OID, BYTEAOID, CatalogTupleUpdate(), ObjectAddress::classId, CommandCounterIncrement(), CreateTemplateTupleDesc(), CurrentMemoryContext, DEPENDENCY_INTERNAL, elog, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, GetTempToastNamespace(), heap_close, heap_create_with_catalog(), heap_freetuple(), heap_inplace_update(), heap_open(), HeapTupleIsValid, IndexInfo::ii_AmCache, IndexInfo::ii_BrokenHotChain, IndexInfo::ii_Concurrent, IndexInfo::ii_Context, IndexInfo::ii_ExclusionOps, IndexInfo::ii_ExclusionProcs, IndexInfo::ii_ExclusionStrats, IndexInfo::ii_Expressions, IndexInfo::ii_ExpressionsState, IndexInfo::ii_KeyAttrNumbers, IndexInfo::ii_NumIndexAttrs, IndexInfo::ii_Predicate, IndexInfo::ii_PredicateState, IndexInfo::ii_ReadyForInserts, IndexInfo::ii_Unique, index_create(), INDEX_CREATE_IS_PRIMARY, INT4_BTREE_OPS_OID, INT4OID, InvalidOid, IsBinaryUpgrade, IsBootstrapProcessingMode, isTempOrTempToastNamespace(), list_make2, makeNode, NAMEDATALEN, needs_toast_table(), NIL, NoLock, ObjectAddress::objectId, ObjectIdGetDatum, ObjectAddress::objectSubId, OID_BTREE_OPS_OID, OidIsValid, OIDOID, ONCOMMIT_NOOP, PG_TOAST_NAMESPACE, RelationData::rd_rel, recordDependencyOn(), RelationGetRelid, RelationIsMapped, RelationRelationId, RELKIND_TOASTVALUE, RELOID, RowExclusiveLock, SearchSysCacheCopy1, ShareLock, snprintf(), HeapTupleData::t_self, TupleDescAttr, and TupleDescInitEntry().

Referenced by BootstrapToastTable(), and CheckAndCreateToastTable().

128 {
129  Oid relOid = RelationGetRelid(rel);
130  HeapTuple reltup;
131  TupleDesc tupdesc;
132  bool shared_relation;
133  bool mapped_relation;
134  Relation toast_rel;
135  Relation class_rel;
136  Oid toast_relid;
137  Oid toast_typid = InvalidOid;
138  Oid namespaceid;
139  char toast_relname[NAMEDATALEN];
140  char toast_idxname[NAMEDATALEN];
141  IndexInfo *indexInfo;
142  Oid collationObjectId[2];
143  Oid classObjectId[2];
144  int16 coloptions[2];
145  ObjectAddress baseobject,
146  toastobject;
147 
148  /*
149  * Toast table is shared if and only if its parent is.
150  *
151  * We cannot allow toasting a shared relation after initdb (because
152  * there's no way to mark it toasted in other databases' pg_class).
153  */
154  shared_relation = rel->rd_rel->relisshared;
155  if (shared_relation && !IsBootstrapProcessingMode())
156  ereport(ERROR,
157  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
158  errmsg("shared tables cannot be toasted after initdb")));
159 
160  /* It's mapped if and only if its parent is, too */
161  mapped_relation = RelationIsMapped(rel);
162 
163  /*
164  * Is it already toasted?
165  */
166  if (rel->rd_rel->reltoastrelid != InvalidOid)
167  return false;
168 
169  /*
170  * Check to see whether the table actually needs a TOAST table.
171  */
172  if (!IsBinaryUpgrade)
173  {
174  /* Normal mode, normal check */
175  if (!needs_toast_table(rel))
176  return false;
177  }
178  else
179  {
180  /*
181  * In binary-upgrade mode, create a TOAST table if and only if
182  * pg_upgrade told us to (ie, a TOAST table OID has been provided).
183  *
184  * This indicates that the old cluster had a TOAST table for the
185  * current table. We must create a TOAST table to receive the old
186  * TOAST file, even if the table seems not to need one.
187  *
188  * Contrariwise, if the old cluster did not have a TOAST table, we
189  * should be able to get along without one even if the new version's
190  * needs_toast_table rules suggest we should have one. There is a lot
191  * of daylight between where we will create a TOAST table and where
192  * one is really necessary to avoid failures, so small cross-version
193  * differences in the when-to-create heuristic shouldn't be a problem.
194  * If we tried to create a TOAST table anyway, we would have the
195  * problem that it might take up an OID that will conflict with some
196  * old-cluster table we haven't seen yet.
197  */
200  return false;
201  }
202 
203  /*
204  * If requested check lockmode is sufficient. This is a cross check in
205  * case of errors or conflicting decisions in earlier code.
206  */
207  if (check && lockmode != AccessExclusiveLock)
208  elog(ERROR, "AccessExclusiveLock required to add toast table.");
209 
210  /*
211  * Create the toast table and its index
212  */
213  snprintf(toast_relname, sizeof(toast_relname),
214  "pg_toast_%u", relOid);
215  snprintf(toast_idxname, sizeof(toast_idxname),
216  "pg_toast_%u_index", relOid);
217 
218  /* this is pretty painful... need a tuple descriptor */
219  tupdesc = CreateTemplateTupleDesc(3, false);
220  TupleDescInitEntry(tupdesc, (AttrNumber) 1,
221  "chunk_id",
222  OIDOID,
223  -1, 0);
224  TupleDescInitEntry(tupdesc, (AttrNumber) 2,
225  "chunk_seq",
226  INT4OID,
227  -1, 0);
228  TupleDescInitEntry(tupdesc, (AttrNumber) 3,
229  "chunk_data",
230  BYTEAOID,
231  -1, 0);
232 
233  /*
234  * Ensure that the toast table doesn't itself get toasted, or we'll be
235  * toast :-(. This is essential for chunk_data because type bytea is
236  * toastable; hit the other two just to be sure.
237  */
238  TupleDescAttr(tupdesc, 0)->attstorage = 'p';
239  TupleDescAttr(tupdesc, 1)->attstorage = 'p';
240  TupleDescAttr(tupdesc, 2)->attstorage = 'p';
241 
242  /*
243  * Toast tables for regular relations go in pg_toast; those for temp
244  * relations go into the per-backend temp-toast-table namespace.
245  */
246  if (isTempOrTempToastNamespace(rel->rd_rel->relnamespace))
247  namespaceid = GetTempToastNamespace();
248  else
249  namespaceid = PG_TOAST_NAMESPACE;
250 
251  /*
252  * Use binary-upgrade override for pg_type.oid, if supplied. We might be
253  * in the post-schema-restore phase where we are doing ALTER TABLE to
254  * create TOAST tables that didn't exist in the old cluster.
255  */
257  {
260  }
261 
262  toast_relid = heap_create_with_catalog(toast_relname,
263  namespaceid,
264  rel->rd_rel->reltablespace,
265  toastOid,
266  toast_typid,
267  InvalidOid,
268  rel->rd_rel->relowner,
269  tupdesc,
270  NIL,
272  rel->rd_rel->relpersistence,
273  shared_relation,
274  mapped_relation,
275  true,
276  0,
278  reloptions,
279  false,
280  true,
281  true,
282  NULL);
283  Assert(toast_relid != InvalidOid);
284 
285  /* make the toast relation visible, else heap_open will fail */
287 
288  /* ShareLock is not really needed here, but take it anyway */
289  toast_rel = heap_open(toast_relid, ShareLock);
290 
291  /*
292  * Create unique index on chunk_id, chunk_seq.
293  *
294  * NOTE: the normal TOAST access routines could actually function with a
295  * single-column index on chunk_id only. However, the slice access
296  * routines use both columns for faster access to an individual chunk. In
297  * addition, we want it to be unique as a check against the possibility of
298  * duplicate TOAST chunk OIDs. The index might also be a little more
299  * efficient this way, since btree isn't all that happy with large numbers
300  * of equal keys.
301  */
302 
303  indexInfo = makeNode(IndexInfo);
304  indexInfo->ii_NumIndexAttrs = 2;
305  indexInfo->ii_KeyAttrNumbers[0] = 1;
306  indexInfo->ii_KeyAttrNumbers[1] = 2;
307  indexInfo->ii_Expressions = NIL;
308  indexInfo->ii_ExpressionsState = NIL;
309  indexInfo->ii_Predicate = NIL;
310  indexInfo->ii_PredicateState = NULL;
311  indexInfo->ii_ExclusionOps = NULL;
312  indexInfo->ii_ExclusionProcs = NULL;
313  indexInfo->ii_ExclusionStrats = NULL;
314  indexInfo->ii_Unique = true;
315  indexInfo->ii_ReadyForInserts = true;
316  indexInfo->ii_Concurrent = false;
317  indexInfo->ii_BrokenHotChain = false;
318  indexInfo->ii_AmCache = NULL;
319  indexInfo->ii_Context = CurrentMemoryContext;
320 
321  collationObjectId[0] = InvalidOid;
322  collationObjectId[1] = InvalidOid;
323 
324  classObjectId[0] = OID_BTREE_OPS_OID;
325  classObjectId[1] = INT4_BTREE_OPS_OID;
326 
327  coloptions[0] = 0;
328  coloptions[1] = 0;
329 
330  index_create(toast_rel, toast_idxname, toastIndexOid, InvalidOid,
331  indexInfo,
332  list_make2("chunk_id", "chunk_seq"),
333  BTREE_AM_OID,
334  rel->rd_rel->reltablespace,
335  collationObjectId, classObjectId, coloptions, (Datum) 0,
336  INDEX_CREATE_IS_PRIMARY, 0, true, true);
337 
338  heap_close(toast_rel, NoLock);
339 
340  /*
341  * Store the toast table's OID in the parent relation's pg_class row
342  */
344 
345  reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid));
346  if (!HeapTupleIsValid(reltup))
347  elog(ERROR, "cache lookup failed for relation %u", relOid);
348 
349  ((Form_pg_class) GETSTRUCT(reltup))->reltoastrelid = toast_relid;
350 
352  {
353  /* normal case, use a transactional update */
354  CatalogTupleUpdate(class_rel, &reltup->t_self, reltup);
355  }
356  else
357  {
358  /* While bootstrapping, we cannot UPDATE, so overwrite in-place */
359  heap_inplace_update(class_rel, reltup);
360  }
361 
362  heap_freetuple(reltup);
363 
364  heap_close(class_rel, RowExclusiveLock);
365 
366  /*
367  * Register dependency from the toast table to the master, so that the
368  * toast table will be deleted if the master is. Skip this in bootstrap
369  * mode.
370  */
372  {
373  baseobject.classId = RelationRelationId;
374  baseobject.objectId = relOid;
375  baseobject.objectSubId = 0;
376  toastobject.classId = RelationRelationId;
377  toastobject.objectId = toast_relid;
378  toastobject.objectSubId = 0;
379 
380  recordDependencyOn(&toastobject, &baseobject, DEPENDENCY_INTERNAL);
381  }
382 
383  /*
384  * Make changes visible
385  */
387 
388  return true;
389 }
#define list_make2(x1, x2)
Definition: pg_list.h:140
signed short int16
Definition: c.h:293
#define NIL
Definition: pg_list.h:69
MemoryContext ii_Context
Definition: execnodes.h:152
#define GETSTRUCT(TUP)
Definition: htup_details.h:661
List * ii_Predicate
Definition: execnodes.h:139
Oid binary_upgrade_next_toast_pg_class_oid
Definition: heap.c:87
#define OIDOID
Definition: pg_type.h:328
bool isTempOrTempToastNamespace(Oid namespaceId)
Definition: namespace.c:3142
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:90
ExprState * ii_PredicateState
Definition: execnodes.h:140
#define RelationRelationId
Definition: pg_class.h:29
#define BTREE_AM_OID
Definition: pg_am.h:70
#define INT4OID
Definition: pg_type.h:316
Oid * ii_ExclusionProcs
Definition: execnodes.h:142
int errcode(int sqlerrcode)
Definition: elog.c:575
#define OID_BTREE_OPS_OID
Definition: pg_opclass.h:145
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
Definition: pg_depend.c:44
#define heap_close(r, l)
Definition: heapam.h:97
Form_pg_class rd_rel
Definition: rel.h:114
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1373
unsigned int Oid
Definition: postgres_ext.h:31
#define PG_TOAST_NAMESPACE
Definition: pg_namespace.h:74
#define OidIsValid(objectId)
Definition: c.h:586
bool IsBinaryUpgrade
Definition: globals.c:102
#define NAMEDATALEN
List * ii_ExpressionsState
Definition: execnodes.h:138
#define ObjectIdGetDatum(X)
Definition: postgres.h:513
#define ERROR
Definition: elog.h:43
ItemPointerData t_self
Definition: htup.h:65
Oid GetTempToastNamespace(void)
Definition: namespace.c:3220
#define NoLock
Definition: lockdefs.h:34
static bool needs_toast_table(Relation rel)
Definition: toasting.c:398
#define RowExclusiveLock
Definition: lockdefs.h:38
bool ii_BrokenHotChain
Definition: execnodes.h:150
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
Definition: tupdesc.c:505
bool ii_ReadyForInserts
Definition: execnodes.h:148
#define ereport(elevel, rest)
Definition: elog.h:122
void * ii_AmCache
Definition: execnodes.h:151
#define RelationIsMapped(relation)
Definition: rel.h:462
#define RELKIND_TOASTVALUE
Definition: pg_class.h:163
uintptr_t Datum
Definition: postgres.h:372
void CommandCounterIncrement(void)
Definition: xact.c:915
int ii_NumIndexAttrs
Definition: execnodes.h:135
Relation heap_open(Oid relationId, LOCKMODE lockmode)
Definition: heapam.c:1290
#define INDEX_CREATE_IS_PRIMARY
Definition: index.h:45
#define InvalidOid
Definition: postgres_ext.h:36
bool ii_Unique
Definition: execnodes.h:147
#define makeNode(_type_)
Definition: nodes.h:560
#define HeapTupleIsValid(tuple)
Definition: htup.h:77
List * ii_Expressions
Definition: execnodes.h:137
#define Assert(condition)
Definition: c.h:680
Oid index_create(Relation heapRelation, const char *indexRelationName, Oid indexRelationId, Oid relFileNode, IndexInfo *indexInfo, List *indexColNames, Oid accessMethodObjectId, Oid tableSpaceId, Oid *collationObjectId, Oid *classObjectId, int16 *coloptions, Datum reloptions, bits16 flags, bits16 constr_flags, bool allow_system_table_mods, bool is_internal)
Definition: index.c:706
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
Definition: indexing.c:210
AttrNumber ii_KeyAttrNumbers[INDEX_MAX_KEYS]
Definition: execnodes.h:136
TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid)
Definition: tupdesc.c:43
#define INT4_BTREE_OPS_OID
Definition: pg_opclass.h:121
bool ii_Concurrent
Definition: execnodes.h:149
#define BYTEAOID
Definition: pg_type.h:292
#define IsBootstrapProcessingMode()
Definition: miscadmin.h:367
FormData_pg_class * Form_pg_class
Definition: pg_class.h:95
#define SearchSysCacheCopy1(cacheId, key1)
Definition: syscache.h:173
#define AccessExclusiveLock
Definition: lockdefs.h:45
Oid * ii_ExclusionOps
Definition: execnodes.h:141
int errmsg(const char *fmt,...)
Definition: elog.c:797
void heap_inplace_update(Relation relation, HeapTuple tuple)
Definition: heapam.c:6248
#define ShareLock
Definition: lockdefs.h:41
Oid heap_create_with_catalog(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid reltypeid, Oid reloftypeid, Oid ownerid, TupleDesc tupdesc, List *cooked_constraints, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool oidislocal, int oidinhcount, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, bool allow_system_table_mods, bool is_internal, ObjectAddress *typaddress)
Definition: heap.c:1021
Oid binary_upgrade_next_toast_pg_type_oid
Definition: toasting.c:37
#define elog
Definition: elog.h:219
uint16 * ii_ExclusionStrats
Definition: execnodes.h:143
int16 AttrNumber
Definition: attnum.h:21
#define RelationGetRelid(relation)
Definition: rel.h:425

◆ needs_toast_table()

static bool needs_toast_table ( Relation  rel)
static

Definition at line 398 of file toasting.c.

References att_align_nominal, BITMAPLEN, i, MAXALIGN, tupleDesc::natts, RelationData::rd_att, SizeofHeapTupleHeader, TOAST_TUPLE_THRESHOLD, TupleDescAttr, and type_maximum_size().

Referenced by create_toast_table().

399 {
400  int32 data_length = 0;
401  bool maxlength_unknown = false;
402  bool has_toastable_attrs = false;
403  TupleDesc tupdesc;
404  int32 tuple_length;
405  int i;
406 
407  tupdesc = rel->rd_att;
408 
409  for (i = 0; i < tupdesc->natts; i++)
410  {
411  Form_pg_attribute att = TupleDescAttr(tupdesc, i);
412 
413  if (att->attisdropped)
414  continue;
415  data_length = att_align_nominal(data_length, att->attalign);
416  if (att->attlen > 0)
417  {
418  /* Fixed-length types are never toastable */
419  data_length += att->attlen;
420  }
421  else
422  {
423  int32 maxlen = type_maximum_size(att->atttypid,
424  att->atttypmod);
425 
426  if (maxlen < 0)
427  maxlength_unknown = true;
428  else
429  data_length += maxlen;
430  if (att->attstorage != 'p')
431  has_toastable_attrs = true;
432  }
433  }
434  if (!has_toastable_attrs)
435  return false; /* nothing to toast? */
436  if (maxlength_unknown)
437  return true; /* any unlimited-length attrs? */
438  tuple_length = MAXALIGN(SizeofHeapTupleHeader +
439  BITMAPLEN(tupdesc->natts)) +
440  MAXALIGN(data_length);
441  return (tuple_length > TOAST_TUPLE_THRESHOLD);
442 }
#define TOAST_TUPLE_THRESHOLD
Definition: tuptoaster.h:55
#define SizeofHeapTupleHeader
Definition: htup_details.h:175
#define att_align_nominal(cur_offset, attalign)
Definition: tupmacs.h:144
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:90
#define BITMAPLEN(NATTS)
Definition: htup_details.h:553
int natts
Definition: tupdesc.h:79
signed int int32
Definition: c.h:294
int32 type_maximum_size(Oid type_oid, int32 typemod)
Definition: format_type.c:389
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:187
TupleDesc rd_att
Definition: rel.h:115
#define MAXALIGN(LEN)
Definition: c.h:633
int i

◆ NewHeapCreateToastTable()

void NewHeapCreateToastTable ( Oid  relOid,
Datum  reloptions,
LOCKMODE  lockmode 
)

Definition at line 65 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by make_new_heap().

66 {
67  CheckAndCreateToastTable(relOid, reloptions, lockmode, false);
68 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:77

◆ NewRelationCreateToastTable()

void NewRelationCreateToastTable ( Oid  relOid,
Datum  reloptions 
)

Definition at line 71 of file toasting.c.

References AccessExclusiveLock, and CheckAndCreateToastTable().

Referenced by create_ctas_internal(), and ProcessUtilitySlow().

72 {
73  CheckAndCreateToastTable(relOid, reloptions, AccessExclusiveLock, false);
74 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:77
#define AccessExclusiveLock
Definition: lockdefs.h:45

Variable Documentation

◆ binary_upgrade_next_toast_pg_type_oid

Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid

Definition at line 37 of file toasting.c.

Referenced by binary_upgrade_set_next_toast_pg_type_oid(), and create_toast_table().