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.

Functions

void NewRelationCreateToastTable (Oid relOid, Datum reloptions)
 
void NewHeapCreateToastTable (Oid relOid, Datum reloptions, LOCKMODE lockmode)
 
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.

References CheckAndCreateToastTable().

Referenced by ATRewriteCatalogs().

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

◆ BootstrapToastTable()

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

Definition at line 93 of file toasting.c.

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

94 {
95  Relation rel;
96 
97  rel = table_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
98 
99  if (rel->rd_rel->relkind != RELKIND_RELATION &&
100  rel->rd_rel->relkind != RELKIND_MATVIEW)
101  ereport(ERROR,
102  (errcode(ERRCODE_WRONG_OBJECT_TYPE),
103  errmsg("\"%s\" is not a table or materialized view",
104  relName)));
105 
106  /* create_toast_table does all the work */
107  if (!create_toast_table(rel, toastOid, toastIndexOid, (Datum) 0,
108  AccessExclusiveLock, false))
109  elog(ERROR, "\"%s\" does not require a toast table",
110  relName);
111 
112  table_close(rel, NoLock);
113 }
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
int errcode(int sqlerrcode)
Definition: elog.c:704
Form_pg_class rd_rel
Definition: rel.h:110
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check)
Definition: toasting.c:124
#define ERROR
Definition: elog.h:45
#define NoLock
Definition: lockdefs.h:34
uintptr_t Datum
Definition: postgres.h:367
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: table.c:102
#define ereport(elevel,...)
Definition: elog.h:155
#define AccessExclusiveLock
Definition: lockdefs.h:45
int errmsg(const char *fmt,...)
Definition: elog.c:915
#define elog(elevel,...)
Definition: elog.h:228
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:422

◆ NewHeapCreateToastTable()

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

Definition at line 63 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by make_new_heap().

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

◆ NewRelationCreateToastTable()

void NewRelationCreateToastTable ( Oid  relOid,
Datum  reloptions 
)

Definition at line 69 of file toasting.c.

References AccessExclusiveLock, and CheckAndCreateToastTable().

Referenced by create_ctas_internal(), and ProcessUtilitySlow().

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