66#include "catalog/schemapg.h"
87#include "utils/fmgroids.h"
96#define RELCACHE_INIT_FILEMAGIC 0x573266
102#if defined(RECOVER_RELATION_BUILD_MEMORY) && (RECOVER_RELATION_BUILD_MEMORY != 0)
103#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
105#define RECOVER_RELATION_BUILD_MEMORY 0
106#ifdef DISCARD_CACHES_ENABLED
107#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
188#define MAX_EOXACT_LIST 32
193#define EOXactListAdd(rel) \
195 if (eoxact_list_len < MAX_EOXACT_LIST) \
196 eoxact_list[eoxact_list_len++] = (rel)->rd_id; \
198 eoxact_list_overflowed = true; \
213#define RelationCacheInsert(RELATION, replace_allowed) \
215 RelIdCacheEnt *hentry; bool found; \
216 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
217 &((RELATION)->rd_id), \
218 HASH_ENTER, &found); \
222 Relation _old_rel = hentry->reldesc; \
223 Assert(replace_allowed); \
224 hentry->reldesc = (RELATION); \
225 if (RelationHasReferenceCountZero(_old_rel)) \
226 RelationDestroyRelation(_old_rel, false); \
227 else if (!IsBootstrapProcessingMode()) \
228 elog(WARNING, "leaking still-referenced relcache entry for \"%s\"", \
229 RelationGetRelationName(_old_rel)); \
232 hentry->reldesc = (RELATION); \
235#define RelationIdCacheLookup(ID, RELATION) \
237 RelIdCacheEnt *hentry; \
238 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
242 RELATION = hentry->reldesc; \
247#define RelationCacheDelete(RELATION) \
249 RelIdCacheEnt *hentry; \
250 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
251 &((RELATION)->rd_id), \
252 HASH_REMOVE, NULL); \
253 if (hentry == NULL) \
254 elog(WARNING, "failed to delete relcache entry for OID %u", \
255 (RELATION)->rd_id); \
290#ifdef USE_ASSERT_CHECKING
359 elog(
FATAL,
"cannot read pg_class without having selected a database");
483 switch (relation->
rd_rel->relkind)
588 elog(
ERROR,
"invalid attribute number %d for relation \"%s\"",
598 if (
attp->attnotnull)
608 if (
attp->atthasmissing)
629 relation->
rd_rel->relnatts *
670 elog(
ERROR,
"pg_attribute catalog is missing %d attribute(s) for relation OID %u",
681 relation->
rd_rel->relchecks > 0)
695 if (relation->
rd_rel->relchecks > 0 ||
706 for (
int i = 0;
i < relation->
rd_rel->relnatts;
i++)
720 if (relation->
rd_rel->relchecks == 0)
865 check_as_user = relation->
rd_rel->relowner;
1080#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1087 "RelationBuildDesc workspace",
1118#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1159 switch (relation->
rd_rel->relpersistence)
1194 elog(
ERROR,
"invalid relpersistence: %c",
1195 relation->
rd_rel->relpersistence);
1248 if (relation->
rd_rel->relhasrules)
1256 if (relation->
rd_rel->relhastriggers)
1261 if (relation->
rd_rel->relrowsecurity)
1317#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1345 if (relation->
rd_rel->reltablespace)
1354 if (relation->
rd_rel->relfilenode)
1377 elog(
ERROR,
"could not find pg_class entry for %u",
1393 relation->
rd_rel->relisshared);
1395 elog(
ERROR,
"could not find relation mapping for relation \"%s\", OID %u",
1463 elog(
ERROR,
"cache lookup failed for index %u",
1477 elog(
ERROR,
"cache lookup failed for access method %u",
1478 relation->
rd_rel->relam);
1485 elog(
ERROR,
"relnatts disagrees with indnatts for index %u",
1680 ctl.keysize =
sizeof(
Oid);
1711#ifdef DISCARD_CACHES_ENABLED
1792 elog(
ERROR,
"invalid amproc number %d for opclass %u",
1855 elog(
ERROR,
"cache lookup failed for access method %u",
1856 relation->
rd_rel->relam);
1939 relation->
rd_rel->relisshared = isshared;
1947 relation->
rd_rel->relispopulated =
true;
1950 relation->
rd_rel->relpages = 0;
1951 relation->
rd_rel->reltuples = -1;
1952 relation->
rd_rel->relallvisible = 0;
1953 relation->
rd_rel->relallfrozen = 0;
1973 has_not_null =
false;
1974 for (
i = 0;
i < natts;
i++)
1979 has_not_null |=
attrs[
i].attnotnull;
2034 relation->
rd_rel->relhasindex =
false;
2039 relation->
rd_rel->relhasindex =
true;
2051#ifdef USE_ASSERT_CHECKING
2113 if (!
rd->rd_isvalid)
2161 .
name =
"relcache reference",
2249#ifdef RELCACHE_FORCE_RELEASE
2315 elog(
ERROR,
"could not find pg_class tuple for index %u",
2344 elog(
ERROR,
"cache lookup failed for index %u",
2355 relation->
rd_index->indnullsnotdistinct =
index->indnullsnotdistinct;
2717#define SWAPFIELD(fldtype, fldname) \
2719 fldtype _tmp = newrel->fldname; \
2720 newrel->fldname = relation->fldname; \
2721 relation->fldname = _tmp; \
2905 elog(
ERROR,
"relation %u is still open", rid);
3133#ifdef USE_ASSERT_CHECKING
3189 relid =
locallock->tag.lock.locktag_field2;
3205 for (
i = 0;
i < nrels;
i++)
3316#ifdef USE_ASSERT_CHECKING
3366 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3476 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3526 char relpersistence,
3531 int natts = tupDesc->
natts;
3567 elog(
ERROR,
"shared_relation flag for \"%s\" does not match IsSharedRelation(%u)",
3609 has_not_null =
false;
3610 for (
i = 0;
i < natts;
i++)
3615 datt->attidentity =
satt->attidentity;
3616 datt->attgenerated =
satt->attgenerated;
3617 datt->attnotnull =
satt->attnotnull;
3618 has_not_null |=
satt->attnotnull;
3621 if (
satt->attnotnull)
3626 dcatt->attnullability =
scatt->attnullability;
3644 rel->
rd_rel->relnamespace = relnamespace;
3646 rel->
rd_rel->relkind = relkind;
3647 rel->
rd_rel->relnatts = natts;
3653 rel->
rd_rel->relpersistence = relpersistence;
3654 switch (relpersistence)
3667 elog(
ERROR,
"invalid relpersistence: %c", relpersistence);
3673 rel->
rd_rel->relispopulated =
false;
3675 rel->
rd_rel->relispopulated =
true;
3695 for (
i = 0;
i < natts;
i++)
3700 rel->
rd_rel->reltablespace = reltablespace;
3709 rel->
rd_rel->relfilenode = relfilenumber;
3799 errmsg(
"index relfilenumber value not set when in binary upgrade mode")));
3809 errmsg(
"heap relfilenumber value not set when in binary upgrade mode")));
3817 errmsg(
"unexpected request for new relfilenumber in binary upgrade mode")));
3827 elog(
ERROR,
"could not find tuple for relation %u",
3893 elog(
ERROR,
"relation \"%s\" does not have storage",
3927 relation->
rd_rel->relisshared,
3948 classform->relpersistence = persistence;
4003#define INITRELCACHESIZE 400
4020 ctl.keysize =
sizeof(
Oid);
4092#define NUM_CRITICAL_SHARED_RELS 6
4149#define NUM_CRITICAL_LOCAL_RELS 4
4200#define NUM_CRITICAL_LOCAL_INDEXES 7
4237#define NUM_CRITICAL_SHARED_INDEXES 8
4263 bool restart =
false;
4311 elog(
ERROR,
"invalid relowner in pg_class entry for \"%s\"",
4329 relation->
rd_rel->relhasrules =
false;
4336 relation->
rd_rel->relhastriggers =
false;
4419 errmsg_internal(
"could not open critical system index %u", indexoid));
4420 ird->rd_isnailed =
true;
4453 for (
i = 0;
i < natts;
i++)
4538 elog(
WARNING,
"unexpected pg_attrdef record found for attribute %d of relation \"%s\"",
4545 adrel->rd_att, &isnull);
4547 elog(
WARNING,
"null adbin for attribute %d of relation \"%s\"",
4565 elog(
WARNING,
"%d pg_attrdef record(s) missing for relation \"%s\"",
4604 int ncheck = relation->
rd_rel->relchecks;
4664 if (found >= ncheck)
4666 elog(
WARNING,
"unexpected pg_constraint record found for relation \"%s\"",
4674 conrel->rd_att, &isnull);
4698 if (found != ncheck)
4699 elog(
WARNING,
"%d pg_constraint record(s) missing for relation \"%s\"",
4783 info->
conoid = constraint->oid;
4784 info->
conrelid = constraint->conrelid;
4785 info->
confrelid = constraint->confrelid;
4854 char replident = relation->
rd_rel->relreplident;
4892 if (!
index->indislive)
4904 if (!
index->indisunique ||
4918 if (
index->indisprimary &&
4919 (
index->indisvalid ||
4926 if (!
index->indimmediate)
4929 if (!
index->indisvalid)
4933 if (
index->indisreplident)
5449 int attrnum =
indexDesc->rd_index->indkey.values[
i];
5615 elog(
ERROR,
"could not open relation with OID %u",
5621 int attrnum =
indexDesc->rd_index->indkey.values[
i];
5732 elog(
ERROR,
"unexpected exclusion constraint record found for rel %s",
5739 conrel->rd_att, &isnull);
5741 elog(
ERROR,
"null conexclop for rel %s",
5750 elog(
ERROR,
"conexclop is not a 1-D Oid array");
5759 elog(
ERROR,
"exclusion constraint record missing for rel %s",
5770 elog(
ERROR,
"could not find strategy for operator %u in family %u",
5822 pubdesc->rf_valid_for_update =
true;
5823 pubdesc->rf_valid_for_delete =
true;
5824 pubdesc->cols_valid_for_update =
true;
5825 pubdesc->cols_valid_for_delete =
true;
5826 pubdesc->gencols_valid_for_update =
true;
5827 pubdesc->gencols_valid_for_delete =
true;
5838 pubdesc->rf_valid_for_update =
true;
5839 pubdesc->rf_valid_for_delete =
true;
5840 pubdesc->cols_valid_for_update =
true;
5841 pubdesc->cols_valid_for_delete =
true;
5842 pubdesc->gencols_valid_for_update =
true;
5843 pubdesc->gencols_valid_for_delete =
true;
5850 if (relation->
rd_rel->relispartition)
5858 foreach(
lc, ancestors)
5900 elog(
ERROR,
"cache lookup failed for publication %u", pubid);
5922 pubdesc->rf_valid_for_update =
false;
5924 pubdesc->rf_valid_for_delete =
false;
5960 if (
pubdesc->pubactions.pubinsert &&
pubdesc->pubactions.pubupdate &&
5961 pubdesc->pubactions.pubdelete &&
pubdesc->pubactions.pubtruncate &&
5970 if (
pubdesc->pubactions.pubinsert &&
pubdesc->pubactions.pubupdate &&
5971 pubdesc->pubactions.pubdelete &&
pubdesc->pubactions.pubtruncate &&
5972 !
pubdesc->cols_valid_for_update && !
pubdesc->cols_valid_for_delete)
5980 if (
pubdesc->pubactions.pubinsert &&
pubdesc->pubactions.pubupdate &&
5981 pubdesc->pubactions.pubdelete &&
pubdesc->pubactions.pubtruncate &&
5982 !
pubdesc->gencols_valid_for_update &&
5983 !
pubdesc->gencols_valid_for_delete)
6005 for (
int i = 0;
i < natts;
i++)
6037 for (
i = 0;
i < natts;
i++)
6045 if (attoptions != (
Datum) 0)
6058 for (
i = 0;
i < natts;
i++)
6102 const char *colname;
6235 if (
fread(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6292 has_not_null =
false;
6304 has_not_null |= attr->attnotnull;
6562 elog(
WARNING,
"found %d nailed shared rels and %d nailed shared indexes in init file, but expected %d and %d respectively",
6576 elog(
WARNING,
"found %d nailed rels and %d nailed indexes in init file, but expected %d and %d respectively",
6668 errmsg(
"could not create relation-cache initialization file \"%s\": %m",
6670 errdetail(
"Continuing anyway, but there's something wrong.")));
6679 if (
fwrite(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6695 if (
relform->relisshared != shared)
6942 snprintf(path,
sizeof(path),
"global/%s",
6957 snprintf(path,
sizeof(path),
"%s/%s/%s",
7000 errmsg(
"could not remove cache file \"%s\": %m",
const IndexAmRoutine * GetIndexAmRoutine(Oid amhandler)
bytea *(* amoptions_function)(Datum reloptions, bool validate)
#define DatumGetArrayTypeP(X)
Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
void bms_free(Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_copy(const Bitmapset *a)
#define TextDatumGetCString(d)
#define TopSubTransactionId
#define InvalidSubTransactionId
#define Assert(condition)
TransactionId MultiXactId
#define OidIsValid(objectId)
bool IsSystemRelation(Relation relation)
RelFileNumber GetNewRelFileNumber(Oid reltablespace, Relation pg_class, char relpersistence)
bool IsCatalogNamespace(Oid namespaceId)
bool IsCatalogRelation(Relation relation)
bool IsSharedRelation(Oid relationId)
void CreateCacheMemoryContext(void)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
Node * eval_const_expressions(PlannerInfo *root, Node *node)
Datum datumCopy(Datum value, bool typByVal, int typLen)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_term(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int err_generic_string(int field, const char *str)
int errdetail(const char *fmt,...) pg_attribute_printf(1
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
struct dirent * ReadDirExtended(DIR *dir, const char *dirname, int elevel)
DIR * AllocateDir(const char *dirname)
FILE * AllocateFile(const char *name, const char *mode)
#define palloc_object(type)
#define palloc_array(type, count)
#define palloc0_array(type, count)
#define palloc0_object(type)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
struct RelationData * Relation
RelFileNumber binary_upgrade_next_heap_pg_class_relfilenumber
const TableAmRoutine * GetHeapamTableAmRoutine(void)
HeapTuple heap_copytuple(HeapTuple tuple)
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
void heap_freetuple(HeapTuple htup)
HeapTupleData * HeapTuple
HeapTupleHeaderData * HeapTupleHeader
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static TransactionId HeapTupleHeaderGetXmin(const HeapTupleHeaderData *tup)
static void * GETSTRUCT(const HeapTupleData *tuple)
static void HeapTupleHeaderSetXmin(HeapTupleHeaderData *tup, TransactionId xid)
static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
#define IsParallelWorker()
RelFileNumber binary_upgrade_next_index_pg_class_relfilenumber
bytea * index_opclass_options(Relation indrel, AttrNumber attnum, Datum attoptions, bool validate)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
static int pg_cmp_s16(int16 a, int16 b)
void AcceptInvalidationMessages(void)
void CacheInvalidateRelcache(Relation relation)
List * list_concat_unique_oid(List *list1, const List *list2)
List * lappend(List *list, void *datum)
void list_sort(List *list, list_sort_comparator cmp)
List * list_difference_oid(const List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
List * lcons(void *datum, List *list)
int list_oid_cmp(const ListCell *p1, const ListCell *p2)
void list_free(List *list)
void list_free_deep(List *list)
void UnlockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void RelationInitLockInfo(Relation relation)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
#define InplaceUpdateTupleLock
Datum get_attoptions(Oid relid, int16 attnum)
Oid get_rel_namespace(Oid relid)
RegProcedure get_opcode(Oid opno)
int get_op_opfamily_strategy(Oid opno, Oid opfamily)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
char * get_qualified_objname(Oid nspid, char *objname)
char * get_namespace_name(Oid nspid)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
List * make_ands_implicit(Expr *clause)
char * MemoryContextStrdup(MemoryContext context, const char *string)
void * MemoryContextAlloc(MemoryContext context, Size size)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
void MemoryContextDeleteChildren(MemoryContext context)
MemoryContext CurrentMemoryContext
MemoryContext CacheMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define ALLOCSET_SMALL_SIZES
#define MemoryContextCopyAndSetIdentifier(cxt, id)
#define IsBootstrapProcessingMode()
#define InvalidMultiXactId
void namestrcpy(Name name, const char *str)
bool isTempOrTempToastNamespace(Oid namespaceId)
ProcNumber GetTempNamespaceProcNumber(Oid namespaceId)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
void fix_opfuncids(Node *node)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
List * get_partition_ancestors(Oid relid)
END_CATALOG_STRUCT typedef FormData_pg_am * Form_pg_am
static AmcheckOptions opts
END_CATALOG_STRUCT typedef FormData_pg_amproc * Form_pg_amproc
END_CATALOG_STRUCT typedef FormData_pg_attrdef * Form_pg_attrdef
#define ATTRIBUTE_FIXED_PART_SIZE
FormData_pg_attribute * Form_pg_attribute
#define ERRCODE_DATA_CORRUPTED
FormData_pg_class * Form_pg_class
void DeconstructFkConstraintRow(HeapTuple tuple, int *numfks, AttrNumber *conkey, AttrNumber *confkey, Oid *pf_eq_oprs, Oid *pp_eq_oprs, Oid *ff_eq_oprs, int *num_fk_del_set_cols, AttrNumber *fk_del_set_cols)
AttrNumber extractNotNullColumn(HeapTuple constrTup)
END_CATALOG_STRUCT typedef FormData_pg_constraint * Form_pg_constraint
END_CATALOG_STRUCT typedef FormData_pg_index * Form_pg_index
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
END_CATALOG_STRUCT typedef FormData_pg_opclass * Form_pg_opclass
List * GetAllTablesPublications(void)
List * GetRelationIncludedPublications(Oid relid)
List * GetSchemaPublications(Oid schemaid)
List * GetRelationExcludedPublications(Oid relid)
bool is_publishable_relation(Relation rel)
END_CATALOG_STRUCT typedef FormData_pg_publication * Form_pg_publication
END_CATALOG_STRUCT typedef FormData_pg_rewrite * Form_pg_rewrite
END_CATALOG_STRUCT typedef FormData_pg_statistic_ext * Form_pg_statistic_ext
void pgstat_unlink_relation(Relation rel)
void RelationBuildRowSecurity(Relation relation)
#define qsort(a, b, c, d)
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
#define PointerGetDatum(X)
#define PG_DIAG_SCHEMA_NAME
#define PG_DIAG_CONSTRAINT_NAME
#define PG_DIAG_TABLE_NAME
#define PG_DIAG_COLUMN_NAME
Expr * canonicalize_qual(Expr *qual, bool is_check)
#define INVALID_PROC_NUMBER
#define ProcNumberForTempRelations()
char * psprintf(const char *fmt,...)
bool pub_contains_invalid_column(Oid pubid, Relation relation, List *ancestors, bool pubviaroot, char pubgencols_type, bool *invalid_column_list, bool *invalid_gen_col)
bool pub_rf_contains_invalid_column(Oid pubid, Relation relation, List *ancestors, bool pubviaroot)
void * stringToNode(const char *str)
#define RelationGetForm(relation)
#define RelationHasReferenceCountZero(relation)
#define RelationGetRelid(relation)
#define RelationHasSecurityInvoker(relation)
#define RelationGetDescr(relation)
#define RelationIsMapped(relation)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
#define RelationIsAccessibleInLogicalDecoding(relation)
#define RelationIsValid(relation)
#define RelationGetNamespace(relation)
#define IndexRelationGetNumberOfAttributes(relation)
#define IndexRelationGetNumberOfKeyAttributes(relation)
#define RelationIsPermanent(relation)
static void RelationCloseSmgr(Relation relation)
#define RECOVER_RELATION_BUILD_MEMORY
List * RelationGetIndexList(Relation relation)
static int NextEOXactTupleDescNum
static bool load_relcache_init_file(bool shared)
static void RelationClearRelation(Relation relation)
void RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
static void RelationParseRelOptions(Relation relation, HeapTuple tuple)
void RelationCacheInvalidate(bool debug_discard)
#define NUM_CRITICAL_LOCAL_RELS
#define NUM_CRITICAL_SHARED_INDEXES
#define RelationCacheInsert(RELATION, replace_allowed)
void RelationDecrementReferenceCount(Relation rel)
static Relation RelationBuildDesc(Oid targetRelId, bool insertIt)
bool criticalRelcachesBuilt
static TupleDesc BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs)
static const FormData_pg_attribute Desc_pg_shseclabel[Natts_pg_shseclabel]
bool criticalSharedRelcachesBuilt
static Oid eoxact_list[MAX_EOXACT_LIST]
Oid RelationGetPrimaryKeyIndex(Relation relation, bool deferrable_ok)
static bytea ** CopyIndexAttOptions(bytea **srcopts, int natts)
static void formrdesc(const char *relationName, Oid relationReltype, bool isshared, int natts, const FormData_pg_attribute *attrs)
List * RelationGetDummyIndexExpressions(Relation relation)
static void ResOwnerReleaseRelation(Datum res)
static Relation AllocateRelationDesc(Form_pg_class relp)
static const FormData_pg_attribute Desc_pg_database[Natts_pg_database]
static void unlink_initfile(const char *initfilename, int elevel)
int errtableconstraint(Relation rel, const char *conname)
int errtablecol(Relation rel, int attnum)
void RelationInitIndexAccessInfo(Relation relation)
List * RelationGetIndexPredicate(Relation relation)
static void InitIndexAmRoutine(Relation relation)
static void write_item(const void *data, Size len, FILE *fp)
static const FormData_pg_attribute Desc_pg_attribute[Natts_pg_attribute]
static bool equalRuleLocks(RuleLock *rlock1, RuleLock *rlock2)
static int in_progress_list_maxlen
static void CheckNNConstraintFetch(Relation relation)
static int CheckConstraintCmp(const void *a, const void *b)
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
static void ResourceOwnerRememberRelationRef(ResourceOwner owner, Relation rel)
static void RelationRebuildRelation(Relation relation)
static const FormData_pg_attribute Desc_pg_class[Natts_pg_class]
static void RelationReloadNailed(Relation relation)
static const FormData_pg_attribute Desc_pg_authid[Natts_pg_authid]
static TupleDesc GetPgClassDescriptor(void)
static void AttrDefaultFetch(Relation relation, int ndef)
static HTAB * OpClassCache
static const ResourceOwnerDesc relref_resowner_desc
static void IndexSupportInitialize(oidvector *indclass, RegProcedure *indexSupport, Oid *opFamily, Oid *opcInType, StrategyNumber maxSupportNumber, AttrNumber maxAttributeNumber)
List * RelationGetStatExtList(Relation relation)
void RelationIncrementReferenceCount(Relation rel)
#define RelationCacheDelete(RELATION)
void RelationCacheInitFilePostInvalidate(void)
void RelationCacheInitializePhase3(void)
#define NUM_CRITICAL_SHARED_RELS
static void RelationDestroyRelation(Relation relation, bool remember_tupdesc)
#define EOXactListAdd(rel)
#define RelationIdCacheLookup(ID, RELATION)
void RelationInitTableAccessMethod(Relation relation)
static const FormData_pg_attribute Desc_pg_subscription[Natts_pg_subscription]
static void RelationFlushRelation(Relation relation)
static void RelationBuildRuleLock(Relation relation)
static void ResourceOwnerForgetRelationRef(ResourceOwner owner, Relation rel)
static int in_progress_list_len
static const FormData_pg_attribute Desc_pg_proc[Natts_pg_proc]
void RelationSetNewRelfilenumber(Relation relation, char persistence)
static const FormData_pg_attribute Desc_pg_index[Natts_pg_index]
static int EOXactTupleDescArrayLen
List * RelationGetFKeyList(Relation relation)
Oid RelationGetReplicaIndex(Relation relation)
Relation RelationIdGetRelation(Oid relationId)
static TupleDesc GetPgIndexDescriptor(void)
static void RelationCloseCleanup(Relation relation)
#define NUM_CRITICAL_LOCAL_INDEXES
static const FormData_pg_attribute Desc_pg_auth_members[Natts_pg_auth_members]
static void RelationCacheInitFileRemoveInDir(const char *tblspcpath)
static char * ResOwnerPrintRelCache(Datum res)
void AtEOXact_RelationCache(bool isCommit)
void RelationForgetRelation(Oid rid)
static void AtEOSubXact_cleanup(Relation relation, bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
void RelationCacheInitialize(void)
void RelationCacheInitFilePreInvalidate(void)
List * RelationGetIndexExpressions(Relation relation)
static void write_relcache_init_file(bool shared)
Relation RelationBuildLocalRelation(const char *relname, Oid relnamespace, TupleDesc tupDesc, Oid relid, Oid accessmtd, RelFileNumber relfilenumber, Oid reltablespace, bool shared_relation, bool mapped_relation, char relpersistence, char relkind)
static const FormData_pg_attribute Desc_pg_parameter_acl[Natts_pg_parameter_acl]
void RelationAssumeNewRelfilelocator(Relation relation)
static void RememberToFreeTupleDescAtEOX(TupleDesc td)
static HeapTuple ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic)
static void RelationInitPhysicalAddr(Relation relation)
static void RelationBuildTupleDesc(Relation relation)
static bool equalRSDesc(RowSecurityDesc *rsdesc1, RowSecurityDesc *rsdesc2)
void RelationCacheInitFileRemove(void)
static void AtEOXact_cleanup(Relation relation, bool isCommit)
int errtablecolname(Relation rel, const char *colname)
struct relidcacheent RelIdCacheEnt
static const FormData_pg_attribute Desc_pg_type[Natts_pg_type]
void RelationCacheInitializePhase2(void)
static InProgressEnt * in_progress_list
bool RelationIdIsInInitFile(Oid relationId)
static void RelationReloadIndexInfo(Relation relation)
static long relcacheInvalsReceived
static void load_critical_index(Oid indexoid, Oid heapoid)
static void InitTableAmRoutine(Relation relation)
int errtable(Relation rel)
void RelationCacheInvalidateEntry(Oid relationId)
static bool equalPolicy(RowSecurityPolicy *policy1, RowSecurityPolicy *policy2)
bytea ** RelationGetIndexAttOptions(Relation relation, bool copy)
Bitmapset * RelationGetIdentityKeyBitmap(Relation relation)
static int eoxact_list_len
struct opclasscacheent OpClassCacheEnt
static OpClassCacheEnt * LookupOpclassInfo(Oid operatorClassOid, StrategyNumber numSupport)
static TupleDesc * EOXactTupleDescArray
static bool eoxact_list_overflowed
void RelationGetExclusionInfo(Relation indexRelation, Oid **operators, Oid **procs, uint16 **strategies)
static int AttrDefaultCmp(const void *a, const void *b)
#define SWAPFIELD(fldtype, fldname)
char * RelationGetQualifiedRelationName(Relation rel)
#define RELCACHE_INIT_FILEMAGIC
static HTAB * RelationIdCache
struct inprogressent InProgressEnt
static void RelationInvalidateRelation(Relation relation)
void RelationClose(Relation relation)
#define RELCACHE_INIT_FILENAME
@ INDEX_ATTR_BITMAP_HOT_BLOCKING
@ INDEX_ATTR_BITMAP_PRIMARY_KEY
@ INDEX_ATTR_BITMAP_SUMMARIZED
@ INDEX_ATTR_BITMAP_IDENTITY_KEY
#define AssertPendingSyncs_RelationCache()
static void AssertCouldGetRelation(void)
void RelationMapInvalidateAll(void)
void RelationMapInitialize(void)
void RelationMapInitializePhase2(void)
RelFileNumber RelationMapOidToFilenumber(Oid relationId, bool shared)
void RelationMapUpdateMap(Oid relationId, RelFileNumber fileNumber, bool shared, bool immediate)
void RelationMapInitializePhase3(void)
bytea * extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, amoptions_function amoptions)
#define InvalidRelFileNumber
#define TABLESPACE_VERSION_DIRECTORY
#define RelFileNumberIsValid(relnumber)
ResourceOwner CurrentResourceOwner
void ResourceOwnerForget(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerRemember(ResourceOwner owner, Datum value, const ResourceOwnerDesc *kind)
void ResourceOwnerEnlarge(ResourceOwner owner)
@ RESOURCE_RELEASE_BEFORE_LOCKS
#define RELEASE_PRIO_RELCACHE_REFS
void setRuleCheckAsUser(Node *node, Oid userid)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
SMgrRelation smgropen(RelFileLocator rlocator, ProcNumber backend)
void smgrreleaseall(void)
void smgrclose(SMgrRelation reln)
void smgrdounlinkall(SMgrRelation *rels, int nrels, bool isRedo)
Snapshot GetTransactionSnapshot(void)
void UnregisterSnapshot(Snapshot snapshot)
void PushActiveSnapshot(Snapshot snapshot)
bool HistoricSnapshotActive(void)
Snapshot RegisterSnapshot(Snapshot snapshot)
void PopActiveSnapshot(void)
Snapshot GetNonHistoricCatalogSnapshot(Oid relid)
bool RelFileLocatorSkippingWAL(RelFileLocator rlocator)
SMgrRelation RelationCreateStorage(RelFileLocator rlocator, char relpersistence, bool register_delete)
void RelationDropStorage(Relation rel)
#define BTGreaterStrategyNumber
#define BTEqualStrategyNumber
amoptions_function amoptions
const struct IndexAmRoutine * rd_indam
MemoryContext rd_partkeycxt
const struct TableAmRoutine * rd_tableam
TransactionId rd_partdesc_nodetached_xmin
SubTransactionId rd_firstRelfilelocatorSubid
struct RowSecurityDesc * rd_rsdesc
PartitionDesc rd_partdesc
RegProcedure * rd_support
PartitionDesc rd_partdesc_nodetached
PublicationDesc * rd_pubdesc
struct FdwRoutine * rd_fdwroutine
struct HeapTupleData * rd_indextuple
MemoryContext rd_partcheckcxt
Bitmapset * rd_hotblockingattr
SubTransactionId rd_newRelfilelocatorSubid
SubTransactionId rd_createSubid
MemoryContext rd_indexcxt
RelFileLocator rd_locator
struct FmgrInfo * rd_supportinfo
SubTransactionId rd_droppedSubid
MemoryContext rd_rulescxt
Bitmapset * rd_summarizedattr
struct PgStat_TableStatus * pgstat_info
bool has_generated_virtual
bool has_generated_stored
struct AttrMissing * missing
CompactAttribute compact_attrs[FLEXIBLE_ARRAY_MEMBER]
StrategyNumber numSupport
RegProcedure * supportProcs
#define FirstLowInvalidHeapAttributeNumber
HeapTuple SearchSysCacheLockedCopy1(SysCacheIdentifier cacheId, Datum key1)
void ReleaseSysCache(HeapTuple tuple)
bool RelationSupportsSysCache(Oid relid)
void InitCatalogCachePhase2(void)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static void table_relation_set_new_filelocator(Relation rel, const RelFileLocator *newrlocator, char persistence, TransactionId *freezeXid, MultiXactId *minmulti)
const TableAmRoutine * GetTableAmRoutine(Oid amhandler)
#define InvalidTransactionId
void FreeTriggerDesc(TriggerDesc *trigdesc)
void RelationBuildTriggers(Relation relation)
void FreeTupleDesc(TupleDesc tupdesc)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescFinalize(TupleDesc tupdesc)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
void populate_compact_attribute(TupleDesc tupdesc, int attnum)
bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
#define ATTNULLABLE_UNKNOWN
#define ATTNULLABLE_VALID
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
#define ATTNULLABLE_INVALID
#define ATTNULLABLE_UNRESTRICTED
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
static Size VARSIZE(const void *PTR)
SubTransactionId GetCurrentSubTransactionId(void)
bool IsTransactionState(void)
void CommandCounterIncrement(void)
TransactionId GetCurrentTransactionId(void)
static struct rule * rules