PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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.

Macros

#define DECLARE_TOAST(name, toastoid, indexoid)   extern int no_such_variable
 
#define PgShdescriptionToastTable   2846
 
#define PgShdescriptionToastIndex   2847
 
#define PgDbRoleSettingToastTable   2966
 
#define PgDbRoleSettingToastIndex   2967
 
#define PgShseclabelToastTable   4060
 
#define PgShseclabelToastIndex   4061
 

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)
 
 DECLARE_TOAST (pg_attrdef, 2830, 2831)
 
 DECLARE_TOAST (pg_constraint, 2832, 2833)
 
 DECLARE_TOAST (pg_description, 2834, 2835)
 
 DECLARE_TOAST (pg_proc, 2836, 2837)
 
 DECLARE_TOAST (pg_rewrite, 2838, 2839)
 
 DECLARE_TOAST (pg_seclabel, 3598, 3599)
 
 DECLARE_TOAST (pg_statistic, 2840, 2841)
 
 DECLARE_TOAST (pg_trigger, 2336, 2337)
 
 DECLARE_TOAST (pg_shdescription, 2846, 2847)
 
 DECLARE_TOAST (pg_db_role_setting, 2966, 2967)
 
 DECLARE_TOAST (pg_shseclabel, 4060, 4061)
 

Macro Definition Documentation

#define DECLARE_TOAST (   name,
  toastoid,
  indexoid 
)    extern int no_such_variable

Definition at line 35 of file toasting.h.

#define PgDbRoleSettingToastIndex   2967

Definition at line 64 of file toasting.h.

Referenced by IsSharedRelation().

#define PgDbRoleSettingToastTable   2966

Definition at line 63 of file toasting.h.

Referenced by IsSharedRelation().

#define PgShdescriptionToastIndex   2847

Definition at line 61 of file toasting.h.

Referenced by IsSharedRelation().

#define PgShdescriptionToastTable   2846

Definition at line 60 of file toasting.h.

Referenced by IsSharedRelation().

#define PgShseclabelToastIndex   4061

Definition at line 67 of file toasting.h.

Referenced by IsSharedRelation().

#define PgShseclabelToastTable   4060

Definition at line 66 of file toasting.h.

Referenced by IsSharedRelation().

Function Documentation

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
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, NULL, 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:167
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:113
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:374
Relation heap_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: heapam.c:1315
#define NULL
Definition: c.h:226
#define AccessExclusiveLock
Definition: lockdefs.h:46
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:419
DECLARE_TOAST ( pg_attrdef  ,
2830  ,
2831   
)
DECLARE_TOAST ( pg_constraint  ,
2832  ,
2833   
)
DECLARE_TOAST ( pg_description  ,
2834  ,
2835   
)
DECLARE_TOAST ( pg_proc  ,
2836  ,
2837   
)
DECLARE_TOAST ( pg_rewrite  ,
2838  ,
2839   
)
DECLARE_TOAST ( pg_seclabel  ,
3598  ,
3599   
)
DECLARE_TOAST ( pg_statistic  ,
2840  ,
2841   
)
DECLARE_TOAST ( pg_trigger  ,
2336  ,
2337   
)
DECLARE_TOAST ( pg_shdescription  ,
2846  ,
2847   
)
DECLARE_TOAST ( pg_db_role_setting  ,
2966  ,
2967   
)
DECLARE_TOAST ( pg_shseclabel  ,
4060  ,
4061   
)
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
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:46