PostgreSQL Source Code  git master
catalog.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * catalog.c
4  * routines concerned with catalog naming conventions and other
5  * bits of hard-wired knowledge
6  *
7  *
8  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  *
12  * IDENTIFICATION
13  * src/backend/catalog/catalog.c
14  *
15  *-------------------------------------------------------------------------
16  */
17 
18 #include "postgres.h"
19 
20 #include <fcntl.h>
21 #include <unistd.h>
22 
23 #include "access/genam.h"
24 #include "access/htup_details.h"
25 #include "access/sysattr.h"
26 #include "access/table.h"
27 #include "access/transam.h"
28 #include "catalog/catalog.h"
29 #include "catalog/namespace.h"
31 #include "catalog/pg_authid.h"
32 #include "catalog/pg_database.h"
34 #include "catalog/pg_namespace.h"
36 #include "catalog/pg_shdepend.h"
38 #include "catalog/pg_shseclabel.h"
40 #include "catalog/pg_tablespace.h"
41 #include "catalog/pg_type.h"
42 #include "miscadmin.h"
43 #include "storage/fd.h"
44 #include "utils/fmgroids.h"
45 #include "utils/fmgrprotos.h"
46 #include "utils/rel.h"
47 #include "utils/snapmgr.h"
48 #include "utils/syscache.h"
49 
50 /*
51  * Parameters to determine when to emit a log message in
52  * GetNewOidWithIndex()
53  */
54 #define GETNEWOID_LOG_THRESHOLD 1000000
55 #define GETNEWOID_LOG_MAX_INTERVAL 128000000
56 
57 /*
58  * IsSystemRelation
59  * True iff the relation is either a system catalog or a toast table.
60  * See IsCatalogRelation for the exact definition of a system catalog.
61  *
62  * We treat toast tables of user relations as "system relations" for
63  * protection purposes, e.g. you can't change their schemas without
64  * special permissions. Therefore, most uses of this function are
65  * checking whether allow_system_table_mods restrictions apply.
66  * For other purposes, consider whether you shouldn't be using
67  * IsCatalogRelation instead.
68  *
69  * This function does not perform any catalog accesses.
70  * Some callers rely on that!
71  */
72 bool
74 {
75  return IsSystemClass(RelationGetRelid(relation), relation->rd_rel);
76 }
77 
78 /*
79  * IsSystemClass
80  * Like the above, but takes a Form_pg_class as argument.
81  * Used when we do not want to open the relation and have to
82  * search pg_class directly.
83  */
84 bool
86 {
87  /* IsCatalogRelationOid is a bit faster, so test that first */
88  return (IsCatalogRelationOid(relid) || IsToastClass(reltuple));
89 }
90 
91 /*
92  * IsCatalogRelation
93  * True iff the relation is a system catalog.
94  *
95  * By a system catalog, we mean one that is created during the bootstrap
96  * phase of initdb. That includes not just the catalogs per se, but
97  * also their indexes, and TOAST tables and indexes if any.
98  *
99  * This function does not perform any catalog accesses.
100  * Some callers rely on that!
101  */
102 bool
104 {
105  return IsCatalogRelationOid(RelationGetRelid(relation));
106 }
107 
108 /*
109  * IsCatalogRelationOid
110  * True iff the relation identified by this OID is a system catalog.
111  *
112  * By a system catalog, we mean one that is created during the bootstrap
113  * phase of initdb. That includes not just the catalogs per se, but
114  * also their indexes, and TOAST tables and indexes if any.
115  *
116  * This function does not perform any catalog accesses.
117  * Some callers rely on that!
118  */
119 bool
121 {
122  /*
123  * We consider a relation to be a system catalog if it has an OID that was
124  * manually assigned or assigned by genbki.pl. This includes all the
125  * defined catalogs, their indexes, and their TOAST tables and indexes.
126  *
127  * This rule excludes the relations in information_schema, which are not
128  * integral to the system and can be treated the same as user relations.
129  * (Since it's valid to drop and recreate information_schema, any rule
130  * that did not act this way would be wrong.)
131  *
132  * This test is reliable since an OID wraparound will skip this range of
133  * OIDs; see GetNewObjectId().
134  */
135  return (relid < (Oid) FirstBootstrapObjectId);
136 }
137 
138 /*
139  * IsToastRelation
140  * True iff relation is a TOAST support relation (or index).
141  *
142  * Does not perform any catalog accesses.
143  */
144 bool
146 {
147  /*
148  * What we actually check is whether the relation belongs to a pg_toast
149  * namespace. This should be equivalent because of restrictions that are
150  * enforced elsewhere against creating user relations in, or moving
151  * relations into/out of, a pg_toast namespace. Notice also that this
152  * will not say "true" for toast tables belonging to other sessions' temp
153  * tables; we expect that other mechanisms will prevent access to those.
154  */
155  return IsToastNamespace(RelationGetNamespace(relation));
156 }
157 
158 /*
159  * IsToastClass
160  * Like the above, but takes a Form_pg_class as argument.
161  * Used when we do not want to open the relation and have to
162  * search pg_class directly.
163  */
164 bool
166 {
167  Oid relnamespace = reltuple->relnamespace;
168 
169  return IsToastNamespace(relnamespace);
170 }
171 
172 /*
173  * IsCatalogNamespace
174  * True iff namespace is pg_catalog.
175  *
176  * Does not perform any catalog accesses.
177  *
178  * NOTE: the reason this isn't a macro is to avoid having to include
179  * catalog/pg_namespace.h in a lot of places.
180  */
181 bool
183 {
184  return namespaceId == PG_CATALOG_NAMESPACE;
185 }
186 
187 /*
188  * IsToastNamespace
189  * True iff namespace is pg_toast or my temporary-toast-table namespace.
190  *
191  * Does not perform any catalog accesses.
192  *
193  * Note: this will return false for temporary-toast-table namespaces belonging
194  * to other backends. Those are treated the same as other backends' regular
195  * temp table namespaces, and access is prevented where appropriate.
196  * If you need to check for those, you may be able to use isAnyTempNamespace,
197  * but beware that that does involve a catalog access.
198  */
199 bool
200 IsToastNamespace(Oid namespaceId)
201 {
202  return (namespaceId == PG_TOAST_NAMESPACE) ||
203  isTempToastNamespace(namespaceId);
204 }
205 
206 
207 /*
208  * IsReservedName
209  * True iff name starts with the pg_ prefix.
210  *
211  * For some classes of objects, the prefix pg_ is reserved for
212  * system objects only. As of 8.0, this was only true for
213  * schema and tablespace names. With 9.6, this is also true
214  * for roles.
215  */
216 bool
217 IsReservedName(const char *name)
218 {
219  /* ugly coding for speed */
220  return (name[0] == 'p' &&
221  name[1] == 'g' &&
222  name[2] == '_');
223 }
224 
225 
226 /*
227  * IsSharedRelation
228  * Given the OID of a relation, determine whether it's supposed to be
229  * shared across an entire database cluster.
230  *
231  * In older releases, this had to be hard-wired so that we could compute the
232  * locktag for a relation and lock it before examining its catalog entry.
233  * Since we now have MVCC catalog access, the race conditions that made that
234  * a hard requirement are gone, so we could look at relaxing this restriction.
235  * However, if we scanned the pg_class entry to find relisshared, and only
236  * then locked the relation, pg_class could get updated in the meantime,
237  * forcing us to scan the relation again, which would definitely be complex
238  * and might have undesirable performance consequences. Fortunately, the set
239  * of shared relations is fairly static, so a hand-maintained list of their
240  * OIDs isn't completely impractical.
241  */
242 bool
244 {
245  /* These are the shared catalogs (look for BKI_SHARED_RELATION) */
246  if (relationId == AuthIdRelationId ||
247  relationId == AuthMemRelationId ||
248  relationId == DatabaseRelationId ||
249  relationId == SharedDescriptionRelationId ||
250  relationId == SharedDependRelationId ||
251  relationId == SharedSecLabelRelationId ||
252  relationId == TableSpaceRelationId ||
253  relationId == DbRoleSettingRelationId ||
254  relationId == ReplicationOriginRelationId ||
255  relationId == SubscriptionRelationId)
256  return true;
257  /* These are their indexes */
258  if (relationId == AuthIdRolnameIndexId ||
259  relationId == AuthIdOidIndexId ||
260  relationId == AuthMemRoleMemIndexId ||
261  relationId == AuthMemMemRoleIndexId ||
262  relationId == DatabaseNameIndexId ||
263  relationId == DatabaseOidIndexId ||
264  relationId == SharedDescriptionObjIndexId ||
265  relationId == SharedDependDependerIndexId ||
266  relationId == SharedDependReferenceIndexId ||
267  relationId == SharedSecLabelObjectIndexId ||
268  relationId == TablespaceOidIndexId ||
269  relationId == TablespaceNameIndexId ||
270  relationId == DbRoleSettingDatidRolidIndexId ||
271  relationId == ReplicationOriginIdentIndex ||
272  relationId == ReplicationOriginNameIndex ||
273  relationId == SubscriptionObjectIndexId ||
274  relationId == SubscriptionNameIndexId)
275  return true;
276  /* These are their toast tables and toast indexes */
277  if (relationId == PgAuthidToastTable ||
278  relationId == PgAuthidToastIndex ||
279  relationId == PgDatabaseToastTable ||
280  relationId == PgDatabaseToastIndex ||
281  relationId == PgDbRoleSettingToastTable ||
282  relationId == PgDbRoleSettingToastIndex ||
283  relationId == PgReplicationOriginToastTable ||
284  relationId == PgReplicationOriginToastIndex ||
285  relationId == PgShdescriptionToastTable ||
286  relationId == PgShdescriptionToastIndex ||
287  relationId == PgShseclabelToastTable ||
288  relationId == PgShseclabelToastIndex ||
289  relationId == PgSubscriptionToastTable ||
290  relationId == PgSubscriptionToastIndex ||
291  relationId == PgTablespaceToastTable ||
292  relationId == PgTablespaceToastIndex)
293  return true;
294  return false;
295 }
296 
297 
298 /*
299  * GetNewOidWithIndex
300  * Generate a new OID that is unique within the system relation.
301  *
302  * Since the OID is not immediately inserted into the table, there is a
303  * race condition here; but a problem could occur only if someone else
304  * managed to cycle through 2^32 OIDs and generate the same OID before we
305  * finish inserting our row. This seems unlikely to be a problem. Note
306  * that if we had to *commit* the row to end the race condition, the risk
307  * would be rather higher; therefore we use SnapshotAny in the test, so that
308  * we will see uncommitted rows. (We used to use SnapshotDirty, but that has
309  * the disadvantage that it ignores recently-deleted rows, creating a risk
310  * of transient conflicts for as long as our own MVCC snapshots think a
311  * recently-deleted row is live. The risk is far higher when selecting TOAST
312  * OIDs, because SnapshotToast considers dead rows as active indefinitely.)
313  *
314  * Note that we are effectively assuming that the table has a relatively small
315  * number of entries (much less than 2^32) and there aren't very long runs of
316  * consecutive existing OIDs. This is a mostly reasonable assumption for
317  * system catalogs.
318  *
319  * Caller must have a suitable lock on the relation.
320  */
321 Oid
322 GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
323 {
324  Oid newOid;
325  SysScanDesc scan;
327  bool collides;
328  uint64 retries = 0;
329  uint64 retries_before_log = GETNEWOID_LOG_THRESHOLD;
330 
331  /* Only system relations are supported */
332  Assert(IsSystemRelation(relation));
333 
334  /* In bootstrap mode, we don't have any indexes to use */
336  return GetNewObjectId();
337 
338  /*
339  * We should never be asked to generate a new pg_type OID during
340  * pg_upgrade; doing so would risk collisions with the OIDs it wants to
341  * assign. Hitting this assert means there's some path where we failed to
342  * ensure that a type OID is determined by commands in the dump script.
343  */
344  Assert(!IsBinaryUpgrade || RelationGetRelid(relation) != TypeRelationId);
345 
346  /* Generate new OIDs until we find one not in the table */
347  do
348  {
350 
351  newOid = GetNewObjectId();
352 
353  ScanKeyInit(&key,
354  oidcolumn,
355  BTEqualStrategyNumber, F_OIDEQ,
356  ObjectIdGetDatum(newOid));
357 
358  /* see notes above about using SnapshotAny */
359  scan = systable_beginscan(relation, indexId, true,
360  SnapshotAny, 1, &key);
361 
362  collides = HeapTupleIsValid(systable_getnext(scan));
363 
364  systable_endscan(scan);
365 
366  /*
367  * Log that we iterate more than GETNEWOID_LOG_THRESHOLD but have not
368  * yet found OID unused in the relation. Then repeat logging with
369  * exponentially increasing intervals until we iterate more than
370  * GETNEWOID_LOG_MAX_INTERVAL. Finally repeat logging every
371  * GETNEWOID_LOG_MAX_INTERVAL unless an unused OID is found. This
372  * logic is necessary not to fill up the server log with the similar
373  * messages.
374  */
375  if (retries >= retries_before_log)
376  {
377  ereport(LOG,
378  (errmsg("still finding an unused OID within relation \"%s\"",
379  RelationGetRelationName(relation)),
380  errdetail("OID candidates were checked \"%llu\" times, but no unused OID is yet found.",
381  (unsigned long long) retries)));
382 
383  /*
384  * Double the number of retries to do before logging next until it
385  * reaches GETNEWOID_LOG_MAX_INTERVAL.
386  */
387  if (retries_before_log * 2 <= GETNEWOID_LOG_MAX_INTERVAL)
388  retries_before_log *= 2;
389  else
390  retries_before_log += GETNEWOID_LOG_MAX_INTERVAL;
391  }
392 
393  retries++;
394  } while (collides);
395 
396  /*
397  * If at least one log message is emitted, also log the completion of OID
398  * assignment.
399  */
400  if (retries > GETNEWOID_LOG_THRESHOLD)
401  {
402  ereport(LOG,
403  (errmsg("new OID has been assigned in relation \"%s\" after \"%llu\" retries",
404  RelationGetRelationName(relation), (unsigned long long) retries)));
405  }
406 
407  return newOid;
408 }
409 
410 /*
411  * GetNewRelFileNode
412  * Generate a new relfilenode number that is unique within the
413  * database of the given tablespace.
414  *
415  * If the relfilenode will also be used as the relation's OID, pass the
416  * opened pg_class catalog, and this routine will guarantee that the result
417  * is also an unused OID within pg_class. If the result is to be used only
418  * as a relfilenode for an existing relation, pass NULL for pg_class.
419  *
420  * As with GetNewOidWithIndex(), there is some theoretical risk of a race
421  * condition, but it doesn't seem worth worrying about.
422  *
423  * Note: we don't support using this in bootstrap mode. All relations
424  * created by bootstrap have preassigned OIDs, so there's no need.
425  */
426 Oid
427 GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
428 {
429  RelFileNodeBackend rnode;
430  char *rpath;
431  bool collides;
432  BackendId backend;
433 
434  /*
435  * If we ever get here during pg_upgrade, there's something wrong; all
436  * relfilenode assignments during a binary-upgrade run should be
437  * determined by commands in the dump script.
438  */
440 
441  switch (relpersistence)
442  {
443  case RELPERSISTENCE_TEMP:
444  backend = BackendIdForTempRelations();
445  break;
446  case RELPERSISTENCE_UNLOGGED:
447  case RELPERSISTENCE_PERMANENT:
448  backend = InvalidBackendId;
449  break;
450  default:
451  elog(ERROR, "invalid relpersistence: %c", relpersistence);
452  return InvalidOid; /* placate compiler */
453  }
454 
455  /* This logic should match RelationInitPhysicalAddr */
456  rnode.node.spcNode = reltablespace ? reltablespace : MyDatabaseTableSpace;
457  rnode.node.dbNode = (rnode.node.spcNode == GLOBALTABLESPACE_OID) ? InvalidOid : MyDatabaseId;
458 
459  /*
460  * The relpath will vary based on the backend ID, so we must initialize
461  * that properly here to make sure that any collisions based on filename
462  * are properly detected.
463  */
464  rnode.backend = backend;
465 
466  do
467  {
469 
470  /* Generate the OID */
471  if (pg_class)
473  Anum_pg_class_oid);
474  else
475  rnode.node.relNode = GetNewObjectId();
476 
477  /* Check for existing file of same name */
478  rpath = relpath(rnode, MAIN_FORKNUM);
479 
480  if (access(rpath, F_OK) == 0)
481  {
482  /* definite collision */
483  collides = true;
484  }
485  else
486  {
487  /*
488  * Here we have a little bit of a dilemma: if errno is something
489  * other than ENOENT, should we declare a collision and loop? In
490  * practice it seems best to go ahead regardless of the errno. If
491  * there is a colliding file we will get an smgr failure when we
492  * attempt to create the new relation file.
493  */
494  collides = false;
495  }
496 
497  pfree(rpath);
498  } while (collides);
499 
500  return rnode.node.relNode;
501 }
502 
503 /*
504  * SQL callable interface for GetNewOidWithIndex(). Outside of initdb's
505  * direct insertions into catalog tables, and recovering from corruption, this
506  * should rarely be needed.
507  *
508  * Function is intentionally not documented in the user facing docs.
509  */
510 Datum
512 {
513  Oid reloid = PG_GETARG_OID(0);
515  Oid idxoid = PG_GETARG_OID(2);
516  Relation rel;
517  Relation idx;
518  HeapTuple atttuple;
519  Form_pg_attribute attform;
520  AttrNumber attno;
521  Oid newoid;
522 
523  /*
524  * As this function is not intended to be used during normal running, and
525  * only supports system catalogs (which require superuser permissions to
526  * modify), just checking for superuser ought to not obstruct valid
527  * usecases.
528  */
529  if (!superuser())
530  ereport(ERROR,
531  (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
532  errmsg("must be superuser to call pg_nextoid()")));
533 
534  rel = table_open(reloid, RowExclusiveLock);
535  idx = index_open(idxoid, RowExclusiveLock);
536 
537  if (!IsSystemRelation(rel))
538  ereport(ERROR,
539  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
540  errmsg("pg_nextoid() can only be used on system catalogs")));
541 
542  if (idx->rd_index->indrelid != RelationGetRelid(rel))
543  ereport(ERROR,
544  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
545  errmsg("index \"%s\" does not belong to table \"%s\"",
547  RelationGetRelationName(rel))));
548 
549  atttuple = SearchSysCacheAttName(reloid, NameStr(*attname));
550  if (!HeapTupleIsValid(atttuple))
551  ereport(ERROR,
552  (errcode(ERRCODE_UNDEFINED_COLUMN),
553  errmsg("column \"%s\" of relation \"%s\" does not exist",
554  NameStr(*attname), RelationGetRelationName(rel))));
555 
556  attform = ((Form_pg_attribute) GETSTRUCT(atttuple));
557  attno = attform->attnum;
558 
559  if (attform->atttypid != OIDOID)
560  ereport(ERROR,
561  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
562  errmsg("column \"%s\" is not of type oid",
563  NameStr(*attname))));
564 
566  idx->rd_index->indkey.values[0] != attno)
567  ereport(ERROR,
568  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
569  errmsg("index \"%s\" is not the index for column \"%s\"",
571  NameStr(*attname))));
572 
573  newoid = GetNewOidWithIndex(rel, idxoid, attno);
574 
575  ReleaseSysCache(atttuple);
578 
579  return newoid;
580 }
#define PgDatabaseToastTable
Definition: pg_database.h:84
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
Definition: catalog.c:322
bool IsToastRelation(Relation relation)
Definition: catalog.c:145
bool IsCatalogRelation(Relation relation)
Definition: catalog.c:103
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
void systable_endscan(SysScanDesc sysscan)
Definition: genam.c:595
#define GETSTRUCT(TUP)
Definition: htup_details.h:654
bool IsSystemRelation(Relation relation)
Definition: catalog.c:73
#define TablespaceNameIndexId
Definition: pg_tablespace.h:57
#define PgSubscriptionToastIndex
int errcode(int sqlerrcode)
Definition: elog.c:698
bool superuser(void)
Definition: superuser.c:46
#define SharedDescriptionObjIndexId
Datum idx(PG_FUNCTION_ARGS)
Definition: _int_op.c:259
#define DatabaseNameIndexId
Definition: pg_database.h:88
#define PgShseclabelToastTable
Definition: pg_shseclabel.h:43
#define ReplicationOriginIdentIndex
#define LOG
Definition: elog.h:26
bool IsToastNamespace(Oid namespaceId)
Definition: catalog.c:200
Form_pg_class rd_rel
Definition: rel.h:109
unsigned int Oid
Definition: postgres_ext.h:31
bool IsReservedName(const char *name)
Definition: catalog.c:217
#define ClassOidIndexId
Definition: pg_class.h:156
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Definition: genam.c:383
bool IsBinaryUpgrade
Definition: globals.c:113
Oid MyDatabaseTableSpace
Definition: globals.c:90
#define SharedSecLabelObjectIndexId
Definition: pg_shseclabel.h:47
#define PgAuthidToastIndex
Definition: pg_authid.h:60
bool IsSystemClass(Oid relid, Form_pg_class reltuple)
Definition: catalog.c:85
#define PgShseclabelToastIndex
Definition: pg_shseclabel.h:44
bool IsCatalogRelationOid(Oid relid)
Definition: catalog.c:120
#define AuthMemMemRoleIndexId
Oid GetNewObjectId(void)
Definition: varsup.c:528
Form_pg_index rd_index
Definition: rel.h:187
HeapTuple systable_getnext(SysScanDesc sysscan)
Definition: genam.c:502
void pfree(void *pointer)
Definition: mcxt.c:1169
bool IsToastClass(Form_pg_class reltuple)
Definition: catalog.c:165
#define PgDatabaseToastIndex
Definition: pg_database.h:85
#define ObjectIdGetDatum(X)
Definition: postgres.h:551
#define ERROR
Definition: elog.h:46
NameData attname
Definition: pg_attribute.h:41
#define SharedDependReferenceIndexId
Definition: pg_shdepend.h:78
#define ReplicationOriginNameIndex
#define PgReplicationOriginToastIndex
Definition: c.h:675
#define BackendIdForTempRelations()
Definition: backendid.h:34
#define PG_GETARG_OID(n)
Definition: fmgr.h:275
#define SubscriptionObjectIndexId
#define PgShdescriptionToastTable
#define RowExclusiveLock
Definition: lockdefs.h:38
int errdetail(const char *fmt,...)
Definition: elog.c:1042
#define PgAuthidToastTable
Definition: pg_authid.h:59
#define RelationGetRelationName(relation)
Definition: rel.h:503
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:203
#define FirstBootstrapObjectId
Definition: transam.h:189
#define IndexRelationGetNumberOfKeyAttributes(relation)
Definition: rel.h:488
#define DatabaseOidIndexId
Definition: pg_database.h:90
bool isTempToastNamespace(Oid namespaceId)
Definition: namespace.c:3168
#define PgDbRoleSettingToastTable
#define PgSubscriptionToastTable
#define InvalidBackendId
Definition: backendid.h:23
#define TablespaceOidIndexId
Definition: pg_tablespace.h:55
uintptr_t Datum
Definition: postgres.h:411
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:1175
int BackendId
Definition: backendid.h:21
Oid MyDatabaseId
Definition: globals.c:88
bool IsSharedRelation(Oid relationId)
Definition: catalog.c:243
#define PgReplicationOriginToastTable
#define InvalidOid
Definition: postgres_ext.h:36
#define ereport(elevel,...)
Definition: elog.h:157
RelFileNode node
Definition: relfilenode.h:74
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define Assert(condition)
Definition: c.h:804
BackendId backend
Definition: relfilenode.h:75
Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
Definition: catalog.c:427
#define DbRoleSettingDatidRolidIndexId
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
Definition: syscache.c:1268
#define PgTablespaceToastTable
Definition: pg_tablespace.h:51
const char * name
Definition: encode.c:515
#define AuthIdOidIndexId
Definition: pg_authid.h:65
#define SnapshotAny
Definition: snapmgr.h:67
#define PgTablespaceToastIndex
Definition: pg_tablespace.h:52
void index_close(Relation relation, LOCKMODE lockmode)
Definition: indexam.c:158
bool IsCatalogNamespace(Oid namespaceId)
Definition: catalog.c:182
#define GETNEWOID_LOG_THRESHOLD
Definition: catalog.c:54
#define IsBootstrapProcessingMode()
Definition: miscadmin.h:394
FormData_pg_class * Form_pg_class
Definition: pg_class.h:153
int errmsg(const char *fmt,...)
Definition: elog.c:909
#define elog(elevel,...)
Definition: elog.h:232
#define relpath(rnode, forknum)
Definition: relpath.h:87
#define NameStr(name)
Definition: c.h:681
#define PgShdescriptionToastIndex
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Definition: scankey.c:76
#define PG_FUNCTION_ARGS
Definition: fmgr.h:193
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:102
#define PgDbRoleSettingToastIndex
Datum pg_nextoid(PG_FUNCTION_ARGS)
Definition: catalog.c:511
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
#define AuthIdRolnameIndexId
Definition: pg_authid.h:63
int16 AttrNumber
Definition: attnum.h:21
#define SharedDependDependerIndexId
Definition: pg_shdepend.h:76
#define RelationGetRelid(relation)
Definition: rel.h:469
#define AuthMemRoleMemIndexId
Relation index_open(Oid relationId, LOCKMODE lockmode)
Definition: indexam.c:132
#define BTEqualStrategyNumber
Definition: stratnum.h:31
#define PG_GETARG_NAME(n)
Definition: fmgr.h:278
#define SubscriptionNameIndexId
#define GETNEWOID_LOG_MAX_INTERVAL
Definition: catalog.c:55
#define RelationGetNamespace(relation)
Definition: rel.h:510