PostgreSQL Source Code  git master
genam.c File Reference
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "catalog/index.h"
#include "lib/stringinfo.h"
#include "miscadmin.h"
#include "storage/bufmgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/rls.h"
#include "utils/ruleutils.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
Include dependency graph for genam.c:

Go to the source code of this file.

Functions

IndexScanDesc RelationGetIndexScan (Relation indexRelation, int nkeys, int norderbys)
 
void IndexScanEnd (IndexScanDesc scan)
 
char * BuildIndexValueDescription (Relation indexRelation, Datum *values, bool *isnull)
 
TransactionId index_compute_xid_horizon_for_tuples (Relation irel, Relation hrel, Buffer ibuf, OffsetNumber *itemnos, int nitems)
 
SysScanDesc systable_beginscan (Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
 
HeapTuple systable_getnext (SysScanDesc sysscan)
 
bool systable_recheck_tuple (SysScanDesc sysscan, HeapTuple tup)
 
void systable_endscan (SysScanDesc sysscan)
 
SysScanDesc systable_beginscan_ordered (Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, ScanKey key)
 
HeapTuple systable_getnext_ordered (SysScanDesc sysscan, ScanDirection direction)
 
void systable_endscan_ordered (SysScanDesc sysscan)
 

Function Documentation

◆ BuildIndexValueDescription()

char* BuildIndexValueDescription ( Relation  indexRelation,
Datum values,
bool isnull 
)

Definition at line 176 of file genam.c.

References ACL_SELECT, ACLCHECK_OK, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert, attnum, buf, check_enable_rls(), StringInfoData::data, getTypeOutputInfo(), GetUserId(), i, IndexRelationGetNumberOfKeyAttributes, initStringInfo(), InvalidAttrNumber, InvalidOid, OidOutputFunctionCall(), pg_attribute_aclcheck(), pg_class_aclcheck(), pg_get_indexdef_columns(), RelationData::rd_index, RelationData::rd_opcintype, RelationGetRelid, RLS_ENABLED, and val.

Referenced by _bt_check_unique(), check_exclusion_or_unique_constraint(), and comparetup_index_btree().

178 {
180  Form_pg_index idxrec;
181  int indnkeyatts;
182  int i;
183  int keyno;
184  Oid indexrelid = RelationGetRelid(indexRelation);
185  Oid indrelid;
186  AclResult aclresult;
187 
188  indnkeyatts = IndexRelationGetNumberOfKeyAttributes(indexRelation);
189 
190  /*
191  * Check permissions- if the user does not have access to view all of the
192  * key columns then return NULL to avoid leaking data.
193  *
194  * First check if RLS is enabled for the relation. If so, return NULL to
195  * avoid leaking data.
196  *
197  * Next we need to check table-level SELECT access and then, if there is
198  * no access there, check column-level permissions.
199  */
200  idxrec = indexRelation->rd_index;
201  indrelid = idxrec->indrelid;
202  Assert(indexrelid == idxrec->indexrelid);
203 
204  /* RLS check- if RLS is enabled then we don't return anything. */
205  if (check_enable_rls(indrelid, InvalidOid, true) == RLS_ENABLED)
206  return NULL;
207 
208  /* Table-level SELECT is enough, if the user has it */
209  aclresult = pg_class_aclcheck(indrelid, GetUserId(), ACL_SELECT);
210  if (aclresult != ACLCHECK_OK)
211  {
212  /*
213  * No table-level access, so step through the columns in the index and
214  * make sure the user has SELECT rights on all of them.
215  */
216  for (keyno = 0; keyno < indnkeyatts; keyno++)
217  {
218  AttrNumber attnum = idxrec->indkey.values[keyno];
219 
220  /*
221  * Note that if attnum == InvalidAttrNumber, then this is an index
222  * based on an expression and we return no detail rather than try
223  * to figure out what column(s) the expression includes and if the
224  * user has SELECT rights on them.
225  */
226  if (attnum == InvalidAttrNumber ||
227  pg_attribute_aclcheck(indrelid, attnum, GetUserId(),
229  {
230  /* No access, so clean up and return */
231  return NULL;
232  }
233  }
234  }
235 
236  initStringInfo(&buf);
237  appendStringInfo(&buf, "(%s)=(",
238  pg_get_indexdef_columns(indexrelid, true));
239 
240  for (i = 0; i < indnkeyatts; i++)
241  {
242  char *val;
243 
244  if (isnull[i])
245  val = "null";
246  else
247  {
248  Oid foutoid;
249  bool typisvarlena;
250 
251  /*
252  * The provided data is not necessarily of the type stored in the
253  * index; rather it is of the index opclass's input type. So look
254  * at rd_opcintype not the index tupdesc.
255  *
256  * Note: this is a bit shaky for opclasses that have pseudotype
257  * input types such as ANYARRAY or RECORD. Currently, the
258  * typoutput functions associated with the pseudotypes will work
259  * okay, but we might have to try harder in future.
260  */
261  getTypeOutputInfo(indexRelation->rd_opcintype[i],
262  &foutoid, &typisvarlena);
263  val = OidOutputFunctionCall(foutoid, values[i]);
264  }
265 
266  if (i > 0)
267  appendStringInfoString(&buf, ", ");
268  appendStringInfoString(&buf, val);
269  }
270 
271  appendStringInfoChar(&buf, ')');
272 
273  return buf.data;
274 }
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
Definition: lsyscache.c:2784
AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode)
Definition: aclchk.c:4449
Oid GetUserId(void)
Definition: miscinit.c:448
char * pg_get_indexdef_columns(Oid indexrelid, bool pretty)
Definition: ruleutils.c:1169
unsigned int Oid
Definition: postgres_ext.h:31
Form_pg_index rd_index
Definition: rel.h:174
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:176
static char * buf
Definition: pg_test_fsync.c:67
#define IndexRelationGetNumberOfKeyAttributes(relation)
Definition: rel.h:475
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:188
void initStringInfo(StringInfo str)
Definition: stringinfo.c:59
FormData_pg_index * Form_pg_index
Definition: pg_index.h:66
AclResult
Definition: acl.h:177
#define ACL_SELECT
Definition: parsenodes.h:75
#define InvalidOid
Definition: postgres_ext.h:36
int16 attnum
Definition: pg_attribute.h:79
int check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
Definition: rls.c:52
#define Assert(condition)
Definition: c.h:738
#define InvalidAttrNumber
Definition: attnum.h:23
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
Definition: aclchk.c:4563
static Datum values[MAXATTR]
Definition: bootstrap.c:167
char * OidOutputFunctionCall(Oid functionId, Datum val)
Definition: fmgr.c:1657
int i
Oid * rd_opcintype
Definition: rel.h:190
int16 AttrNumber
Definition: attnum.h:21
#define RelationGetRelid(relation)
Definition: rel.h:456
long val
Definition: informix.c:664

◆ index_compute_xid_horizon_for_tuples()

TransactionId index_compute_xid_horizon_for_tuples ( Relation  irel,
Relation  hrel,
Buffer  ibuf,
OffsetNumber itemnos,
int  nitems 
)

Definition at line 285 of file genam.c.

References BufferGetPage, i, InvalidTransactionId, ItemPointerCopy, PageGetItem, PageGetItemId, palloc(), pfree(), IndexTupleData::t_tid, and table_compute_xid_horizon_for_tuples().

Referenced by _hash_vacuum_one_page(), and gistprunepage().

290 {
291  ItemPointerData *ttids =
292  (ItemPointerData *) palloc(sizeof(ItemPointerData) * nitems);
293  TransactionId latestRemovedXid = InvalidTransactionId;
294  Page ipage = BufferGetPage(ibuf);
295  IndexTuple itup;
296 
297  /* identify what the index tuples about to be deleted point to */
298  for (int i = 0; i < nitems; i++)
299  {
300  ItemId iitemid;
301 
302  iitemid = PageGetItemId(ipage, itemnos[i]);
303  itup = (IndexTuple) PageGetItem(ipage, iitemid);
304 
305  ItemPointerCopy(&itup->t_tid, &ttids[i]);
306  }
307 
308  /* determine the actual xid horizon */
309  latestRemovedXid =
310  table_compute_xid_horizon_for_tuples(hrel, ttids, nitems);
311 
312  pfree(ttids);
313 
314  return latestRemovedXid;
315 }
uint32 TransactionId
Definition: c.h:513
ItemPointerData t_tid
Definition: itup.h:37
static TransactionId table_compute_xid_horizon_for_tuples(Relation rel, ItemPointerData *items, int nitems)
Definition: tableam.h:1104
void pfree(void *pointer)
Definition: mcxt.c:1056
IndexTupleData * IndexTuple
Definition: itup.h:53
#define InvalidTransactionId
Definition: transam.h:31
#define BufferGetPage(buffer)
Definition: bufmgr.h:169
#define PageGetItemId(page, offsetNumber)
Definition: bufpage.h:235
void * palloc(Size size)
Definition: mcxt.c:949
int i
#define PageGetItem(page, itemId)
Definition: bufpage.h:340
Pointer Page
Definition: bufpage.h:78
#define ItemPointerCopy(fromPointer, toPointer)
Definition: itemptr.h:161

◆ IndexScanEnd()

void IndexScanEnd ( IndexScanDesc  scan)

Definition at line 144 of file genam.c.

References IndexScanDescData::keyData, IndexScanDescData::orderByData, and pfree().

Referenced by index_endscan().

145 {
146  if (scan->keyData != NULL)
147  pfree(scan->keyData);
148  if (scan->orderByData != NULL)
149  pfree(scan->orderByData);
150 
151  pfree(scan);
152 }
struct ScanKeyData * orderByData
Definition: relscan.h:108
void pfree(void *pointer)
Definition: mcxt.c:1056
struct ScanKeyData * keyData
Definition: relscan.h:107

◆ RelationGetIndexScan()

IndexScanDesc RelationGetIndexScan ( Relation  indexRelation,
int  nkeys,
int  norderbys 
)

Definition at line 80 of file genam.c.

References IndexScanDescData::heapRelation, IndexScanDescData::ignore_killed_tuples, IndexScanDescData::indexRelation, InvalidSnapshot, IndexScanDescData::keyData, IndexScanDescData::kill_prior_tuple, IndexScanDescData::numberOfKeys, IndexScanDescData::numberOfOrderBys, IndexScanDescData::opaque, IndexScanDescData::orderByData, palloc(), TransactionStartedDuringRecovery(), IndexScanDescData::xactStartedInRecovery, IndexScanDescData::xs_heapfetch, IndexScanDescData::xs_hitup, IndexScanDescData::xs_hitupdesc, IndexScanDescData::xs_itup, IndexScanDescData::xs_itupdesc, IndexScanDescData::xs_snapshot, and IndexScanDescData::xs_want_itup.

Referenced by blbeginscan(), brinbeginscan(), btbeginscan(), dibeginscan(), ginbeginscan(), gistbeginscan(), hashbeginscan(), and spgbeginscan().

81 {
82  IndexScanDesc scan;
83 
84  scan = (IndexScanDesc) palloc(sizeof(IndexScanDescData));
85 
86  scan->heapRelation = NULL; /* may be set later */
87  scan->xs_heapfetch = NULL;
88  scan->indexRelation = indexRelation;
89  scan->xs_snapshot = InvalidSnapshot; /* caller must initialize this */
90  scan->numberOfKeys = nkeys;
91  scan->numberOfOrderBys = norderbys;
92 
93  /*
94  * We allocate key workspace here, but it won't get filled until amrescan.
95  */
96  if (nkeys > 0)
97  scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
98  else
99  scan->keyData = NULL;
100  if (norderbys > 0)
101  scan->orderByData = (ScanKey) palloc(sizeof(ScanKeyData) * norderbys);
102  else
103  scan->orderByData = NULL;
104 
105  scan->xs_want_itup = false; /* may be set later */
106 
107  /*
108  * During recovery we ignore killed tuples and don't bother to kill them
109  * either. We do this because the xmin on the primary node could easily be
110  * later than the xmin on the standby node, so that what the primary
111  * thinks is killed is supposed to be visible on standby. So for correct
112  * MVCC for queries during recovery we must ignore these hints and check
113  * all tuples. Do *not* set ignore_killed_tuples to true when running in a
114  * transaction that was started during recovery. xactStartedInRecovery
115  * should not be altered by index AMs.
116  */
117  scan->kill_prior_tuple = false;
120 
121  scan->opaque = NULL;
122 
123  scan->xs_itup = NULL;
124  scan->xs_itupdesc = NULL;
125  scan->xs_hitup = NULL;
126  scan->xs_hitupdesc = NULL;
127 
128  return scan;
129 }
bool TransactionStartedDuringRecovery(void)
Definition: xact.c:955
struct ScanKeyData * orderByData
Definition: relscan.h:108
IndexTuple xs_itup
Definition: relscan.h:127
struct TupleDescData * xs_itupdesc
Definition: relscan.h:128
struct TupleDescData * xs_hitupdesc
Definition: relscan.h:130
struct SnapshotData * xs_snapshot
Definition: relscan.h:104
bool ignore_killed_tuples
Definition: relscan.h:114
Relation indexRelation
Definition: relscan.h:103
Relation heapRelation
Definition: relscan.h:102
bool xactStartedInRecovery
Definition: relscan.h:115
ScanKeyData * ScanKey
Definition: skey.h:75
#define InvalidSnapshot
Definition: snapshot.h:123
IndexFetchTableData * xs_heapfetch
Definition: relscan.h:135
struct ScanKeyData * keyData
Definition: relscan.h:107
void * palloc(Size size)
Definition: mcxt.c:949
HeapTuple xs_hitup
Definition: relscan.h:129
bool kill_prior_tuple
Definition: relscan.h:113
int numberOfOrderBys
Definition: relscan.h:106
struct IndexScanDescData * IndexScanDesc
Definition: genam.h:87

◆ systable_beginscan()

SysScanDesc systable_beginscan ( Relation  heapRelation,
Oid  indexId,
bool  indexOK,
Snapshot  snapshot,
int  nkeys,
ScanKey  key 
)

Definition at line 356 of file genam.c.

References AccessShareLock, elog, ERROR, GetCatalogSnapshot(), SysScanDescData::heap_rel, i, IgnoreSystemIndexes, index_beginscan(), index_open(), index_rescan(), IndexRelationGetNumberOfAttributes, SysScanDescData::irel, SysScanDescData::iscan, palloc(), RelationData::rd_index, RegisterSnapshot(), ReindexIsProcessingIndex(), RelationGetRelid, SysScanDescData::scan, ScanKeyData::sk_attno, SysScanDescData::slot, SysScanDescData::snapshot, table_beginscan_strat(), and table_slot_create().

Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterPolicy(), AlterSeqNamespaces(), AlterSetting(), AlterTypeRecurse(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddOf(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecDropConstraint(), ATExecDropExpression(), ATExecValidateConstraint(), ATPrepChangePersistence(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), CloneFkReferenced(), CloneRowTriggersToPartition(), ConstraintNameExists(), ConstraintNameIsUsed(), copyTemplateDependencies(), CountDBSubscriptions(), CreateComments(), CreateInheritance(), CreatePolicy(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteDependencyRecordsForSpecific(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropClonedTriggersFromPartition(), DropConfigurationMapping(), dropDatabaseDependencies(), DropObjectById(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), fetch_statentries_for_relation(), find_composite_type_dependencies(), find_inheritance_children(), findDependentObjects(), get_catalog_object_by_oid(), get_constraint_index(), get_database_oid(), get_db_info(), get_domain_constraint_oid(), get_extension_name(), get_extension_oid(), get_extension_schema(), get_index_constraint(), get_index_ref_constraints(), get_object_address_attrdef(), get_partition_parent_worker(), get_pkey_attnames(), get_primary_key_attnos(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_idx_constraint_oid(), get_relation_policy_oid(), get_rels_with_domain(), get_trigger_oid(), GetAllTablesPublications(), getAutoExtensionsOfObject(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentityParts(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationRelations(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), has_superclass(), heap_truncate_find_FKs(), index_concurrently_swap(), IndexSetParentIndex(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_domaintype_info(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_constraintdef_worker(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), recordExtensionInitPrivWorker(), recordExtObjInitPriv(), relation_has_policies(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetStatExtList(), RelationRemoveInheritance(), RelidByRelfilenode(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveExtensionById(), RemoveInheritance(), RemovePolicyById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), rename_policy(), renametrig(), replorigin_create(), ScanPgRelation(), SearchCatCacheList(), SearchCatCacheMiss(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_relation_setattr_extra(), sepgsql_schema_post_create(), sequenceIsOwned(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), shdepDropDependency(), shdepDropOwned(), shdepReassignOwned(), toastrel_valueid_exists(), tryAttachPartitionForeignKey(), typeInheritsFrom(), vac_update_datfrozenxid(), and validatePartitionedIndex().

361 {
362  SysScanDesc sysscan;
363  Relation irel;
364 
365  if (indexOK &&
367  !ReindexIsProcessingIndex(indexId))
368  irel = index_open(indexId, AccessShareLock);
369  else
370  irel = NULL;
371 
372  sysscan = (SysScanDesc) palloc(sizeof(SysScanDescData));
373 
374  sysscan->heap_rel = heapRelation;
375  sysscan->irel = irel;
376  sysscan->slot = table_slot_create(heapRelation, NULL);
377 
378  if (snapshot == NULL)
379  {
380  Oid relid = RelationGetRelid(heapRelation);
381 
382  snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
383  sysscan->snapshot = snapshot;
384  }
385  else
386  {
387  /* Caller is responsible for any snapshot. */
388  sysscan->snapshot = NULL;
389  }
390 
391  if (irel)
392  {
393  int i;
394 
395  /* Change attribute numbers to be index column numbers. */
396  for (i = 0; i < nkeys; i++)
397  {
398  int j;
399 
400  for (j = 0; j < IndexRelationGetNumberOfAttributes(irel); j++)
401  {
402  if (key[i].sk_attno == irel->rd_index->indkey.values[j])
403  {
404  key[i].sk_attno = j + 1;
405  break;
406  }
407  }
408  if (j == IndexRelationGetNumberOfAttributes(irel))
409  elog(ERROR, "column is not in index");
410  }
411 
412  sysscan->iscan = index_beginscan(heapRelation, irel,
413  snapshot, nkeys, 0);
414  index_rescan(sysscan->iscan, key, nkeys, NULL, 0);
415  sysscan->scan = NULL;
416  }
417  else
418  {
419  /*
420  * We disallow synchronized scans when forced to use a heapscan on a
421  * catalog. In most cases the desired rows are near the front, so
422  * that the unpredictable start point of a syncscan is a serious
423  * disadvantage; and there are no compensating advantages, because
424  * it's unlikely that such scans will occur in parallel.
425  */
426  sysscan->scan = table_beginscan_strat(heapRelation, snapshot,
427  nkeys, key,
428  true, false);
429  sysscan->iscan = NULL;
430  }
431 
432  return sysscan;
433 }
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Definition: tableam.c:77
Relation irel
Definition: relscan.h:169
struct SysScanDescData * SysScanDesc
Definition: genam.h:88
Relation heap_rel
Definition: relscan.h:168
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:865
struct SnapshotData * snapshot
Definition: relscan.h:172
Snapshot GetCatalogSnapshot(Oid relid)
Definition: snapmgr.c:442
#define AccessShareLock
Definition: lockdefs.h:36
void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
Definition: indexam.c:295
bool IgnoreSystemIndexes
Definition: miscinit.c:77
unsigned int Oid
Definition: postgres_ext.h:31
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
static TableScanDesc table_beginscan_strat(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key, bool allow_strat, bool allow_sync)
Definition: tableam.h:778
Form_pg_index rd_index
Definition: rel.h:174
#define ERROR
Definition: elog.h:43
struct TableScanDescData * scan
Definition: relscan.h:170
#define IndexRelationGetNumberOfAttributes(relation)
Definition: rel.h:468
void * palloc(Size size)
Definition: mcxt.c:949
#define elog(elevel,...)
Definition: elog.h:214
int i
bool ReindexIsProcessingIndex(Oid indexOid)
Definition: index.c:3819
#define RelationGetRelid(relation)
Definition: rel.h:456
Relation index_open(Oid relationId, LOCKMODE lockmode)
Definition: indexam.c:132
AttrNumber sk_attno
Definition: skey.h:67
IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, int norderbys)
Definition: indexam.c:203

◆ systable_beginscan_ordered()

SysScanDesc systable_beginscan_ordered ( Relation  heapRelation,
Relation  indexRelation,
Snapshot  snapshot,
int  nkeys,
ScanKey  key 
)

Definition at line 569 of file genam.c.

References elog, ERROR, GetCatalogSnapshot(), SysScanDescData::heap_rel, i, IgnoreSystemIndexes, index_beginscan(), index_rescan(), IndexRelationGetNumberOfAttributes, SysScanDescData::irel, SysScanDescData::iscan, palloc(), RelationData::rd_index, RegisterSnapshot(), ReindexIsProcessingIndex(), RelationGetRelationName, RelationGetRelid, SysScanDescData::scan, ScanKeyData::sk_attno, SysScanDescData::slot, SysScanDescData::snapshot, table_slot_create(), and WARNING.

Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), heap_fetch_toast_slice(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), and toast_delete_datum().

573 {
574  SysScanDesc sysscan;
575  int i;
576 
577  /* REINDEX can probably be a hard error here ... */
578  if (ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))
579  elog(ERROR, "cannot do ordered scan on index \"%s\", because it is being reindexed",
580  RelationGetRelationName(indexRelation));
581  /* ... but we only throw a warning about violating IgnoreSystemIndexes */
583  elog(WARNING, "using index \"%s\" despite IgnoreSystemIndexes",
584  RelationGetRelationName(indexRelation));
585 
586  sysscan = (SysScanDesc) palloc(sizeof(SysScanDescData));
587 
588  sysscan->heap_rel = heapRelation;
589  sysscan->irel = indexRelation;
590  sysscan->slot = table_slot_create(heapRelation, NULL);
591 
592  if (snapshot == NULL)
593  {
594  Oid relid = RelationGetRelid(heapRelation);
595 
596  snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));
597  sysscan->snapshot = snapshot;
598  }
599  else
600  {
601  /* Caller is responsible for any snapshot. */
602  sysscan->snapshot = NULL;
603  }
604 
605  /* Change attribute numbers to be index column numbers. */
606  for (i = 0; i < nkeys; i++)
607  {
608  int j;
609 
610  for (j = 0; j < IndexRelationGetNumberOfAttributes(indexRelation); j++)
611  {
612  if (key[i].sk_attno == indexRelation->rd_index->indkey.values[j])
613  {
614  key[i].sk_attno = j + 1;
615  break;
616  }
617  }
618  if (j == IndexRelationGetNumberOfAttributes(indexRelation))
619  elog(ERROR, "column is not in index");
620  }
621 
622  sysscan->iscan = index_beginscan(heapRelation, indexRelation,
623  snapshot, nkeys, 0);
624  index_rescan(sysscan->iscan, key, nkeys, NULL, 0);
625  sysscan->scan = NULL;
626 
627  return sysscan;
628 }
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
Definition: tableam.c:77
Relation irel
Definition: relscan.h:169
struct SysScanDescData * SysScanDesc
Definition: genam.h:88
Relation heap_rel
Definition: relscan.h:168
Snapshot RegisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:865
struct SnapshotData * snapshot
Definition: relscan.h:172
Snapshot GetCatalogSnapshot(Oid relid)
Definition: snapmgr.c:442
void index_rescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, int norderbys)
Definition: indexam.c:295
bool IgnoreSystemIndexes
Definition: miscinit.c:77
unsigned int Oid
Definition: postgres_ext.h:31
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
Form_pg_index rd_index
Definition: rel.h:174
#define ERROR
Definition: elog.h:43
struct TableScanDescData * scan
Definition: relscan.h:170
#define IndexRelationGetNumberOfAttributes(relation)
Definition: rel.h:468
#define RelationGetRelationName(relation)
Definition: rel.h:490
#define WARNING
Definition: elog.h:40
void * palloc(Size size)
Definition: mcxt.c:949
#define elog(elevel,...)
Definition: elog.h:214
int i
bool ReindexIsProcessingIndex(Oid indexOid)
Definition: index.c:3819
#define RelationGetRelid(relation)
Definition: rel.h:456
AttrNumber sk_attno
Definition: skey.h:67
IndexScanDesc index_beginscan(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, int norderbys)
Definition: indexam.c:203

◆ systable_endscan()

void systable_endscan ( SysScanDesc  sysscan)

Definition at line 529 of file genam.c.

References AccessShareLock, ExecDropSingleTupleTableSlot(), index_close(), index_endscan(), SysScanDescData::irel, SysScanDescData::iscan, pfree(), SysScanDescData::scan, SysScanDescData::slot, SysScanDescData::snapshot, table_endscan(), and UnregisterSnapshot().

Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterPolicy(), AlterSeqNamespaces(), AlterSetting(), AlterTypeRecurse(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddOf(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecDropConstraint(), ATExecDropExpression(), ATExecValidateConstraint(), ATPrepChangePersistence(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), CloneFkReferenced(), CloneRowTriggersToPartition(), ConstraintNameExists(), ConstraintNameIsUsed(), copyTemplateDependencies(), CountDBSubscriptions(), CreateComments(), CreateInheritance(), CreatePolicy(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteDependencyRecordsForSpecific(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropClonedTriggersFromPartition(), DropConfigurationMapping(), dropDatabaseDependencies(), DropObjectById(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), fetch_statentries_for_relation(), find_composite_type_dependencies(), find_inheritance_children(), findDependentObjects(), get_catalog_object_by_oid(), get_constraint_index(), get_database_oid(), get_db_info(), get_domain_constraint_oid(), get_extension_name(), get_extension_oid(), get_extension_schema(), get_index_constraint(), get_index_ref_constraints(), get_object_address_attrdef(), get_partition_parent_worker(), get_pkey_attnames(), get_primary_key_attnos(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_idx_constraint_oid(), get_relation_policy_oid(), get_rels_with_domain(), get_trigger_oid(), GetAllTablesPublications(), getAutoExtensionsOfObject(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentityParts(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationRelations(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), has_superclass(), heap_truncate_find_FKs(), index_concurrently_swap(), IndexSetParentIndex(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_domaintype_info(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_constraintdef_worker(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), recordExtensionInitPrivWorker(), recordExtObjInitPriv(), relation_has_policies(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetStatExtList(), RelationRemoveInheritance(), RelidByRelfilenode(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveExtensionById(), RemoveInheritance(), RemovePolicyById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), rename_policy(), renametrig(), replorigin_create(), ScanPgRelation(), SearchCatCacheList(), SearchCatCacheMiss(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_relation_setattr_extra(), sepgsql_schema_post_create(), sequenceIsOwned(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), shdepDropDependency(), shdepDropOwned(), shdepReassignOwned(), toastrel_valueid_exists(), tryAttachPartitionForeignKey(), typeInheritsFrom(), vac_update_datfrozenxid(), and validatePartitionedIndex().

530 {
531  if (sysscan->slot)
532  {
534  sysscan->slot = NULL;
535  }
536 
537  if (sysscan->irel)
538  {
539  index_endscan(sysscan->iscan);
540  index_close(sysscan->irel, AccessShareLock);
541  }
542  else
543  table_endscan(sysscan->scan);
544 
545  if (sysscan->snapshot)
546  UnregisterSnapshot(sysscan->snapshot);
547 
548  pfree(sysscan);
549 }
Relation irel
Definition: relscan.h:169
struct SnapshotData * snapshot
Definition: relscan.h:172
#define AccessShareLock
Definition: lockdefs.h:36
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
void pfree(void *pointer)
Definition: mcxt.c:1056
struct TableScanDescData * scan
Definition: relscan.h:170
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1224
void index_endscan(IndexScanDesc scan)
Definition: indexam.c:321
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:907
void index_close(Relation relation, LOCKMODE lockmode)
Definition: indexam.c:158
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:862

◆ systable_endscan_ordered()

void systable_endscan_ordered ( SysScanDesc  sysscan)

Definition at line 653 of file genam.c.

References Assert, ExecDropSingleTupleTableSlot(), index_endscan(), SysScanDescData::irel, SysScanDescData::iscan, pfree(), SysScanDescData::slot, SysScanDescData::snapshot, and UnregisterSnapshot().

Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), heap_fetch_toast_slice(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), and toast_delete_datum().

654 {
655  if (sysscan->slot)
656  {
658  sysscan->slot = NULL;
659  }
660 
661  Assert(sysscan->irel);
662  index_endscan(sysscan->iscan);
663  if (sysscan->snapshot)
664  UnregisterSnapshot(sysscan->snapshot);
665  pfree(sysscan);
666 }
Relation irel
Definition: relscan.h:169
struct SnapshotData * snapshot
Definition: relscan.h:172
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
void pfree(void *pointer)
Definition: mcxt.c:1056
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
Definition: execTuples.c:1224
void index_endscan(IndexScanDesc scan)
Definition: indexam.c:321
void UnregisterSnapshot(Snapshot snapshot)
Definition: snapmgr.c:907
#define Assert(condition)
Definition: c.h:738

◆ systable_getnext()

HeapTuple systable_getnext ( SysScanDesc  sysscan)

Definition at line 448 of file genam.c.

References Assert, elog, ERROR, ExecFetchSlotHeapTuple(), ForwardScanDirection, index_getnext_slot(), SysScanDescData::irel, SysScanDescData::iscan, SysScanDescData::scan, SysScanDescData::slot, table_scan_getnextslot(), and IndexScanDescData::xs_recheck.

Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterPolicy(), AlterSeqNamespaces(), AlterSetting(), AlterTypeRecurse(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddOf(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecAttachPartition(), ATExecDropConstraint(), ATExecDropExpression(), ATExecValidateConstraint(), ATPrepChangePersistence(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependenciesOf(), changeDependenciesOn(), changeDependencyFor(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), CloneFkReferenced(), CloneRowTriggersToPartition(), ConstraintNameExists(), ConstraintNameIsUsed(), copyTemplateDependencies(), CountDBSubscriptions(), CreateComments(), CreateInheritance(), CreatePolicy(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteDependencyRecordsForSpecific(), DeleteInheritsTuple(), DeleteInitPrivs(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropClonedTriggersFromPartition(), DropConfigurationMapping(), dropDatabaseDependencies(), DropObjectById(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), fetch_statentries_for_relation(), find_composite_type_dependencies(), find_inheritance_children(), findDependentObjects(), get_catalog_object_by_oid(), get_constraint_index(), get_database_oid(), get_db_info(), get_domain_constraint_oid(), get_extension_name(), get_extension_oid(), get_extension_schema(), get_index_constraint(), get_index_ref_constraints(), get_object_address_attrdef(), get_partition_parent_worker(), get_pkey_attnames(), get_primary_key_attnos(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_idx_constraint_oid(), get_relation_policy_oid(), get_rels_with_domain(), get_trigger_oid(), GetAllTablesPublications(), getAutoExtensionsOfObject(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentityParts(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationRelations(), GetSecurityLabel(), GetSharedSecurityLabel(), GetSubscriptionNotReadyRelations(), GetSubscriptionRelations(), has_superclass(), heap_truncate_find_FKs(), index_concurrently_swap(), IndexSetParentIndex(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_domaintype_info(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_constraintdef_worker(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), recordExtensionInitPrivWorker(), recordExtObjInitPriv(), relation_has_policies(), RelationBuildPartitionDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIndexList(), RelationGetStatExtList(), RelationRemoveInheritance(), RelidByRelfilenode(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveExtensionById(), RemoveInheritance(), RemovePolicyById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveRoleFromObjectPolicy(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), rename_policy(), renametrig(), replorigin_create(), ScanPgRelation(), SearchCatCacheList(), SearchCatCacheMiss(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_proc_setattr(), sepgsql_relation_post_create(), sepgsql_relation_setattr(), sepgsql_relation_setattr_extra(), sepgsql_schema_post_create(), sequenceIsOwned(), SetSecurityLabel(), SetSharedSecurityLabel(), shdepChangeDep(), shdepDropDependency(), shdepDropOwned(), shdepReassignOwned(), toastrel_valueid_exists(), tryAttachPartitionForeignKey(), typeInheritsFrom(), vac_update_datfrozenxid(), and validatePartitionedIndex().

449 {
450  HeapTuple htup = NULL;
451 
452  if (sysscan->irel)
453  {
454  if (index_getnext_slot(sysscan->iscan, ForwardScanDirection, sysscan->slot))
455  {
456  bool shouldFree;
457 
458  htup = ExecFetchSlotHeapTuple(sysscan->slot, false, &shouldFree);
459  Assert(!shouldFree);
460 
461  /*
462  * We currently don't need to support lossy index operators for
463  * any system catalog scan. It could be done here, using the scan
464  * keys to drive the operator calls, if we arranged to save the
465  * heap attnums during systable_beginscan(); this is practical
466  * because we still wouldn't need to support indexes on
467  * expressions.
468  */
469  if (sysscan->iscan->xs_recheck)
470  elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
471  }
472  }
473  else
474  {
475  if (table_scan_getnextslot(sysscan->scan, ForwardScanDirection, sysscan->slot))
476  {
477  bool shouldFree;
478 
479  htup = ExecFetchSlotHeapTuple(sysscan->slot, false, &shouldFree);
480  Assert(!shouldFree);
481  }
482  }
483 
484  return htup;
485 }
Relation irel
Definition: relscan.h:169
static bool table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
Definition: tableam.h:903
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
#define ERROR
Definition: elog.h:43
struct TableScanDescData * scan
Definition: relscan.h:170
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
Definition: execTuples.c:1614
#define Assert(condition)
Definition: c.h:738
bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: indexam.c:613
#define elog(elevel,...)
Definition: elog.h:214

◆ systable_getnext_ordered()

HeapTuple systable_getnext_ordered ( SysScanDesc  sysscan,
ScanDirection  direction 
)

Definition at line 634 of file genam.c.

References Assert, elog, ERROR, ExecFetchSlotHeapTuple(), index_getnext_slot(), SysScanDescData::irel, SysScanDescData::iscan, SysScanDescData::slot, and IndexScanDescData::xs_recheck.

Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), heap_fetch_toast_slice(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), and toast_delete_datum().

635 {
636  HeapTuple htup = NULL;
637 
638  Assert(sysscan->irel);
639  if (index_getnext_slot(sysscan->iscan, direction, sysscan->slot))
640  htup = ExecFetchSlotHeapTuple(sysscan->slot, false, NULL);
641 
642  /* See notes in systable_getnext */
643  if (htup && sysscan->iscan->xs_recheck)
644  elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
645 
646  return htup;
647 }
Relation irel
Definition: relscan.h:169
struct IndexScanDescData * iscan
Definition: relscan.h:171
struct TupleTableSlot * slot
Definition: relscan.h:173
#define ERROR
Definition: elog.h:43
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
Definition: execTuples.c:1614
#define Assert(condition)
Definition: c.h:738
bool index_getnext_slot(IndexScanDesc scan, ScanDirection direction, TupleTableSlot *slot)
Definition: indexam.c:613
#define elog(elevel,...)
Definition: elog.h:214

◆ systable_recheck_tuple()

bool systable_recheck_tuple ( SysScanDesc  sysscan,
HeapTuple  tup 
)

Definition at line 501 of file genam.c.

References Assert, ExecFetchSlotHeapTuple(), GetCatalogSnapshot(), SysScanDescData::heap_rel, RelationGetRelid, SysScanDescData::slot, and table_tuple_satisfies_snapshot().

Referenced by findDependentObjects(), and shdepDropOwned().

502 {
503  Snapshot freshsnap;
504  bool result;
505 
506  Assert(tup == ExecFetchSlotHeapTuple(sysscan->slot, false, NULL));
507 
508  /*
509  * Trust that table_tuple_satisfies_snapshot() and its subsidiaries
510  * (commonly LockBuffer() and HeapTupleSatisfiesMVCC()) do not themselves
511  * acquire snapshots, so we need not register the snapshot. Those
512  * facilities are too low-level to have any business scanning tables.
513  */
514  freshsnap = GetCatalogSnapshot(RelationGetRelid(sysscan->heap_rel));
515 
516  result = table_tuple_satisfies_snapshot(sysscan->heap_rel,
517  sysscan->slot,
518  freshsnap);
519 
520  return result;
521 }
Relation heap_rel
Definition: relscan.h:168
Snapshot GetCatalogSnapshot(Oid relid)
Definition: snapmgr.c:442
struct TupleTableSlot * slot
Definition: relscan.h:173
HeapTuple ExecFetchSlotHeapTuple(TupleTableSlot *slot, bool materialize, bool *shouldFree)
Definition: execTuples.c:1614
static bool table_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot, Snapshot snapshot)
Definition: tableam.h:1092
#define Assert(condition)
Definition: c.h:738
#define RelationGetRelid(relation)
Definition: rel.h:456