PostgreSQL Source Code  git master
toasting.h File Reference
#include "storage/lock.h"
Include dependency graph for toasting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


void NewRelationCreateToastTable (Oid relOid, Datum reloptions)
void NewHeapCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode, Oid OIDOldToast)
void AlterTableCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode)
void BootstrapToastTable (char *relName, Oid toastOid, Oid toastIndexOid)

Function Documentation

◆ AlterTableCreateToastTable()

void AlterTableCreateToastTable ( Oid  relOid,
Datum  reloptions,
LOCKMODE  lockmode 

Definition at line 57 of file toasting.c.

58 {
59  CheckAndCreateToastTable(relOid, reloptions, lockmode, true, InvalidOid);
60 }
#define InvalidOid
Definition: postgres_ext.h:36
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:77

References CheckAndCreateToastTable(), and InvalidOid.

Referenced by ATRewriteCatalogs().

◆ BootstrapToastTable()

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

Definition at line 97 of file toasting.c.

98 {
99  Relation rel;
101  rel = table_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
103  if (rel->rd_rel->relkind != RELKIND_RELATION &&
104  rel->rd_rel->relkind != RELKIND_MATVIEW)
105  elog(ERROR, "\"%s\" is not a table or materialized view",
106  relName);
108  /* create_toast_table does all the work */
109  if (!create_toast_table(rel, toastOid, toastIndexOid, (Datum) 0,
111  elog(ERROR, "\"%s\" does not require a toast table",
112  relName);
114  table_close(rel, NoLock);
115 }
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:224
#define NoLock
Definition: lockdefs.h:34
#define AccessExclusiveLock
Definition: lockdefs.h:43
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:424
uintptr_t Datum
Definition: postgres.h:64
Form_pg_class rd_rel
Definition: rel.h:111
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:126
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: table.c:83
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:126

References AccessExclusiveLock, create_toast_table(), elog, ERROR, InvalidOid, makeRangeVar(), NoLock, RelationData::rd_rel, table_close(), and table_openrv().

◆ NewHeapCreateToastTable()

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

Definition at line 63 of file toasting.c.

65 {
66  CheckAndCreateToastTable(relOid, reloptions, lockmode, false, OIDOldToast);
67 }

References CheckAndCreateToastTable().

Referenced by make_new_heap().

◆ NewRelationCreateToastTable()

void NewRelationCreateToastTable ( Oid  relOid,
Datum  reloptions 

Definition at line 70 of file toasting.c.

71 {
72  CheckAndCreateToastTable(relOid, reloptions, AccessExclusiveLock, false,
73  InvalidOid);
74 }

References AccessExclusiveLock, CheckAndCreateToastTable(), and InvalidOid.

Referenced by create_ctas_internal(), and ProcessUtilitySlow().