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); \
284 #ifdef USE_ASSERT_CHECKING
285 static void AssertPendingSyncConsistency(
Relation relation);
294 static void formrdesc(
const char *relationName,
Oid relationReltype,
353 elog(
FATAL,
"cannot read pg_class without having selected a database");
378 if (force_non_historic)
398 return pg_class_tuple;
442 relation->
rd_rel = relationForm;
474 switch (relation->
rd_rel->relkind)
476 case RELKIND_RELATION:
477 case RELKIND_TOASTVALUE:
479 case RELKIND_MATVIEW:
480 case RELKIND_PARTITIONED_TABLE:
484 case RELKIND_PARTITIONED_INDEX:
533 relation->
rd_rel->reltype ? relation->
rd_rel->reltype : RECORDOID;
547 Anum_pg_attribute_attrelid,
551 Anum_pg_attribute_attnum,
562 AttributeRelidNumIndexId,
581 elog(
ERROR,
"invalid attribute number %d for relation \"%s\"",
589 if (attp->attnotnull)
591 if (attp->attgenerated == ATTRIBUTE_GENERATED_STORED)
597 if (attp->atthasmissing)
604 Anum_pg_attribute_attmissingval,
605 pg_attribute_desc->
rd_att,
615 if (attrmiss == NULL)
618 relation->
rd_rel->relnatts *
659 elog(
ERROR,
"pg_attribute catalog is missing %d attribute(s) for relation OID %u",
667 #ifdef USE_ASSERT_CHECKING
691 relation->
rd_rel->relchecks > 0)
702 if (relation->
rd_rel->relchecks > 0)
769 Anum_pg_rewrite_ev_class,
784 RewriteRelRulenameIndexId,
800 rule->ruleId = rewrite_form->oid;
802 rule->event = rewrite_form->ev_type -
'0';
803 rule->enabled = rewrite_form->ev_enabled;
804 rule->isInstead = rewrite_form->is_instead;
813 Anum_pg_rewrite_ev_action,
824 Anum_pg_rewrite_ev_qual,
843 relation->
rd_rel->relkind == RELKIND_VIEW &&
847 check_as_user = relation->
rd_rel->relowner;
863 if (numlocks >= maxlocks)
941 else if (rlock2 != NULL)
986 else if (policy2 != NULL)
1003 if (rsdesc1 == NULL && rsdesc2 == NULL)
1006 if ((rsdesc1 != NULL && rsdesc2 == NULL) ||
1007 (rsdesc1 == NULL && rsdesc2 != NULL))
1041 int in_progress_offset;
1062 #ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1069 "RelationBuildDesc workspace",
1100 #ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1118 Assert(relid == targetRelId);
1141 switch (relation->
rd_rel->relpersistence)
1143 case RELPERSISTENCE_UNLOGGED:
1144 case RELPERSISTENCE_PERMANENT:
1148 case RELPERSISTENCE_TEMP:
1176 elog(
ERROR,
"invalid relpersistence: %c",
1177 relation->
rd_rel->relpersistence);
1205 if (relation->
rd_rel->relkind == RELKIND_INDEX ||
1206 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
1208 else if (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind) ||
1209 relation->
rd_rel->relkind == RELKIND_SEQUENCE)
1223 if (relation->
rd_rel->relhasrules)
1231 if (relation->
rd_rel->relhastriggers)
1236 if (relation->
rd_rel->relrowsecurity)
1292 #ifdef MAYBE_RECOVER_RELATION_BUILD_MEMORY
1317 if (!RELKIND_HAS_STORAGE(relation->
rd_rel->relkind))
1320 if (relation->
rd_rel->reltablespace)
1329 if (relation->
rd_rel->relfilenode)
1352 elog(
ERROR,
"could not find pg_class entry for %u",
1356 relation->
rd_rel->reltablespace = physrel->reltablespace;
1357 relation->
rd_rel->relfilenode = physrel->relfilenode;
1368 relation->
rd_rel->relisshared);
1370 elog(
ERROR,
"could not find relation mapping for relation \"%s\", OID %u",
1423 Datum indclassDatum;
1424 Datum indoptionDatum;
1443 elog(
ERROR,
"cache lookup failed for index %u",
1457 elog(
ERROR,
"cache lookup failed for access method %u",
1458 relation->
rd_rel->relam);
1465 elog(
ERROR,
"relnatts disagrees with indnatts for index %u",
1498 int nsupport = indnatts * amsupport;
1523 Anum_pg_index_indcollation,
1536 Anum_pg_index_indclass,
1549 amsupport, indnkeyatts);
1555 Anum_pg_index_indoption,
1598 for (attIndex = 0; attIndex < maxAttributeNumber; attIndex++)
1610 opFamily[attIndex] = opcentry->
opcfamily;
1611 opcInType[attIndex] = opcentry->
opcintype;
1612 if (maxSupportNumber > 0)
1613 memcpy(&indexSupport[attIndex * maxSupportNumber],
1673 opcentry->
valid =
false;
1691 #ifdef DISCARD_CACHES_ENABLED
1693 opcentry->
valid =
false;
1696 if (opcentry->
valid)
1714 (operatorClassOid != OID_BTREE_OPS_OID &&
1715 operatorClassOid != INT2_BTREE_OPS_OID);
1724 Anum_pg_opclass_oid,
1735 opcentry->
opcfamily = opclassform->opcfamily;
1736 opcentry->
opcintype = opclassform->opcintype;
1739 elog(
ERROR,
"could not find tuple for opclass %u", operatorClassOid);
1751 Anum_pg_amproc_amprocfamily,
1755 Anum_pg_amproc_amproclefttype,
1759 Anum_pg_amproc_amprocrighttype,
1770 if (amprocform->amprocnum <= 0 ||
1772 elog(
ERROR,
"invalid amproc number %d for opclass %u",
1773 amprocform->amprocnum, operatorClassOid);
1783 opcentry->
valid =
true;
1807 if (relation->
rd_rel->relkind == RELKIND_SEQUENCE)
1835 elog(
ERROR,
"cache lookup failed for access method %u",
1836 relation->
rd_rel->relam);
1912 relation->
rd_rel->relnamespace = PG_CATALOG_NAMESPACE;
1913 relation->
rd_rel->reltype = relationReltype;
1919 relation->
rd_rel->relisshared = isshared;
1921 relation->
rd_rel->reltablespace = GLOBALTABLESPACE_OID;
1924 relation->
rd_rel->relpersistence = RELPERSISTENCE_PERMANENT;
1927 relation->
rd_rel->relispopulated =
true;
1929 relation->
rd_rel->relreplident = REPLICA_IDENTITY_NOTHING;
1930 relation->
rd_rel->relpages = 0;
1931 relation->
rd_rel->reltuples = -1;
1932 relation->
rd_rel->relallvisible = 0;
1933 relation->
rd_rel->relkind = RELKIND_RELATION;
1935 relation->
rd_rel->relam = HEAP_TABLE_AM_OID;
1953 has_not_null =
false;
1954 for (
i = 0;
i < natts;
i++)
1959 has_not_null |= attrs[
i].attnotnull;
2006 relation->
rd_rel->relam = HEAP_TABLE_AM_OID;
2015 relation->
rd_rel->relhasindex =
false;
2020 relation->
rd_rel->relhasindex =
true;
2085 if (rd->
rd_rel->relkind == RELKIND_INDEX ||
2086 rd->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX)
2125 .
name =
"relcache reference",
2213 #ifdef RELCACHE_FORCE_RELEASE
2257 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX) &&
2291 elog(
ERROR,
"could not find pg_class tuple for index %u",
2320 elog(
ERROR,
"cache lookup failed for index %u",
2331 relation->
rd_index->indnullsnotdistinct =
index->indnullsnotdistinct;
2385 if (relation->
rd_rel->relkind == RELKIND_INDEX)
2467 if (remember_tupdesc)
2578 if ((relation->
rd_rel->relkind == RELKIND_INDEX ||
2579 relation->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX) &&
2695 elog(
ERROR,
"relation %u deleted while still in use", save_relid);
2709 keep_partkey = (relation->
rd_partkey != NULL);
2721 #define SWAPFIELD(fldtype, fldname) \
2723 fldtype _tmp = newrel->fldname; \
2724 newrel->fldname = relation->fldname; \
2725 relation->fldname = _tmp; \
2876 elog(
ERROR,
"relation %u is still open", rid);
3028 rebuildFirstList =
lcons(relation, rebuildFirstList);
3030 rebuildFirstList =
lappend(rebuildFirstList, relation);
3032 rebuildList =
lcons(relation, rebuildList);
3034 rebuildList =
lappend(rebuildList, relation);
3045 foreach(l, rebuildFirstList)
3051 foreach(l, rebuildList)
3092 #ifdef USE_ASSERT_CHECKING
3094 AssertPendingSyncConsistency(
Relation relation)
3096 bool relcache_verdict =
3099 RELKIND_HAS_STORAGE(relation->
rd_rel->relkind)) ||
3135 rels =
palloc(maxrels *
sizeof(*rels));
3143 if (locallock->
nLocks <= 0)
3152 if (nrels >= maxrels)
3155 rels =
repalloc(rels, maxrels *
sizeof(*rels));
3162 AssertPendingSyncConsistency(idhentry->
reldesc);
3164 for (
i = 0;
i < nrels;
i++)
3227 if (idhentry != NULL)
3259 bool clear_relcache =
false;
3275 #ifdef USE_ASSERT_CHECKING
3278 int expected_refcnt;
3325 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3365 mySubid, parentSubid);
3376 if (idhentry != NULL)
3378 mySubid, parentSubid);
3435 elog(
WARNING,
"cannot remove relcache entry for \"%s\" because it has nonzero refcount",
3483 bool shared_relation,
3484 bool mapped_relation,
3485 char relpersistence,
3490 int natts = tupDesc->
natts;
3505 case DatabaseRelationId:
3506 case AuthIdRelationId:
3507 case AuthMemRelationId:
3508 case RelationRelationId:
3509 case AttributeRelationId:
3510 case ProcedureRelationId:
3511 case TypeRelationId:
3526 elog(
ERROR,
"shared_relation flag for \"%s\" does not match IsSharedRelation(%u)",
3530 Assert(mapped_relation || !shared_relation);
3568 has_not_null =
false;
3569 for (
i = 0;
i < natts;
i++)
3574 datt->attidentity = satt->attidentity;
3575 datt->attgenerated = satt->attgenerated;
3576 datt->attnotnull = satt->attnotnull;
3577 has_not_null |= satt->attnotnull;
3594 rel->
rd_rel->relnamespace = relnamespace;
3596 rel->
rd_rel->relkind = relkind;
3597 rel->
rd_rel->relnatts = natts;
3600 rel->
rd_rel->relowner = BOOTSTRAP_SUPERUSERID;
3603 rel->
rd_rel->relpersistence = relpersistence;
3604 switch (relpersistence)
3606 case RELPERSISTENCE_UNLOGGED:
3607 case RELPERSISTENCE_PERMANENT:
3611 case RELPERSISTENCE_TEMP:
3617 elog(
ERROR,
"invalid relpersistence: %c", relpersistence);
3622 if (relkind == RELKIND_MATVIEW)
3623 rel->
rd_rel->relispopulated =
false;
3625 rel->
rd_rel->relispopulated =
true;
3629 (relkind == RELKIND_RELATION ||
3630 relkind == RELKIND_MATVIEW ||
3631 relkind == RELKIND_PARTITIONED_TABLE))
3632 rel->
rd_rel->relreplident = REPLICA_IDENTITY_DEFAULT;
3634 rel->
rd_rel->relreplident = REPLICA_IDENTITY_NOTHING;
3641 rel->
rd_rel->relisshared = shared_relation;
3645 for (
i = 0;
i < natts;
i++)
3648 rel->
rd_rel->reltablespace = reltablespace;
3650 if (mapped_relation)
3657 rel->
rd_rel->relfilenode = relfilenumber;
3663 rel->
rd_rel->relam = accessmtd;
3672 if (RELKIND_HAS_TABLE_AM(relkind) || relkind == RELKIND_SEQUENCE)
3735 else if (relation->
rd_rel->relkind == RELKIND_INDEX)
3739 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3740 errmsg(
"index relfilenumber value not set when in binary upgrade mode")));
3745 else if (relation->
rd_rel->relkind == RELKIND_RELATION)
3749 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3750 errmsg(
"heap relfilenumber value not set when in binary upgrade mode")));
3757 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3758 errmsg(
"unexpected request for new relfilenumber in binary upgrade mode")));
3768 elog(
ERROR,
"could not find tuple for relation %u",
3814 newrlocator.
relNumber = newrelfilenumber;
3816 if (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind))
3820 &freezeXid, &minmulti);
3822 else if (RELKIND_HAS_STORAGE(relation->
rd_rel->relkind))
3833 elog(
ERROR,
"relation \"%s\" does not have storage",
3852 Assert(classform->relfrozenxid == freezeXid);
3853 Assert(classform->relminmxid == minmulti);
3854 Assert(classform->relpersistence == persistence);
3867 relation->
rd_rel->relisshared,
3876 classform->relfilenode = newrelfilenumber;
3879 if (relation->
rd_rel->relkind != RELKIND_SEQUENCE)
3881 classform->relpages = 0;
3882 classform->reltuples = -1;
3883 classform->relallvisible = 0;
3885 classform->relfrozenxid = freezeXid;
3886 classform->relminmxid = minmulti;
3887 classform->relpersistence = persistence;
3941 #define INITRELCACHESIZE 400
4017 formrdesc(
"pg_database", DatabaseRelation_Rowtype_Id,
true,
4019 formrdesc(
"pg_authid", AuthIdRelation_Rowtype_Id,
true,
4021 formrdesc(
"pg_auth_members", AuthMemRelation_Rowtype_Id,
true,
4023 formrdesc(
"pg_shseclabel", SharedSecLabelRelation_Rowtype_Id,
true,
4025 formrdesc(
"pg_subscription", SubscriptionRelation_Rowtype_Id,
true,
4028 #define NUM_CRITICAL_SHARED_RELS 5
4074 needNewCacheFile =
true;
4076 formrdesc(
"pg_class", RelationRelation_Rowtype_Id,
false,
4078 formrdesc(
"pg_attribute", AttributeRelation_Rowtype_Id,
false,
4080 formrdesc(
"pg_proc", ProcedureRelation_Rowtype_Id,
false,
4082 formrdesc(
"pg_type", TypeRelation_Rowtype_Id,
false,
4085 #define NUM_CRITICAL_LOCAL_RELS 4
4122 RelationRelationId);
4124 AttributeRelationId);
4128 OperatorClassRelationId);
4130 AccessMethodProcedureRelationId);
4136 #define NUM_CRITICAL_LOCAL_INDEXES 7
4156 DatabaseRelationId);
4158 DatabaseRelationId);
4166 SharedSecLabelRelationId);
4168 #define NUM_CRITICAL_SHARED_INDEXES 6
4194 bool restart =
false;
4212 elog(
FATAL,
"cache lookup failed for relation %u",
4240 elog(
ERROR,
"invalid relowner in pg_class entry for \"%s\"",
4258 relation->
rd_rel->relhasrules =
false;
4261 if (relation->
rd_rel->relhastriggers && relation->
trigdesc == NULL)
4265 relation->
rd_rel->relhastriggers =
false;
4286 (RELKIND_HAS_TABLE_AM(relation->
rd_rel->relkind) || relation->
rd_rel->relkind == RELKIND_SEQUENCE))
4309 if (needNewCacheFile)
4346 elog(
PANIC,
"could not open critical system index %u", indexoid);
4380 for (
i = 0;
i < natts;
i++)
4403 if (pgclassdesc == NULL)
4416 if (pgindexdesc == NULL)
4449 Anum_pg_attrdef_adrelid,
4466 elog(
WARNING,
"unexpected pg_attrdef record found for attribute %d of relation \"%s\"",
4472 Anum_pg_attrdef_adbin,
4475 elog(
WARNING,
"null adbin for attribute %d of relation \"%s\"",
4482 attrdef[found].
adnum = adform->adnum;
4493 elog(
WARNING,
"%d pg_attrdef record(s) missing for relation \"%s\"",
4531 int ncheck = relation->
rd_rel->relchecks;
4545 Anum_pg_constraint_conrelid,
4560 if (conform->contype != CONSTRAINT_CHECK)
4564 if (found >= ncheck)
4566 elog(
WARNING,
"unexpected pg_constraint record found for relation \"%s\"",
4571 check[found].
ccvalid = conform->convalidated;
4578 Anum_pg_constraint_conbin,
4579 conrel->
rd_att, &isnull);
4597 if (found != ncheck)
4598 elog(
WARNING,
"%d pg_constraint record(s) missing for relation \"%s\"",
4655 if (!relation->
rd_rel->relhastriggers &&
4656 relation->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
4669 Anum_pg_constraint_conrelid,
4683 if (constraint->contype != CONSTRAINT_FOREIGN)
4687 info->
conoid = constraint->oid;
4688 info->
conrelid = constraint->conrelid;
4689 info->
confrelid = constraint->confrelid;
4695 NULL, NULL, NULL, NULL);
4698 result =
lappend(result, info);
4757 char replident = relation->
rd_rel->relreplident;
4760 bool pkdeferrable =
false;
4777 Anum_pg_index_indrelid,
4795 if (!
index->indislive)
4807 if (!
index->indisunique ||
4829 if (
index->indisprimary &&
4830 (
index->indisvalid ||
4831 relation->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE))
4833 pkeyIndex =
index->indexrelid;
4834 pkdeferrable = !
index->indimmediate;
4837 if (!
index->indimmediate)
4840 if (!
index->indisvalid)
4844 if (
index->indisreplident)
4845 candidateIndex =
index->indexrelid;
4861 if (replident == REPLICA_IDENTITY_DEFAULT &&
OidIsValid(pkeyIndex) && !pkdeferrable)
4863 else if (replident == REPLICA_IDENTITY_INDEX &&
OidIsValid(candidateIndex))
4925 Anum_pg_statistic_ext_stxrelid,
5037 Anum_pg_index_indexprs,
5089 Anum_pg_index_indexprs,
5099 foreach(lc, rawExprs)
5150 Anum_pg_index_indpred,
5228 List *newindexoidlist;
5250 elog(
ERROR,
"unknown attrKind %u", attrKind);
5265 if (indexoidlist ==
NIL)
5289 pkindexattrs = NULL;
5290 idindexattrs = NULL;
5291 hotblockingattrs = NULL;
5292 summarizedattrs = NULL;
5293 foreach(l, indexoidlist)
5299 Node *indexExpressions;
5300 Node *indexPredicate;
5323 indexExpressions = NULL;
5330 indexPredicate = NULL;
5333 isKey = indexDesc->
rd_index->indisunique &&
5334 indexExpressions == NULL &&
5335 indexPredicate == NULL;
5338 isPK = (indexOid == relpkindex);
5341 isIDKey = (indexOid == relreplindex);
5349 attrs = &summarizedattrs;
5351 attrs = &hotblockingattrs;
5354 for (
i = 0;
i < indexDesc->
rd_index->indnatts;
i++)
5356 int attrnum = indexDesc->
rd_index->indkey.values[
i];
5377 if (isKey && i < indexDesc->rd_index->indnkeyatts)
5381 if (isPK && i < indexDesc->rd_index->indnkeyatts)
5385 if (isIDKey && i < indexDesc->rd_index->indnkeyatts)
5407 if (
equal(indexoidlist, newindexoidlist) &&
5464 return pkindexattrs;
5466 return idindexattrs;
5468 return hotblockingattrs;
5470 return summarizedattrs;
5472 elog(
ERROR,
"unknown attrKind %u", attrKind);
5522 elog(
ERROR,
"could not open relation with OID %u",
5526 for (
i = 0;
i < indexDesc->
rd_index->indnatts;
i++)
5528 int attrnum = indexDesc->
rd_index->indkey.values[
i];
5536 if (i < indexDesc->rd_index->indnkeyatts)
5554 return idindexattrs;
5590 *operators = ops = (
Oid *)
palloc(
sizeof(
Oid) * indnkeyatts);
5591 *procs = funcs = (
Oid *)
palloc(
sizeof(
Oid) * indnkeyatts);
5597 memcpy(ops, indexRelation->
rd_exclops,
sizeof(
Oid) * indnkeyatts);
5598 memcpy(funcs, indexRelation->
rd_exclprocs,
sizeof(
Oid) * indnkeyatts);
5613 Anum_pg_constraint_conrelid,
5631 if ((conform->contype != CONSTRAINT_EXCLUSION &&
5632 !(conform->conperiod && (
5633 conform->contype == CONSTRAINT_PRIMARY
5634 || conform->contype == CONSTRAINT_UNIQUE))) ||
5640 elog(
ERROR,
"unexpected exclusion constraint record found for rel %s",
5646 Anum_pg_constraint_conexclop,
5647 conrel->
rd_att, &isnull);
5649 elog(
ERROR,
"null conexclop for rel %s",
5655 nelem != indnkeyatts ||
5658 elog(
ERROR,
"conexclop is not a 1-D Oid array");
5667 elog(
ERROR,
"exclusion constraint record missing for rel %s",
5671 for (
i = 0;
i < indnkeyatts;
i++)
5678 elog(
ERROR,
"could not find strategy for operator %u in family %u",
5687 memcpy(indexRelation->
rd_exclops, ops,
sizeof(
Oid) * indnkeyatts);
5688 memcpy(indexRelation->
rd_exclprocs, funcs,
sizeof(
Oid) * indnkeyatts);
5745 if (relation->
rd_rel->relispartition)
5750 foreach(lc, ancestors)
5763 foreach(lc, puboids)
5772 elog(
ERROR,
"cache lookup failed for publication %u", pubid);
5788 if (!pubform->puballtables &&
5789 (pubform->pubupdate || pubform->pubdelete) &&
5791 pubform->pubviaroot))
5793 if (pubform->pubupdate)
5795 if (pubform->pubdelete)
5805 if (!pubform->puballtables &&
5806 (pubform->pubupdate || pubform->pubdelete) &&
5808 pubform->pubviaroot))
5810 if (pubform->pubupdate)
5812 if (pubform->pubdelete)
5857 for (
int i = 0;
i < natts;
i++)
5889 for (
i = 0;
i < natts;
i++)
5897 if (attoptions != (
Datum) 0)
5910 for (
i = 0;
i < natts;
i++)
5954 const char *colname;
5957 if (
attnum > 0 && attnum <= reldesc->natts)
6066 snprintf(initfilename,
sizeof(initfilename),
"global/%s",
6069 snprintf(initfilename,
sizeof(initfilename),
"%s/%s",
6084 nailed_rels = nailed_indexes = 0;
6087 if (fread(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6092 for (relno = 0;; relno++)
6101 nread = fread(&
len, 1,
sizeof(
len), fp);
6102 if (nread !=
sizeof(
len))
6114 if (num_rels >= max_rels)
6123 if (fread(rel, 1,
len, fp) !=
len)
6127 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6131 if (fread(relform, 1,
len, fp) !=
len)
6140 rel->
rd_att->
tdtypeid = relform->reltype ? relform->reltype : RECORDOID;
6144 has_not_null =
false;
6145 for (
i = 0;
i < relform->relnatts;
i++)
6149 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6153 if (fread(attr, 1,
len, fp) !=
len)
6156 has_not_null |= attr->attnotnull;
6160 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6188 if (rel->
rd_rel->relkind == RELKIND_INDEX)
6203 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6234 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6238 if (fread(opfamily, 1,
len, fp) !=
len)
6244 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6248 if (fread(opcintype, 1,
len, fp) !=
len)
6254 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6257 if (fread(support, 1,
len, fp) !=
len)
6263 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6267 if (fread(indcollation, 1,
len, fp) !=
len)
6273 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6277 if (fread(indoption, 1,
len, fp) !=
len)
6286 for (
i = 0;
i < relform->relnatts;
i++)
6288 if (fread(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6311 if (RELKIND_HAS_TABLE_AM(rel->
rd_rel->relkind) || rel->
rd_rel->relkind == RELKIND_SEQUENCE)
6410 elog(
WARNING,
"found %d nailed shared rels and %d nailed shared indexes in init file, but expected %d and %d respectively",
6411 nailed_rels, nailed_indexes,
6424 elog(
WARNING,
"found %d nailed rels and %d nailed indexes in init file, but expected %d and %d respectively",
6425 nailed_rels, nailed_indexes,
6437 for (relno = 0; relno < num_rels; relno++)
6492 snprintf(tempfilename,
sizeof(tempfilename),
"global/%s.%d",
6494 snprintf(finalfilename,
sizeof(finalfilename),
"global/%s",
6499 snprintf(tempfilename,
sizeof(tempfilename),
"%s/%s.%d",
6501 snprintf(finalfilename,
sizeof(finalfilename),
"%s/%s",
6505 unlink(tempfilename);
6516 errmsg(
"could not create relation-cache initialization file \"%s\": %m",
6518 errdetail(
"Continuing anyway, but there's something wrong.")));
6527 if (fwrite(&magic, 1,
sizeof(magic), fp) !=
sizeof(magic))
6528 elog(
FATAL,
"could not write init file");
6541 if (relform->relisshared != shared)
6568 for (
i = 0;
i < relform->relnatts;
i++)
6583 if (rel->
rd_rel->relkind == RELKIND_INDEX)
6593 relform->relnatts *
sizeof(
Oid),
6598 relform->relnatts *
sizeof(
Oid),
6608 relform->relnatts *
sizeof(
Oid),
6613 relform->relnatts *
sizeof(
int16),
6619 for (
i = 0;
i < relform->relnatts;
i++)
6629 elog(
FATAL,
"could not write init file");
6662 if (rename(tempfilename, finalfilename) < 0)
6663 unlink(tempfilename);
6668 unlink(tempfilename);
6678 if (fwrite(&
len, 1,
sizeof(
len), fp) !=
sizeof(
len))
6679 elog(
FATAL,
"could not write init file");
6681 elog(
FATAL,
"could not write init file");
6697 if (relationId == SharedSecLabelRelationId ||
6698 relationId == TriggerRelidNameIndexId ||
6699 relationId == DatabaseNameIndexId ||
6700 relationId == SharedSecLabelObjectIndexId)
6741 snprintf(localinitfname,
sizeof(localinitfname),
"%s/%s",
6743 snprintf(sharedinitfname,
sizeof(sharedinitfname),
"global/%s",
6777 const char *tblspcdir =
"pg_tblspc";
6782 snprintf(path,
sizeof(path),
"global/%s",
6794 if (strspn(de->
d_name,
"0123456789") == strlen(de->
d_name))
6797 snprintf(path,
sizeof(path),
"%s/%s/%s",
6819 if (strspn(de->
d_name,
"0123456789") == strlen(de->
d_name))
6822 snprintf(initfilename,
sizeof(initfilename),
"%s/%s/%s",
6834 if (unlink(initfilename) < 0)
6837 if (errno != ENOENT)
6840 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)
static void PGresult * res
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
void hash_seq_term(HASH_SEQ_STATUS *status)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int err_generic_string(int field, const char *str)
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)
FILE * AllocateFile(const char *name, const char *mode)
struct dirent * ReadDirExtended(DIR *dir, const char *dirname, int elevel)
DIR * AllocateDir(const char *dirname)
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)
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)
#define HeapTupleHeaderSetXmin(tup, xid)
#define HeapTupleHeaderGetXmin(tup)
static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
#define IsParallelWorker()
RelFileNumber binary_upgrade_next_index_pg_class_relfilenumber
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
bytea * index_opclass_options(Relation indrel, AttrNumber attnum, Datum attoptions, bool validate)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
static int pg_cmp_s16(int16 a, int16 b)
void AcceptInvalidationMessages(void)
void CacheInvalidateRelcache(Relation relation)
Assert(fmt[strlen(fmt) - 1] !='\n')
void list_sort(List *list, list_sort_comparator cmp)
List * list_concat_unique_oid(List *list1, const List *list2)
List * lappend(List *list, void *datum)
List * lappend_oid(List *list, Oid datum)
List * list_copy(const List *oldlist)
int list_oid_cmp(const ListCell *p1, const ListCell *p2)
void list_free(List *list)
List * lcons(void *datum, List *list)
void list_free_deep(List *list)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void RelationInitLockInfo(Relation relation)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
char * get_namespace_name(Oid nspid)
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)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
List * make_ands_implicit(Expr *clause)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void pfree(void *pointer)
void MemoryContextDeleteChildren(MemoryContext context)
void * palloc0(Size size)
void * MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContext CurrentMemoryContext
void * repalloc(void *pointer, Size size)
void * MemoryContextAlloc(MemoryContext context, Size size)
char * MemoryContextStrdup(MemoryContext context, const char *string)
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
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)
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 * GetSchemaPublications(Oid schemaid)
List * GetRelationPublications(Oid relid)
List * GetAllTablesPublications(void)
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 ProcNumberForTempRelations()
#define INVALID_PROC_NUMBER
char * psprintf(const char *fmt,...)
bool pub_rf_contains_invalid_column(Oid pubid, Relation relation, List *ancestors, bool pubviaroot)
bool pub_collist_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
static int NextEOXactTupleDescNum
static bool load_relcache_init_file(bool shared)
void RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
static void RelationParseRelOptions(Relation relation, HeapTuple tuple)
List * RelationGetIndexList(Relation relation)
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]
static void formrdesc(const char *relationName, Oid relationReltype, bool isshared, int natts, const FormData_pg_attribute *attrs)
Oid RelationGetPrimaryKeyIndex(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)
static void InitIndexAmRoutine(Relation relation)
static void write_item(const void *data, Size len, FILE *fp)
List * RelationGetIndexPredicate(Relation relation)
static const FormData_pg_attribute Desc_pg_attribute[Natts_pg_attribute]
List * RelationGetStatExtList(Relation relation)
static bool equalRuleLocks(RuleLock *rlock1, RuleLock *rlock2)
static int in_progress_list_maxlen
static int CheckConstraintCmp(const void *a, const void *b)
void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
static void ResourceOwnerRememberRelationRef(ResourceOwner owner, Relation rel)
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)
void RelationIncrementReferenceCount(Relation rel)
#define RelationCacheDelete(RELATION)
void RelationCacheInitFilePostInvalidate(void)
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
void RelationCacheInitializePhase3(void)
#define NUM_CRITICAL_SHARED_RELS
List * RelationGetDummyIndexExpressions(Relation relation)
static void RelationDestroyRelation(Relation relation, bool remember_tupdesc)
static void RelationClearRelation(Relation relation, bool rebuild)
List * RelationGetFKeyList(Relation relation)
#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
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)
static void CheckConstraintFetch(Relation relation)
void RelationForgetRelation(Oid rid)
static void AtEOSubXact_cleanup(Relation relation, bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
void RelationCacheInitialize(void)
void RelationCacheInitFilePreInvalidate(void)
static bytea ** CopyIndexAttOptions(bytea **srcopts, int natts)
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
List * RelationGetIndexExpressions(Relation relation)
static HTAB * RelationIdCache
struct inprogressent InProgressEnt
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()
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 PushActiveSnapshot(Snapshot snapshot)
bool HistoricSnapshotActive(void)
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 cols_valid_for_update
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_stored
struct AttrMissing * missing
int16 values[FLEXIBLE_ARRAY_MEMBER]
Oid values[FLEXIBLE_ARRAY_MEMBER]
StrategyNumber numSupport
RegProcedure * supportProcs
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
bool RelationSupportsSysCache(Oid relid)
void InitCatalogCachePhase2(void)
#define SearchSysCacheCopy1(cacheId, 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)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
bool equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2)
#define TupleDescAttr(tupdesc, i)
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