65#include "catalog/schemapg.h"
84#include "utils/fmgroids.h"
93#define RELCACHE_INIT_FILEMAGIC 0x573266
99#if defined(RECOVER_RELATION_BUILD_MEMORY) && (RECOVER_RELATION_BUILD_MEMORY != 0)
100#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
102#define RECOVER_RELATION_BUILD_MEMORY 0
103#ifdef DISCARD_CACHES_ENABLED
104#define MAYBE_RECOVER_RELATION_BUILD_MEMORY 1
184#define MAX_EOXACT_LIST 32
189#define EOXactListAdd(rel) \
191 if (eoxact_list_len < MAX_EOXACT_LIST) \
192 eoxact_list[eoxact_list_len++] = (rel)->rd_id; \
194 eoxact_list_overflowed = true; \
209#define RelationCacheInsert(RELATION, replace_allowed) \
211 RelIdCacheEnt *hentry; bool found; \
212 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
213 &((RELATION)->rd_id), \
214 HASH_ENTER, &found); \
218 Relation _old_rel = hentry->reldesc; \
219 Assert(replace_allowed); \
220 hentry->reldesc = (RELATION); \
221 if (RelationHasReferenceCountZero(_old_rel)) \
222 RelationDestroyRelation(_old_rel, false); \
223 else if (!IsBootstrapProcessingMode()) \
224 elog(WARNING, "leaking still-referenced relcache entry for \"%s\"", \
225 RelationGetRelationName(_old_rel)); \
228 hentry->reldesc = (RELATION); \
231#define RelationIdCacheLookup(ID, RELATION) \
233 RelIdCacheEnt *hentry; \
234 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
238 RELATION = hentry->reldesc; \
243#define RelationCacheDelete(RELATION) \
245 RelIdCacheEnt *hentry; \
246 hentry = (RelIdCacheEnt *) hash_search(RelationIdCache, \
247 &((RELATION)->rd_id), \
248 HASH_REMOVE, NULL); \
249 if (hentry == NULL) \
250 elog(WARNING, "failed to delete relcache entry for OID %u", \
251 (RELATION)->rd_id); \
286#ifdef USE_ASSERT_CHECKING
287static void AssertPendingSyncConsistency(
Relation relation);
296static void formrdesc(
const char *relationName,
Oid relationReltype,
355 elog(
FATAL,
"cannot read pg_class without having selected a database");
379 if (force_non_historic)
403 return pg_class_tuple;
447 relation->
rd_rel = relationForm;
479 switch (relation->
rd_rel->relkind)
481 case RELKIND_RELATION:
482 case RELKIND_TOASTVALUE:
484 case RELKIND_MATVIEW:
485 case RELKIND_PARTITIONED_TABLE:
489 case RELKIND_PARTITIONED_INDEX:
538 relation->
rd_rel->reltype ? relation->
rd_rel->reltype : RECORDOID;
550 Anum_pg_attribute_attrelid,
554 Anum_pg_attribute_attnum,
565 AttributeRelidNumIndexId,
584 elog(
ERROR,
"invalid attribute number %d for relation \"%s\"",
594 if (attp->attnotnull)
596 if (attp->attgenerated == ATTRIBUTE_GENERATED_STORED)
598 if (attp->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL)
604 if (attp->atthasmissing)
611 Anum_pg_attribute_attmissingval,
612 pg_attribute_desc->
rd_att,
622 if (attrmiss == NULL)
625 relation->
rd_rel->relnatts *
666 elog(
ERROR,
"pg_attribute catalog is missing %d attribute(s) for relation OID %u",
685 relation->
rd_rel->relchecks > 0)
699 if (relation->
rd_rel->relchecks > 0 ||
710 for (
int i = 0;
i < relation->
rd_rel->relnatts;
i++)
724 if (relation->
rd_rel->relchecks == 0)
789 Anum_pg_rewrite_ev_class,
804 RewriteRelRulenameIndexId,
820 rule->ruleId = rewrite_form->oid;
822 rule->event = rewrite_form->ev_type -
'0';
823 rule->enabled = rewrite_form->ev_enabled;
824 rule->isInstead = rewrite_form->is_instead;
833 Anum_pg_rewrite_ev_action,
844 Anum_pg_rewrite_ev_qual,
863 relation->
rd_rel->relkind == RELKIND_VIEW &&
867 check_as_user = relation->
rd_rel->relowner;
883 if (numlocks >= maxlocks)
961 else if (rlock2 != NULL)
1006 else if (policy2 != NULL)
1023 if (rsdesc1 == NULL && rsdesc2 == NULL)
1026 if ((rsdesc1 != NULL && rsdesc2 == NULL) ||
1027 (rsdesc1 == NULL && rsdesc2 != NULL))
1061 int in_progress_offset;
1082#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1089 "RelationBuildDesc workspace",
1120#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1138 Assert(relid == targetRelId);
1161 switch (relation->
rd_rel->relpersistence)
1163 case RELPERSISTENCE_UNLOGGED:
1164 case RELPERSISTENCE_PERMANENT:
1168 case RELPERSISTENCE_TEMP:
1196 elog(
ERROR,
"invalid relpersistence: %c",
1197 relation->
rd_rel->relpersistence);
1225 if (relation->
rd_rel->relkind == RELKIND_INDEX ||
1226 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
1228 else if (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind) ||
1229 relation->
rd_rel->relkind == RELKIND_SEQUENCE)
1231 else if (relation->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
1250 if (relation->
rd_rel->relhasrules)
1258 if (relation->
rd_rel->relhastriggers)
1263 if (relation->
rd_rel->relrowsecurity)
1319#ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1344 if (!RELKIND_HAS_STORAGE(relation->
rd_rel->relkind))
1347 if (relation->
rd_rel->reltablespace)
1356 if (relation->
rd_rel->relfilenode)
1379 elog(
ERROR,
"could not find pg_class entry for %u",
1383 relation->
rd_rel->reltablespace = physrel->reltablespace;
1384 relation->
rd_rel->relfilenode = physrel->relfilenode;
1395 relation->
rd_rel->relisshared);
1397 elog(
ERROR,
"could not find relation mapping for relation \"%s\", OID %u",
1450 Datum indclassDatum;
1451 Datum indoptionDatum;
1470 elog(
ERROR,
"cache lookup failed for index %u",
1484 elog(
ERROR,
"cache lookup failed for access method %u",
1485 relation->
rd_rel->relam);
1492 elog(
ERROR,
"relnatts disagrees with indnatts for index %u",
1525 int nsupport = indnatts * amsupport;
1550 Anum_pg_index_indcollation,
1563 Anum_pg_index_indclass,
1576 amsupport, indnkeyatts);
1582 Anum_pg_index_indoption,
1625 for (attIndex = 0; attIndex < maxAttributeNumber; attIndex++)
1637 opFamily[attIndex] = opcentry->
opcfamily;
1638 opcInType[attIndex] = opcentry->
opcintype;
1639 if (maxSupportNumber > 0)
1640 memcpy(&indexSupport[attIndex * maxSupportNumber],
1687 ctl.keysize =
sizeof(
Oid);
1700 opcentry->
valid =
false;
1718#ifdef DISCARD_CACHES_ENABLED
1720 opcentry->
valid =
false;
1723 if (opcentry->
valid)
1741 (operatorClassOid != OID_BTREE_OPS_OID &&
1742 operatorClassOid != INT2_BTREE_OPS_OID);
1751 Anum_pg_opclass_oid,
1762 opcentry->
opcfamily = opclassform->opcfamily;
1763 opcentry->
opcintype = opclassform->opcintype;
1766 elog(
ERROR,
"could not find tuple for opclass %u", operatorClassOid);
1778 Anum_pg_amproc_amprocfamily,
1782 Anum_pg_amproc_amproclefttype,
1786 Anum_pg_amproc_amprocrighttype,
1797 if (amprocform->amprocnum <= 0 ||
1799 elog(
ERROR,
"invalid amproc number %d for opclass %u",
1800 amprocform->amprocnum, operatorClassOid);
1810 opcentry->
valid =
true;
1834 if (relation->
rd_rel->relkind == RELKIND_SEQUENCE)
1862 elog(
ERROR,
"cache lookup failed for access method %u",
1863 relation->
rd_rel->relam);
1939 relation->
rd_rel->relnamespace = PG_CATALOG_NAMESPACE;
1940 relation->
rd_rel->reltype = relationReltype;
1946 relation->
rd_rel->relisshared = isshared;
1948 relation->
rd_rel->reltablespace = GLOBALTABLESPACE_OID;
1951 relation->
rd_rel->relpersistence = RELPERSISTENCE_PERMANENT;
1954 relation->
rd_rel->relispopulated =
true;
1956 relation->
rd_rel->relreplident = REPLICA_IDENTITY_NOTHING;
1957 relation->
rd_rel->relpages = 0;
1958 relation->
rd_rel->reltuples = -1;
1959 relation->
rd_rel->relallvisible = 0;
1960 relation->
rd_rel->relallfrozen = 0;
1961 relation->
rd_rel->relkind = RELKIND_RELATION;
1980 has_not_null =
false;
1981 for (
i = 0;
i < natts;
i++)
1986 has_not_null |= attrs[
i].attnotnull;
2033 relation->
rd_rel->relam = HEAP_TABLE_AM_OID;
2042 relation->
rd_rel->relhasindex =
false;
2047 relation->
rd_rel->relhasindex =
true;
2059#ifdef USE_ASSERT_CHECKING
2072 AssertBufferLocksPermitCatalogRead();
2159 .
name =
"relcache reference",
2247#ifdef RELCACHE_FORCE_RELEASE
2284 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX) &&
2313 elog(
ERROR,
"could not find pg_class tuple for index %u",
2342 elog(
ERROR,
"cache lookup failed for index %u",
2353 relation->
rd_index->indnullsnotdistinct =
index->indnullsnotdistinct;
2471 if (remember_tupdesc)
2606 if ((relation->
rd_rel->relkind == RELKIND_INDEX ||
2607 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX) &&
2689 elog(
ERROR,
"relation %u deleted while still in use", save_relid);
2703 keep_partkey = (relation->
rd_partkey != NULL);
2715#define SWAPFIELD(fldtype, fldname) \
2717 fldtype _tmp = newrel->fldname; \
2718 newrel->fldname = relation->fldname; \
2719 relation->fldname = _tmp; \
2903 elog(
ERROR,
"relation %u is still open", rid);
3058 rebuildFirstList =
lcons(relation, rebuildFirstList);
3060 rebuildFirstList =
lappend(rebuildFirstList, relation);
3062 rebuildList =
lcons(relation, rebuildList);
3064 rebuildList =
lappend(rebuildList, relation);
3078 foreach(l, rebuildFirstList)
3087 foreach(l, rebuildList)
3131#ifdef USE_ASSERT_CHECKING
3133AssertPendingSyncConsistency(
Relation relation)
3135 bool relcache_verdict =
3138 RELKIND_HAS_STORAGE(relation->
rd_rel->relkind)) ||
3174 rels =
palloc(maxrels *
sizeof(*rels));
3182 if (locallock->
nLocks <= 0)
3191 if (nrels >= maxrels)
3194 rels =
repalloc(rels, maxrels *
sizeof(*rels));
3201 AssertPendingSyncConsistency(idhentry->
reldesc);
3203 for (
i = 0;
i < nrels;
i++)
3266 if (idhentry != NULL)
3298 bool clear_relcache =
false;
3314#ifdef USE_ASSERT_CHECKING
3317 int expected_refcnt;
3364 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3404 mySubid, parentSubid);
3415 if (idhentry != NULL)
3417 mySubid, parentSubid);
3474 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3522 bool shared_relation,
3523 bool mapped_relation,
3524 char relpersistence,
3529 int natts = tupDesc->
natts;
3544 case DatabaseRelationId:
3545 case AuthIdRelationId:
3546 case AuthMemRelationId:
3547 case RelationRelationId:
3548 case AttributeRelationId:
3549 case ProcedureRelationId:
3550 case TypeRelationId:
3565 elog(
ERROR,
"shared_relation flag for \"%s\" does not match IsSharedRelation(%u)",
3569 Assert(mapped_relation || !shared_relation);
3607 has_not_null =
false;
3608 for (
i = 0;
i < natts;
i++)
3613 datt->attidentity = satt->attidentity;
3614 datt->attgenerated = satt->attgenerated;
3615 datt->attnotnull = satt->attnotnull;
3616 has_not_null |= satt->attnotnull;
3619 if (satt->attnotnull)
3642 rel->
rd_rel->relnamespace = relnamespace;
3644 rel->
rd_rel->relkind = relkind;
3645 rel->
rd_rel->relnatts = natts;
3648 rel->
rd_rel->relowner = BOOTSTRAP_SUPERUSERID;
3651 rel->
rd_rel->relpersistence = relpersistence;
3652 switch (relpersistence)
3654 case RELPERSISTENCE_UNLOGGED:
3655 case RELPERSISTENCE_PERMANENT:
3659 case RELPERSISTENCE_TEMP:
3665 elog(
ERROR,
"invalid relpersistence: %c", relpersistence);
3670 if (relkind == RELKIND_MATVIEW)
3671 rel->
rd_rel->relispopulated =
false;
3673 rel->
rd_rel->relispopulated =
true;
3677 (relkind == RELKIND_RELATION ||
3678 relkind == RELKIND_MATVIEW ||
3679 relkind == RELKIND_PARTITIONED_TABLE))
3680 rel->
rd_rel->relreplident = REPLICA_IDENTITY_DEFAULT;
3682 rel->
rd_rel->relreplident = REPLICA_IDENTITY_NOTHING;
3689 rel->
rd_rel->relisshared = shared_relation;
3693 for (
i = 0;
i < natts;
i++)
3696 rel->
rd_rel->reltablespace = reltablespace;
3698 if (mapped_relation)
3705 rel->
rd_rel->relfilenode = relfilenumber;
3711 rel->
rd_rel->relam = accessmtd;
3720 if (RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_SEQUENCE)
3790 else if (relation->
rd_rel->relkind == RELKIND_INDEX)
3794 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3795 errmsg(
"index relfilenumber value not set when in binary upgrade mode")));
3800 else if (relation->
rd_rel->relkind == RELKIND_RELATION)
3804 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3805 errmsg(
"heap relfilenumber value not set when in binary upgrade mode")));
3812 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3813 errmsg(
"unexpected request for new relfilenumber in binary upgrade mode")));
3823 elog(
ERROR,
"could not find tuple for relation %u",
3870 newrlocator.
relNumber = newrelfilenumber;
3872 if (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind))
3876 &freezeXid, &minmulti);
3878 else if (RELKIND_HAS_STORAGE(relation->
rd_rel->relkind))
3889 elog(
ERROR,
"relation \"%s\" does not have storage",
3908 Assert(classform->relfrozenxid == freezeXid);
3909 Assert(classform->relminmxid == minmulti);
3910 Assert(classform->relpersistence == persistence);
3923 relation->
rd_rel->relisshared,
3932 classform->relfilenode = newrelfilenumber;
3935 if (relation->
rd_rel->relkind != RELKIND_SEQUENCE)
3937 classform->relpages = 0;
3938 classform->reltuples = -1;
3939 classform->relallvisible = 0;
3940 classform->relallfrozen = 0;
3942 classform->relfrozenxid = freezeXid;
3943 classform->relminmxid = minmulti;
3944 classform->relpersistence = persistence;
3999#define INITRELCACHESIZE 400
4016 ctl.keysize =
sizeof(
Oid);
4075 formrdesc(
"pg_database", DatabaseRelation_Rowtype_Id,
true,
4077 formrdesc(
"pg_authid", AuthIdRelation_Rowtype_Id,
true,
4079 formrdesc(
"pg_auth_members", AuthMemRelation_Rowtype_Id,
true,
4081 formrdesc(
"pg_shseclabel", SharedSecLabelRelation_Rowtype_Id,
true,
4083 formrdesc(
"pg_subscription", SubscriptionRelation_Rowtype_Id,
true,
4086#define NUM_CRITICAL_SHARED_RELS 5
4132 needNewCacheFile =
true;
4134 formrdesc(
"pg_class", RelationRelation_Rowtype_Id,
false,
4136 formrdesc(
"pg_attribute", AttributeRelation_Rowtype_Id,
false,
4138 formrdesc(
"pg_proc", ProcedureRelation_Rowtype_Id,
false,
4140 formrdesc(
"pg_type", TypeRelation_Rowtype_Id,
false,
4143#define NUM_CRITICAL_LOCAL_RELS 4
4180 RelationRelationId);
4182 AttributeRelationId);
4186 OperatorClassRelationId);
4188 AccessMethodProcedureRelationId);
4194#define NUM_CRITICAL_LOCAL_INDEXES 7
4214 DatabaseRelationId);
4216 DatabaseRelationId);
4224 SharedSecLabelRelationId);
4226#define NUM_CRITICAL_SHARED_INDEXES 6
4252 bool restart =
false;
4271 errcode(ERRCODE_UNDEFINED_OBJECT),
4300 elog(
ERROR,
"invalid relowner in pg_class entry for \"%s\"",
4318 relation->
rd_rel->relhasrules =
false;
4321 if (relation->
rd_rel->relhastriggers && relation->
trigdesc == NULL)
4325 relation->
rd_rel->relhastriggers =
false;
4346 (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind) || relation->
rd_rel->relkind == RELKIND_SEQUENCE))
4369 if (needNewCacheFile)
4408 errmsg_internal(
"could not open critical system index %u", indexoid));
4442 for (
i = 0;
i < natts;
i++)
4465 if (pgclassdesc == NULL)
4478 if (pgindexdesc == NULL)
4511 Anum_pg_attrdef_adrelid,
4528 elog(
WARNING,
"unexpected pg_attrdef record found for attribute %d of relation \"%s\"",
4534 Anum_pg_attrdef_adbin,
4537 elog(
WARNING,
"null adbin for attribute %d of relation \"%s\"",
4544 attrdef[found].
adnum = adform->adnum;
4555 elog(
WARNING,
"%d pg_attrdef record(s) missing for relation \"%s\"",
4594 int ncheck = relation->
rd_rel->relchecks;
4608 Anum_pg_constraint_conrelid,
4630 if (conform->contype == CONSTRAINT_NOTNULL)
4632 if (!conform->convalidated)
4647 if (conform->contype != CONSTRAINT_CHECK)
4651 if (found >= ncheck)
4653 elog(
WARNING,
"unexpected pg_constraint record found for relation \"%s\"",
4658 check[found].
ccenforced = conform->conenforced;
4659 check[found].
ccvalid = conform->convalidated;
4666 Anum_pg_constraint_conbin,
4667 conrel->
rd_att, &isnull);
4685 if (found != ncheck)
4686 elog(
WARNING,
"%d pg_constraint record(s) missing for relation \"%s\"",
4752 Anum_pg_constraint_conrelid,
4766 if (constraint->contype != CONSTRAINT_FOREIGN)
4770 info->
conoid = constraint->oid;
4771 info->
conrelid = constraint->conrelid;
4772 info->
confrelid = constraint->confrelid;
4779 NULL, NULL, NULL, NULL);
4782 result =
lappend(result, info);
4841 char replident = relation->
rd_rel->relreplident;
4844 bool pkdeferrable =
false;
4861 Anum_pg_index_indrelid,
4879 if (!
index->indislive)
4891 if (!
index->indisunique ||
4905 if (
index->indisprimary &&
4906 (
index->indisvalid ||
4907 relation->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE))
4909 pkeyIndex =
index->indexrelid;
4910 pkdeferrable = !
index->indimmediate;
4913 if (!
index->indimmediate)
4916 if (!
index->indisvalid)
4920 if (
index->indisreplident)
4921 candidateIndex =
index->indexrelid;
4937 if (replident == REPLICA_IDENTITY_DEFAULT &&
OidIsValid(pkeyIndex) && !pkdeferrable)
4939 else if (replident == REPLICA_IDENTITY_INDEX &&
OidIsValid(candidateIndex))
5001 Anum_pg_statistic_ext_stxrelid,
5117 Anum_pg_index_indexprs,
5169 Anum_pg_index_indexprs,
5179 foreach(lc, rawExprs)
5230 Anum_pg_index_indpred,
5308 List *newindexoidlist;
5330 elog(
ERROR,
"unknown attrKind %u", attrKind);
5345 if (indexoidlist ==
NIL)
5369 pkindexattrs = NULL;
5370 idindexattrs = NULL;
5371 hotblockingattrs = NULL;
5372 summarizedattrs = NULL;
5373 foreach(l, indexoidlist)
5379 Node *indexExpressions;
5380 Node *indexPredicate;
5403 indexExpressions = NULL;
5410 indexPredicate = NULL;
5413 isKey = indexDesc->
rd_index->indisunique &&
5414 indexExpressions == NULL &&
5415 indexPredicate == NULL;
5418 isPK = (indexOid == relpkindex);
5421 isIDKey = (indexOid == relreplindex);
5429 attrs = &summarizedattrs;
5431 attrs = &hotblockingattrs;
5434 for (
i = 0;
i < indexDesc->
rd_index->indnatts;
i++)
5436 int attrnum = indexDesc->
rd_index->indkey.values[
i];
5457 if (isKey && i < indexDesc->rd_index->indnkeyatts)
5461 if (isPK && i < indexDesc->rd_index->indnkeyatts)
5465 if (isIDKey && i < indexDesc->rd_index->indnkeyatts)
5487 if (
equal(indexoidlist, newindexoidlist) &&
5544 return pkindexattrs;
5546 return idindexattrs;
5548 return hotblockingattrs;
5550 return summarizedattrs;
5552 elog(
ERROR,
"unknown attrKind %u", attrKind);
5602 elog(
ERROR,
"could not open relation with OID %u",
5606 for (
i = 0;
i < indexDesc->
rd_index->indnatts;
i++)
5608 int attrnum = indexDesc->
rd_index->indkey.values[
i];
5616 if (i < indexDesc->rd_index->indnkeyatts)
5634 return idindexattrs;
5670 *operators = ops = (
Oid *)
palloc(
sizeof(
Oid) * indnkeyatts);
5671 *procs = funcs = (
Oid *)
palloc(
sizeof(
Oid) * indnkeyatts);
5677 memcpy(ops, indexRelation->
rd_exclops,
sizeof(
Oid) * indnkeyatts);
5678 memcpy(funcs, indexRelation->
rd_exclprocs,
sizeof(
Oid) * indnkeyatts);
5693 Anum_pg_constraint_conrelid,
5711 if ((conform->contype != CONSTRAINT_EXCLUSION &&
5712 !(conform->conperiod && (conform->contype == CONSTRAINT_PRIMARY
5713 || conform->contype == CONSTRAINT_UNIQUE))) ||
5719 elog(
ERROR,
"unexpected exclusion constraint record found for rel %s",
5725 Anum_pg_constraint_conexclop,
5726 conrel->
rd_att, &isnull);
5728 elog(
ERROR,
"null conexclop for rel %s",
5734 nelem != indnkeyatts ||
5737 elog(
ERROR,
"conexclop is not a 1-D Oid array");
5746 elog(
ERROR,
"exclusion constraint record missing for rel %s",
5750 for (
i = 0;
i < indnkeyatts;
i++)
5757 elog(
ERROR,
"could not find strategy for operator %u in family %u",
5766 memcpy(indexRelation->
rd_exclops, ops,
sizeof(
Oid) * indnkeyatts);
5767 memcpy(indexRelation->
rd_exclprocs, funcs,
sizeof(
Oid) * indnkeyatts);
5835 if (relation->
rd_rel->relispartition)
5840 foreach(lc, ancestors)
5853 foreach(lc, puboids)
5858 bool invalid_column_list;
5859 bool invalid_gen_col;
5864 elog(
ERROR,
"cache lookup failed for publication %u", pubid);
5880 if (!pubform->puballtables &&
5881 (pubform->pubupdate || pubform->pubdelete) &&
5883 pubform->pubviaroot))
5885 if (pubform->pubupdate)
5887 if (pubform->pubdelete)
5897 if ((pubform->pubupdate || pubform->pubdelete) &&
5899 pubform->pubviaroot,
5900 pubform->pubgencols,
5901 &invalid_column_list,
5904 if (pubform->pubupdate)
5910 if (pubform->pubdelete)
5969 for (
int i = 0;
i < natts;
i++)
6001 for (
i = 0;
i < natts;
i++)
6009 if (attoptions != (
Datum) 0)
6022 for (
i = 0;
i < natts;
i++)
6066 const char *colname;
6069 if (
attnum > 0 && attnum <= reldesc->natts)
6178 snprintf(initfilename,
sizeof(initfilename),
"global/%s",
6181 snprintf(initfilename,
sizeof(initfilename),
"%s/%s",
6196 nailed_rels = nailed_indexes = 0;
6199 if (fread(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6204 for (relno = 0;; relno++)
6213 nread = fread(&
len, 1,
sizeof(
len), fp);
6214 if (nread !=
sizeof(
len))
6226 if (num_rels >= max_rels)
6235 if (fread(rel, 1,
len, fp) !=
len)
6239 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6243 if (fread(relform, 1,
len, fp) !=
len)
6252 rel->
rd_att->
tdtypeid = relform->reltype ? relform->reltype : RECORDOID;
6256 has_not_null =
false;
6257 for (
i = 0;
i < relform->relnatts;
i++)
6261 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6265 if (fread(attr, 1,
len, fp) !=
len)
6268 has_not_null |= attr->attnotnull;
6274 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6302 if (rel->
rd_rel->relkind == RELKIND_INDEX)
6317 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6348 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6352 if (fread(opfamily, 1,
len, fp) !=
len)
6358 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6362 if (fread(opcintype, 1,
len, fp) !=
len)
6368 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6371 if (fread(support, 1,
len, fp) !=
len)
6377 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6381 if (fread(indcollation, 1,
len, fp) !=
len)
6387 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6391 if (fread(indoption, 1,
len, fp) !=
len)
6400 for (
i = 0;
i < relform->relnatts;
i++)
6402 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6425 if (RELKIND_HAS_TABLE_AM(rel->
rd_rel->relkind) || rel->
rd_rel->relkind == RELKIND_SEQUENCE)
6524 elog(
WARNING,
"found %d nailed shared rels and %d nailed shared indexes in init file, but expected %d and %d respectively",
6525 nailed_rels, nailed_indexes,
6538 elog(
WARNING,
"found %d nailed rels and %d nailed indexes in init file, but expected %d and %d respectively",
6539 nailed_rels, nailed_indexes,
6551 for (relno = 0; relno < num_rels; relno++)
6606 snprintf(tempfilename,
sizeof(tempfilename),
"global/%s.%d",
6608 snprintf(finalfilename,
sizeof(finalfilename),
"global/%s",
6613 snprintf(tempfilename,
sizeof(tempfilename),
"%s/%s.%d",
6615 snprintf(finalfilename,
sizeof(finalfilename),
"%s/%s",
6619 unlink(tempfilename);
6630 errmsg(
"could not create relation-cache initialization file \"%s\": %m",
6632 errdetail(
"Continuing anyway, but there's something wrong.")));
6641 if (fwrite(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6657 if (relform->relisshared != shared)
6684 for (
i = 0;
i < relform->relnatts;
i++)
6699 if (rel->
rd_rel->relkind == RELKIND_INDEX)
6709 relform->relnatts *
sizeof(
Oid),
6714 relform->relnatts *
sizeof(
Oid),
6724 relform->relnatts *
sizeof(
Oid),
6729 relform->relnatts *
sizeof(
int16),
6735 for (
i = 0;
i < relform->relnatts;
i++)
6780 if (rename(tempfilename, finalfilename) < 0)
6781 unlink(tempfilename);
6786 unlink(tempfilename);
6796 if (fwrite(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6819 if (relationId == SharedSecLabelRelationId ||
6820 relationId == TriggerRelidNameIndexId ||
6821 relationId == DatabaseNameIndexId ||
6822 relationId == SharedSecLabelObjectIndexId)
6863 snprintf(localinitfname,
sizeof(localinitfname),
"%s/%s",
6865 snprintf(sharedinitfname,
sizeof(sharedinitfname),
"global/%s",
6904 snprintf(path,
sizeof(path),
"global/%s",
6916 if (strspn(de->
d_name,
"0123456789") == strlen(de->
d_name))
6919 snprintf(path,
sizeof(path),
"%s/%s/%s",
6941 if (strspn(de->
d_name,
"0123456789") == strlen(de->
d_name))
6944 snprintf(initfilename,
sizeof(initfilename),
"%s/%s/%s",
6956 if (unlink(initfilename) < 0)
6959 if (errno != ENOENT)
6962 errmsg(
"could not remove cache file \"%s\": %m",
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
TransactionId MultiXactId
#define PointerIsValid(pointer)
#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)
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)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_term(HASH_SEQ_STATUS *status)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int err_generic_string(int field, const char *str)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#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)
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)
Assert(PointerIsAligned(start, uint64))
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, ItemPointer 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_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 UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void RelationInitLockInfo(Relation relation)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
void UnlockTuple(Relation relation, ItemPointer tid, 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_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)
FormData_pg_am * Form_pg_am
static AmcheckOptions opts
FormData_pg_amproc * Form_pg_amproc
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)
FormData_pg_constraint * Form_pg_constraint
FormData_pg_index * Form_pg_index
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
FormData_pg_opclass * Form_pg_opclass
List * GetRelationPublications(Oid relid)
List * GetAllTablesPublications(void)
List * GetSchemaPublications(Oid schemaid)
bool is_publishable_relation(Relation rel)
FormData_pg_publication * Form_pg_publication
FormData_pg_rewrite * Form_pg_rewrite
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 PointerGetDatum(const void *X)
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum 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)
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)
#define RELCACHE_INIT_FILEMAGIC
static HTAB * RelationIdCache
struct inprogressent InProgressEnt
static void RelationInvalidateRelation(Relation relation)
void RelationClose(Relation relation)
struct RelationData * 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
PublicationActions pubactions
bool cols_valid_for_delete
bool gencols_valid_for_update
bool cols_valid_for_update
bool gencols_valid_for_delete
MemoryContext rd_partkeycxt
const struct TableAmRoutine * rd_tableam
TransactionId rd_partdesc_nodetached_xmin
struct IndexAmRoutine * rd_indam
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]
int16 values[FLEXIBLE_ARRAY_MEMBER]
Oid values[FLEXIBLE_ARRAY_MEMBER]
StrategyNumber numSupport
RegProcedure * supportProcs
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCacheLockedCopy1(int cacheId, Datum key1)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
bool RelationSupportsSysCache(Oid relid)
void InitCatalogCachePhase2(void)
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)
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)
SubTransactionId GetCurrentSubTransactionId(void)
bool IsTransactionState(void)
void CommandCounterIncrement(void)
TransactionId GetCurrentTransactionId(void)
static struct rule * rules