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.

Macros

#define DECLARE_TOAST(name, toastoid, indexoid)   extern int no_such_variable
 
#define PgAuthidToastTable   4175
 
#define PgAuthidToastIndex   4176
 
#define PgDatabaseToastTable   4177
 
#define PgDatabaseToastIndex   4178
 
#define PgDbRoleSettingToastTable   2966
 
#define PgDbRoleSettingToastIndex   2967
 
#define PgPlTemplateToastTable   4179
 
#define PgPlTemplateToastIndex   4180
 
#define PgReplicationOriginToastTable   4181
 
#define PgReplicationOriginToastIndex   4182
 
#define PgShdescriptionToastTable   2846
 
#define PgShdescriptionToastIndex   2847
 
#define PgShseclabelToastTable   4060
 
#define PgShseclabelToastIndex   4061
 
#define PgSubscriptionToastTable   4183
 
#define PgSubscriptionToastIndex   4184
 
#define PgTablespaceToastTable   4185
 
#define PgTablespaceToastIndex   4186
 

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_aggregate, 4159, 4160)
 
 DECLARE_TOAST (pg_attrdef, 2830, 2831)
 
 DECLARE_TOAST (pg_collation, 4161, 4162)
 
 DECLARE_TOAST (pg_constraint, 2832, 2833)
 
 DECLARE_TOAST (pg_default_acl, 4143, 4144)
 
 DECLARE_TOAST (pg_description, 2834, 2835)
 
 DECLARE_TOAST (pg_event_trigger, 4145, 4146)
 
 DECLARE_TOAST (pg_extension, 4147, 4148)
 
 DECLARE_TOAST (pg_foreign_data_wrapper, 4149, 4150)
 
 DECLARE_TOAST (pg_foreign_server, 4151, 4152)
 
 DECLARE_TOAST (pg_foreign_table, 4153, 4154)
 
 DECLARE_TOAST (pg_init_privs, 4155, 4156)
 
 DECLARE_TOAST (pg_language, 4157, 4158)
 
 DECLARE_TOAST (pg_namespace, 4163, 4164)
 
 DECLARE_TOAST (pg_partitioned_table, 4165, 4166)
 
 DECLARE_TOAST (pg_policy, 4167, 4168)
 
 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_statistic_ext, 3439, 3440)
 
 DECLARE_TOAST (pg_statistic_ext_data, 3430, 3431)
 
 DECLARE_TOAST (pg_trigger, 2336, 2337)
 
 DECLARE_TOAST (pg_ts_dict, 4169, 4170)
 
 DECLARE_TOAST (pg_type, 4171, 4172)
 
 DECLARE_TOAST (pg_user_mapping, 4173, 4174)
 
 DECLARE_TOAST (pg_authid, 4175, 4176)
 
 DECLARE_TOAST (pg_database, 4177, 4178)
 
 DECLARE_TOAST (pg_db_role_setting, 2966, 2967)
 
 DECLARE_TOAST (pg_pltemplate, 4179, 4180)
 
 DECLARE_TOAST (pg_replication_origin, 4181, 4182)
 
 DECLARE_TOAST (pg_shdescription, 2846, 2847)
 
 DECLARE_TOAST (pg_shseclabel, 4060, 4061)
 
 DECLARE_TOAST (pg_subscription, 4183, 4184)
 
 DECLARE_TOAST (pg_tablespace, 4185, 4186)
 

Macro Definition Documentation

◆ DECLARE_TOAST

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

Definition at line 38 of file toasting.h.

◆ PgAuthidToastIndex

#define PgAuthidToastIndex   4176

Definition at line 82 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgAuthidToastTable

#define PgAuthidToastTable   4175

Definition at line 81 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgDatabaseToastIndex

#define PgDatabaseToastIndex   4178

Definition at line 85 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgDatabaseToastTable

#define PgDatabaseToastTable   4177

Definition at line 84 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgDbRoleSettingToastIndex

#define PgDbRoleSettingToastIndex   2967

Definition at line 88 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgDbRoleSettingToastTable

#define PgDbRoleSettingToastTable   2966

Definition at line 87 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgPlTemplateToastIndex

#define PgPlTemplateToastIndex   4180

Definition at line 91 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgPlTemplateToastTable

#define PgPlTemplateToastTable   4179

Definition at line 90 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgReplicationOriginToastIndex

#define PgReplicationOriginToastIndex   4182

Definition at line 94 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgReplicationOriginToastTable

#define PgReplicationOriginToastTable   4181

Definition at line 93 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgShdescriptionToastIndex

#define PgShdescriptionToastIndex   2847

Definition at line 97 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgShdescriptionToastTable

#define PgShdescriptionToastTable   2846

Definition at line 96 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgShseclabelToastIndex

#define PgShseclabelToastIndex   4061

Definition at line 100 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgShseclabelToastTable

#define PgShseclabelToastTable   4060

Definition at line 99 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgSubscriptionToastIndex

#define PgSubscriptionToastIndex   4184

Definition at line 103 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgSubscriptionToastTable

#define PgSubscriptionToastTable   4183

Definition at line 102 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgTablespaceToastIndex

#define PgTablespaceToastIndex   4186

Definition at line 106 of file toasting.h.

Referenced by IsSharedRelation().

◆ PgTablespaceToastTable

#define PgTablespaceToastTable   4185

Definition at line 105 of file toasting.h.

Referenced by IsSharedRelation().

Function Documentation

◆ AlterTableCreateToastTable()

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

Definition at line 60 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by ATRewriteCatalogs().

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

◆ BootstrapToastTable()

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

Definition at line 96 of file toasting.c.

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

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

◆ DECLARE_TOAST() [1/35]

DECLARE_TOAST ( pg_aggregate  ,
4159  ,
4160   
)

◆ DECLARE_TOAST() [2/35]

DECLARE_TOAST ( pg_attrdef  ,
2830  ,
2831   
)

◆ DECLARE_TOAST() [3/35]

DECLARE_TOAST ( pg_collation  ,
4161  ,
4162   
)

◆ DECLARE_TOAST() [4/35]

DECLARE_TOAST ( pg_constraint  ,
2832  ,
2833   
)

◆ DECLARE_TOAST() [5/35]

DECLARE_TOAST ( pg_default_acl  ,
4143  ,
4144   
)

◆ DECLARE_TOAST() [6/35]

DECLARE_TOAST ( pg_description  ,
2834  ,
2835   
)

◆ DECLARE_TOAST() [7/35]

DECLARE_TOAST ( pg_event_trigger  ,
4145  ,
4146   
)

◆ DECLARE_TOAST() [8/35]

DECLARE_TOAST ( pg_extension  ,
4147  ,
4148   
)

◆ DECLARE_TOAST() [9/35]

DECLARE_TOAST ( pg_foreign_data_wrapper  ,
4149  ,
4150   
)

◆ DECLARE_TOAST() [10/35]

DECLARE_TOAST ( pg_foreign_server  ,
4151  ,
4152   
)

◆ DECLARE_TOAST() [11/35]

DECLARE_TOAST ( pg_foreign_table  ,
4153  ,
4154   
)

◆ DECLARE_TOAST() [12/35]

DECLARE_TOAST ( pg_init_privs  ,
4155  ,
4156   
)

◆ DECLARE_TOAST() [13/35]

DECLARE_TOAST ( pg_language  ,
4157  ,
4158   
)

◆ DECLARE_TOAST() [14/35]

DECLARE_TOAST ( pg_namespace  ,
4163  ,
4164   
)

◆ DECLARE_TOAST() [15/35]

DECLARE_TOAST ( pg_partitioned_table  ,
4165  ,
4166   
)

◆ DECLARE_TOAST() [16/35]

DECLARE_TOAST ( pg_policy  ,
4167  ,
4168   
)

◆ DECLARE_TOAST() [17/35]

DECLARE_TOAST ( pg_proc  ,
2836  ,
2837   
)

◆ DECLARE_TOAST() [18/35]

DECLARE_TOAST ( pg_rewrite  ,
2838  ,
2839   
)

◆ DECLARE_TOAST() [19/35]

DECLARE_TOAST ( pg_seclabel  ,
3598  ,
3599   
)

◆ DECLARE_TOAST() [20/35]

DECLARE_TOAST ( pg_statistic  ,
2840  ,
2841   
)

◆ DECLARE_TOAST() [21/35]

DECLARE_TOAST ( pg_statistic_ext  ,
3439  ,
3440   
)

◆ DECLARE_TOAST() [22/35]

DECLARE_TOAST ( pg_statistic_ext_data  ,
3430  ,
3431   
)

◆ DECLARE_TOAST() [23/35]

DECLARE_TOAST ( pg_trigger  ,
2336  ,
2337   
)

◆ DECLARE_TOAST() [24/35]

DECLARE_TOAST ( pg_ts_dict  ,
4169  ,
4170   
)

◆ DECLARE_TOAST() [25/35]

DECLARE_TOAST ( pg_type  ,
4171  ,
4172   
)

◆ DECLARE_TOAST() [26/35]

DECLARE_TOAST ( pg_user_mapping  ,
4173  ,
4174   
)

◆ DECLARE_TOAST() [27/35]

DECLARE_TOAST ( pg_authid  ,
4175  ,
4176   
)

◆ DECLARE_TOAST() [28/35]

DECLARE_TOAST ( pg_database  ,
4177  ,
4178   
)

◆ DECLARE_TOAST() [29/35]

DECLARE_TOAST ( pg_db_role_setting  ,
2966  ,
2967   
)

◆ DECLARE_TOAST() [30/35]

DECLARE_TOAST ( pg_pltemplate  ,
4179  ,
4180   
)

◆ DECLARE_TOAST() [31/35]

DECLARE_TOAST ( pg_replication_origin  ,
4181  ,
4182   
)

◆ DECLARE_TOAST() [32/35]

DECLARE_TOAST ( pg_shdescription  ,
2846  ,
2847   
)

◆ DECLARE_TOAST() [33/35]

DECLARE_TOAST ( pg_shseclabel  ,
4060  ,
4061   
)

◆ DECLARE_TOAST() [34/35]

DECLARE_TOAST ( pg_subscription  ,
4183  ,
4184   
)

◆ DECLARE_TOAST() [35/35]

DECLARE_TOAST ( pg_tablespace  ,
4185  ,
4186   
)

◆ NewHeapCreateToastTable()

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

Definition at line 66 of file toasting.c.

References CheckAndCreateToastTable().

Referenced by make_new_heap().

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

◆ NewRelationCreateToastTable()

void NewRelationCreateToastTable ( Oid  relOid,
Datum  reloptions 
)

Definition at line 72 of file toasting.c.

References AccessExclusiveLock, and CheckAndCreateToastTable().

Referenced by create_ctas_internal(), and ProcessUtilitySlow().

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