#include "postgres.h"#include "access/relscan.h"#include "access/transam.h"#include "catalog/index.h"#include "lib/stringinfo.h"#include "miscadmin.h"#include "storage/bufmgr.h"#include "utils/builtins.h"#include "utils/lsyscache.h"#include "utils/rel.h"#include "utils/tqual.h"
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) |
| 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) |
Definition at line 161 of file genam.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), buf, StringInfoData::data, getTypeOutputInfo(), i, initStringInfo(), OidOutputFunctionCall(), pg_get_indexdef_columns(), RelationData::rd_opcintype, RelationData::rd_rel, RelationGetRelid, and val.
Referenced by _bt_check_unique(), check_exclusion_constraint(), and comparetup_index_btree().
{
StringInfoData buf;
int natts = indexRelation->rd_rel->relnatts;
int i;
initStringInfo(&buf);
appendStringInfo(&buf, "(%s)=(",
pg_get_indexdef_columns(RelationGetRelid(indexRelation),
true));
for (i = 0; i < natts; i++)
{
char *val;
if (isnull[i])
val = "null";
else
{
Oid foutoid;
bool typisvarlena;
/*
* The provided data is not necessarily of the type stored in the
* index; rather it is of the index opclass's input type. So look
* at rd_opcintype not the index tupdesc.
*
* Note: this is a bit shaky for opclasses that have pseudotype
* input types such as ANYARRAY or RECORD. Currently, the
* typoutput functions associated with the pseudotypes will work
* okay, but we might have to try harder in future.
*/
getTypeOutputInfo(indexRelation->rd_opcintype[i],
&foutoid, &typisvarlena);
val = OidOutputFunctionCall(foutoid, values[i]);
}
if (i > 0)
appendStringInfoString(&buf, ", ");
appendStringInfoString(&buf, val);
}
appendStringInfoChar(&buf, ')');
return buf.data;
}
| void IndexScanEnd | ( | IndexScanDesc | scan | ) |
Definition at line 139 of file genam.c.
References IndexScanDescData::keyData, NULL, IndexScanDescData::orderByData, and pfree().
Referenced by index_endscan().
{
if (scan->keyData != NULL)
pfree(scan->keyData);
if (scan->orderByData != NULL)
pfree(scan->orderByData);
pfree(scan);
}
| IndexScanDesc RelationGetIndexScan | ( | Relation | indexRelation, | |
| int | nkeys, | |||
| int | norderbys | |||
| ) |
Definition at line 73 of file genam.c.
References IndexScanDescData::heapRelation, IndexScanDescData::ignore_killed_tuples, IndexScanDescData::indexRelation, ItemPointerSetInvalid, IndexScanDescData::keyData, IndexScanDescData::kill_prior_tuple, IndexScanDescData::numberOfKeys, IndexScanDescData::numberOfOrderBys, IndexScanDescData::opaque, IndexScanDescData::orderByData, palloc(), HeapTupleData::t_data, HeapTupleData::t_self, TransactionStartedDuringRecovery(), IndexScanDescData::xactStartedInRecovery, IndexScanDescData::xs_cbuf, IndexScanDescData::xs_continue_hot, IndexScanDescData::xs_ctup, IndexScanDescData::xs_itup, IndexScanDescData::xs_itupdesc, IndexScanDescData::xs_snapshot, and IndexScanDescData::xs_want_itup.
Referenced by btbeginscan(), ginbeginscan(), gistbeginscan(), hashbeginscan(), and spgbeginscan().
{
IndexScanDesc scan;
scan = (IndexScanDesc) palloc(sizeof(IndexScanDescData));
scan->heapRelation = NULL; /* may be set later */
scan->indexRelation = indexRelation;
scan->xs_snapshot = SnapshotNow; /* may be set later */
scan->numberOfKeys = nkeys;
scan->numberOfOrderBys = norderbys;
/*
* We allocate key workspace here, but it won't get filled until amrescan.
*/
if (nkeys > 0)
scan->keyData = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
else
scan->keyData = NULL;
if (norderbys > 0)
scan->orderByData = (ScanKey) palloc(sizeof(ScanKeyData) * norderbys);
else
scan->orderByData = NULL;
scan->xs_want_itup = false; /* may be set later */
/*
* During recovery we ignore killed tuples and don't bother to kill them
* either. We do this because the xmin on the primary node could easily be
* later than the xmin on the standby node, so that what the primary
* thinks is killed is supposed to be visible on standby. So for correct
* MVCC for queries during recovery we must ignore these hints and check
* all tuples. Do *not* set ignore_killed_tuples to true when running in a
* transaction that was started during recovery. xactStartedInRecovery
* should not be altered by index AMs.
*/
scan->kill_prior_tuple = false;
scan->xactStartedInRecovery = TransactionStartedDuringRecovery();
scan->ignore_killed_tuples = !scan->xactStartedInRecovery;
scan->opaque = NULL;
scan->xs_itup = NULL;
scan->xs_itupdesc = NULL;
ItemPointerSetInvalid(&scan->xs_ctup.t_self);
scan->xs_ctup.t_data = NULL;
scan->xs_cbuf = InvalidBuffer;
scan->xs_continue_hot = false;
return scan;
}
| SysScanDesc systable_beginscan | ( | Relation | heapRelation, | |
| Oid | indexId, | |||
| bool | indexOK, | |||
| Snapshot | snapshot, | |||
| int | nkeys, | |||
| ScanKey | key | |||
| ) |
Definition at line 248 of file genam.c.
References AccessShareLock, elog, ERROR, heap_beginscan_strat(), SysScanDescData::heap_rel, i, IgnoreSystemIndexes, index_beginscan(), index_open(), index_rescan(), SysScanDescData::irel, SysScanDescData::iscan, NULL, palloc(), RelationData::rd_index, ReindexIsProcessingIndex(), SysScanDescData::scan, and ScanKeyData::sk_attno.
Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterSeqNamespaces(), AlterSetting(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnType(), ATExecDropConstraint(), ATExecDropInherit(), ATExecValidateConstraint(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependencyFor(), check_functional_grouping(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), ConstraintNameIsUsed(), copyTemplateDependencies(), CreateComments(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropCastById(), DropConfigurationMapping(), dropDatabaseDependencies(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), find_composite_type_dependencies(), find_inheritance_children(), find_language_template(), 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_pkey_attnames(), get_relation_constraint_oid(), get_rels_with_domain(), get_trigger_oid(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), GetDomainConstraints(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentity(), getOwnedSequences(), GetSecurityLabel(), GetSharedSecurityLabel(), heap_truncate_find_FKs(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), regclassin(), regoperin(), regprocin(), regtypein(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetIndexList(), RelationRemoveInheritance(), RemoveAmOpEntryById(), RemoveAmProcEntryById(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveCollationById(), RemoveDefaultACLById(), RemoveExtensionById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), renametrig(), ScanPgRelation(), SearchCatCache(), SearchCatCacheList(), 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(), typeInheritsFrom(), and vac_update_datfrozenxid().
{
SysScanDesc sysscan;
Relation irel;
if (indexOK &&
!IgnoreSystemIndexes &&
!ReindexIsProcessingIndex(indexId))
irel = index_open(indexId, AccessShareLock);
else
irel = NULL;
sysscan = (SysScanDesc) palloc(sizeof(SysScanDescData));
sysscan->heap_rel = heapRelation;
sysscan->irel = irel;
if (irel)
{
int i;
/* Change attribute numbers to be index column numbers. */
for (i = 0; i < nkeys; i++)
{
int j;
for (j = 0; j < irel->rd_index->indnatts; j++)
{
if (key[i].sk_attno == irel->rd_index->indkey.values[j])
{
key[i].sk_attno = j + 1;
break;
}
}
if (j == irel->rd_index->indnatts)
elog(ERROR, "column is not in index");
}
sysscan->iscan = index_beginscan(heapRelation, irel,
snapshot, nkeys, 0);
index_rescan(sysscan->iscan, key, nkeys, NULL, 0);
sysscan->scan = NULL;
}
else
{
/*
* We disallow synchronized scans when forced to use a heapscan on a
* catalog. In most cases the desired rows are near the front, so
* that the unpredictable start point of a syncscan is a serious
* disadvantage; and there are no compensating advantages, because
* it's unlikely that such scans will occur in parallel.
*/
sysscan->scan = heap_beginscan_strat(heapRelation, snapshot,
nkeys, key,
true, false);
sysscan->iscan = NULL;
}
return sysscan;
}
| SysScanDesc systable_beginscan_ordered | ( | Relation | heapRelation, | |
| Relation | indexRelation, | |||
| Snapshot | snapshot, | |||
| int | nkeys, | |||
| ScanKey | key | |||
| ) |
Definition at line 425 of file genam.c.
References elog, ERROR, SysScanDescData::heap_rel, i, IgnoreSystemIndexes, index_beginscan(), index_rescan(), SysScanDescData::irel, SysScanDescData::iscan, NULL, palloc(), RelationData::rd_index, ReindexIsProcessingIndex(), RelationGetRelationName, RelationGetRelid, SysScanDescData::scan, ScanKeyData::sk_attno, and WARNING.
Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), toast_delete_datum(), toast_fetch_datum(), and toast_fetch_datum_slice().
{
SysScanDesc sysscan;
int i;
/* REINDEX can probably be a hard error here ... */
if (ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))
elog(ERROR, "cannot do ordered scan on index \"%s\", because it is being reindexed",
RelationGetRelationName(indexRelation));
/* ... but we only throw a warning about violating IgnoreSystemIndexes */
if (IgnoreSystemIndexes)
elog(WARNING, "using index \"%s\" despite IgnoreSystemIndexes",
RelationGetRelationName(indexRelation));
sysscan = (SysScanDesc) palloc(sizeof(SysScanDescData));
sysscan->heap_rel = heapRelation;
sysscan->irel = indexRelation;
/* Change attribute numbers to be index column numbers. */
for (i = 0; i < nkeys; i++)
{
int j;
for (j = 0; j < indexRelation->rd_index->indnatts; j++)
{
if (key[i].sk_attno == indexRelation->rd_index->indkey.values[j])
{
key[i].sk_attno = j + 1;
break;
}
}
if (j == indexRelation->rd_index->indnatts)
elog(ERROR, "column is not in index");
}
sysscan->iscan = index_beginscan(heapRelation, indexRelation,
snapshot, nkeys, 0);
index_rescan(sysscan->iscan, key, nkeys, NULL, 0);
sysscan->scan = NULL;
return sysscan;
}
| void systable_endscan | ( | SysScanDesc | sysscan | ) |
Definition at line 394 of file genam.c.
References AccessShareLock, heap_endscan(), index_close(), index_endscan(), SysScanDescData::irel, SysScanDescData::iscan, pfree(), and SysScanDescData::scan.
Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterSeqNamespaces(), AlterSetting(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnType(), ATExecDropConstraint(), ATExecDropInherit(), ATExecValidateConstraint(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependencyFor(), check_functional_grouping(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), ConstraintNameIsUsed(), copyTemplateDependencies(), CreateComments(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropCastById(), DropConfigurationMapping(), dropDatabaseDependencies(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), find_composite_type_dependencies(), find_inheritance_children(), find_language_template(), 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_pkey_attnames(), get_relation_constraint_oid(), get_rels_with_domain(), get_trigger_oid(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), GetDomainConstraints(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentity(), getOwnedSequences(), GetSecurityLabel(), GetSharedSecurityLabel(), heap_truncate_find_FKs(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), regclassin(), regoperin(), regprocin(), regtypein(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetIndexList(), RelationRemoveInheritance(), RemoveAmOpEntryById(), RemoveAmProcEntryById(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveCollationById(), RemoveDefaultACLById(), RemoveExtensionById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), renametrig(), ScanPgRelation(), SearchCatCache(), SearchCatCacheList(), 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(), typeInheritsFrom(), and vac_update_datfrozenxid().
{
if (sysscan->irel)
{
index_endscan(sysscan->iscan);
index_close(sysscan->irel, AccessShareLock);
}
else
heap_endscan(sysscan->scan);
pfree(sysscan);
}
| void systable_endscan_ordered | ( | SysScanDesc | sysscan | ) |
Definition at line 493 of file genam.c.
References Assert, index_endscan(), SysScanDescData::irel, SysScanDescData::iscan, and pfree().
Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), toast_delete_datum(), toast_fetch_datum(), and toast_fetch_datum_slice().
{
Assert(sysscan->irel);
index_endscan(sysscan->iscan);
pfree(sysscan);
}
| HeapTuple systable_getnext | ( | SysScanDesc | sysscan | ) |
Definition at line 323 of file genam.c.
References elog, ERROR, ForwardScanDirection, heap_getnext(), index_getnext(), SysScanDescData::irel, SysScanDescData::iscan, SysScanDescData::scan, and IndexScanDescData::xs_recheck.
Referenced by AfterTriggerSetState(), AlterConstraintNamespaces(), AlterDatabase(), AlterDatabaseOwner(), AlterDomainDropConstraint(), AlterDomainValidateConstraint(), AlterExtensionNamespace(), AlterSeqNamespaces(), AlterSetting(), ApplyExtensionUpdates(), ApplySetting(), ATExecAddInherit(), ATExecAddOf(), ATExecAlterColumnType(), ATExecDropConstraint(), ATExecDropInherit(), ATExecValidateConstraint(), AttrDefaultFetch(), change_owner_fix_column_acls(), change_owner_recurse_to_sequences(), changeDependencyFor(), check_functional_grouping(), CheckConstraintFetch(), checkSharedDependencies(), ChooseConstraintName(), ConstraintNameIsUsed(), copyTemplateDependencies(), CreateComments(), CreateSharedComments(), CreateTrigger(), DefineOpClass(), DefineTSConfiguration(), DeleteAttributeTuples(), DeleteComments(), deleteDependencyRecordsFor(), deleteDependencyRecordsForClass(), deleteOneObject(), DeleteSecurityLabel(), DeleteSharedComments(), DeleteSharedSecurityLabel(), DeleteSystemAttributeTuples(), drop_parent_dependency(), DropCastById(), DropConfigurationMapping(), dropDatabaseDependencies(), DropRole(), EnableDisableTrigger(), EnumValuesDelete(), exec_object_restorecon(), ExecAlterExtensionStmt(), ExecGrant_Largeobject(), extension_config_remove(), find_composite_type_dependencies(), find_inheritance_children(), find_language_template(), 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_pkey_attnames(), get_relation_constraint_oid(), get_rels_with_domain(), get_trigger_oid(), GetComment(), GetDatabaseTuple(), GetDatabaseTupleByOid(), GetDefaultOpClass(), GetDomainConstraints(), getExtensionOfObject(), GetNewOidWithIndex(), getObjectDescription(), getObjectIdentity(), getOwnedSequences(), GetSecurityLabel(), GetSharedSecurityLabel(), heap_truncate_find_FKs(), isObjectPinned(), isSharedObjectPinned(), LargeObjectDrop(), LargeObjectExists(), load_enum_cache_data(), LookupOpclassInfo(), makeConfigurationDependencies(), MakeConfigurationMapping(), MergeConstraintsIntoExisting(), MergeWithExistingConstraint(), movedb(), myLargeObjectExists(), pg_extension_config_dump(), pg_extension_ownercheck(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_largeobject_aclmask_snapshot(), pg_largeobject_ownercheck(), RangeDelete(), regclassin(), regoperin(), regprocin(), regtypein(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationGetExclusionInfo(), RelationGetIndexList(), RelationRemoveInheritance(), RemoveAmOpEntryById(), RemoveAmProcEntryById(), RemoveAttrDefault(), RemoveAttrDefaultById(), RemoveCollationById(), RemoveDefaultACLById(), RemoveExtensionById(), RemoveRewriteRuleById(), RemoveRoleFromObjectACL(), RemoveStatistics(), RemoveTriggerById(), RemoveTSConfigurationById(), renametrig(), ScanPgRelation(), SearchCatCache(), SearchCatCacheList(), 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(), typeInheritsFrom(), and vac_update_datfrozenxid().
{
HeapTuple htup;
if (sysscan->irel)
{
htup = index_getnext(sysscan->iscan, ForwardScanDirection);
/*
* We currently don't need to support lossy index operators for any
* system catalog scan. It could be done here, using the scan keys to
* drive the operator calls, if we arranged to save the heap attnums
* during systable_beginscan(); this is practical because we still
* wouldn't need to support indexes on expressions.
*/
if (htup && sysscan->iscan->xs_recheck)
elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
}
else
htup = heap_getnext(sysscan->scan, ForwardScanDirection);
return htup;
}
| HeapTuple systable_getnext_ordered | ( | SysScanDesc | sysscan, | |
| ScanDirection | direction | |||
| ) |
Definition at line 476 of file genam.c.
References Assert, elog, ERROR, index_getnext(), SysScanDescData::irel, SysScanDescData::iscan, and IndexScanDescData::xs_recheck.
Referenced by BuildEventTriggerCache(), enum_endpoint(), enum_range_internal(), inv_getsize(), inv_read(), inv_truncate(), inv_write(), lookup_ts_config_cache(), toast_delete_datum(), toast_fetch_datum(), and toast_fetch_datum_slice().
{
HeapTuple htup;
Assert(sysscan->irel);
htup = index_getnext(sysscan->iscan, direction);
/* See notes in systable_getnext */
if (htup && sysscan->iscan->xs_recheck)
elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
return htup;
}
| bool systable_recheck_tuple | ( | SysScanDesc | sysscan, | |
| HeapTuple | tup | |||
| ) |
Definition at line 357 of file genam.c.
References Assert, BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferIsValid, HeapTupleSatisfiesVisibility, SysScanDescData::irel, SysScanDescData::iscan, LockBuffer(), HeapScanDescData::rs_cbuf, HeapScanDescData::rs_ctup, HeapScanDescData::rs_snapshot, SysScanDescData::scan, IndexScanDescData::xs_cbuf, IndexScanDescData::xs_ctup, and IndexScanDescData::xs_snapshot.
Referenced by findDependentObjects().
{
bool result;
if (sysscan->irel)
{
IndexScanDesc scan = sysscan->iscan;
Assert(tup == &scan->xs_ctup);
Assert(BufferIsValid(scan->xs_cbuf));
/* must hold a buffer lock to call HeapTupleSatisfiesVisibility */
LockBuffer(scan->xs_cbuf, BUFFER_LOCK_SHARE);
result = HeapTupleSatisfiesVisibility(tup, scan->xs_snapshot,
scan->xs_cbuf);
LockBuffer(scan->xs_cbuf, BUFFER_LOCK_UNLOCK);
}
else
{
HeapScanDesc scan = sysscan->scan;
Assert(tup == &scan->rs_ctup);
Assert(BufferIsValid(scan->rs_cbuf));
/* must hold a buffer lock to call HeapTupleSatisfiesVisibility */
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
result = HeapTupleSatisfiesVisibility(tup, scan->rs_snapshot,
scan->rs_cbuf);
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
}
return result;
}
1.7.1