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, 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 60 of file toasting.c.

References CheckAndCreateToastTable(), and InvalidOid.

Referenced by ATRewriteCatalogs().

61 {
62  CheckAndCreateToastTable(relOid, reloptions, lockmode, true, InvalidOid);
63 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:80
#define InvalidOid
Definition: postgres_ext.h:36

◆ BootstrapToastTable()

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

Definition at line 100 of file toasting.c.

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

101 {
102  Relation rel;
103 
104  rel = table_openrv(makeRangeVar(NULL, relName, -1), AccessExclusiveLock);
105 
106  if (rel->rd_rel->relkind != RELKIND_RELATION &&
107  rel->rd_rel->relkind != RELKIND_MATVIEW)
108  elog(ERROR, "\"%s\" is not a table or materialized view",
109  relName);
110 
111  /* create_toast_table does all the work */
112  if (!create_toast_table(rel, toastOid, toastIndexOid, (Datum) 0,
114  elog(ERROR, "\"%s\" does not require a toast table",
115  relName);
116 
117  table_close(rel, NoLock);
118 }
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
Form_pg_class rd_rel
Definition: rel.h:109
#define ERROR
Definition: elog.h:46
#define NoLock
Definition: lockdefs.h:34
uintptr_t Datum
Definition: postgres.h:411
static bool create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:129
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: table.c:102
#define InvalidOid
Definition: postgres_ext.h:36
#define AccessExclusiveLock
Definition: lockdefs.h:45
#define elog(elevel,...)
Definition: elog.h:232
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:422

◆ NewHeapCreateToastTable()

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

Definition at line 66 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by make_new_heap().

68 {
69  CheckAndCreateToastTable(relOid, reloptions, lockmode, false, OIDOldToast);
70 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:80

◆ NewRelationCreateToastTable()

void NewRelationCreateToastTable ( Oid  relOid,
Datum  reloptions 
)

Definition at line 73 of file toasting.c.

References AccessExclusiveLock, CheckAndCreateToastTable(), and InvalidOid.

Referenced by create_ctas_internal(), and ProcessUtilitySlow().

74 {
75  CheckAndCreateToastTable(relOid, reloptions, AccessExclusiveLock, false,
76  InvalidOid);
77 }
static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, Oid OIDOldToast)
Definition: toasting.c:80
#define InvalidOid
Definition: postgres_ext.h:36
#define AccessExclusiveLock
Definition: lockdefs.h:45