mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Create new routines systable_beginscan_ordered, systable_getnext_ordered,
systable_endscan_ordered that have API similar to systable_beginscan etc (in particular, the passed-in scankeys have heap not index attnums), but guarantee ordered output, unlike the existing functions. For the moment these are just very thin wrappers around index_beginscan/index_getnext/etc. Someday they might need to get smarter; but for now this is just a code refactoring exercise to reduce the number of direct callers of index_getnext, in preparation for changing that function's API. In passing, remove index_getnext_indexitem, which has been dead code for quite some time, and will have even less use than that in the presence of run-time-lossy indexes.
This commit is contained in:
11
src/backend/utils/cache/ts_cache.c
vendored
11
src/backend/utils/cache/ts_cache.c
vendored
@ -20,7 +20,7 @@
|
||||
* Copyright (c) 2006-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.6 2008/03/26 21:10:39 alvherre Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/ts_cache.c,v 1.7 2008/04/12 23:14:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -419,7 +419,7 @@ lookup_ts_config_cache(Oid cfgId)
|
||||
Relation maprel;
|
||||
Relation mapidx;
|
||||
ScanKeyData mapskey;
|
||||
IndexScanDesc mapscan;
|
||||
SysScanDesc mapscan;
|
||||
HeapTuple maptup;
|
||||
ListDictionary maplists[MAXTOKENTYPE + 1];
|
||||
Oid mapdicts[MAXDICTSPERTT];
|
||||
@ -488,9 +488,10 @@ lookup_ts_config_cache(Oid cfgId)
|
||||
|
||||
maprel = heap_open(TSConfigMapRelationId, AccessShareLock);
|
||||
mapidx = index_open(TSConfigMapIndexId, AccessShareLock);
|
||||
mapscan = index_beginscan(maprel, mapidx, SnapshotNow, 1, &mapskey);
|
||||
mapscan = systable_beginscan_ordered(maprel, mapidx,
|
||||
SnapshotNow, 1, &mapskey);
|
||||
|
||||
while ((maptup = index_getnext(mapscan, ForwardScanDirection)) != NULL)
|
||||
while ((maptup = systable_getnext_ordered(mapscan, ForwardScanDirection)) != NULL)
|
||||
{
|
||||
Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup);
|
||||
int toktype = cfgmap->maptokentype;
|
||||
@ -524,7 +525,7 @@ lookup_ts_config_cache(Oid cfgId)
|
||||
}
|
||||
}
|
||||
|
||||
index_endscan(mapscan);
|
||||
systable_endscan_ordered(mapscan);
|
||||
index_close(mapidx, AccessShareLock);
|
||||
heap_close(maprel, AccessShareLock);
|
||||
|
||||
|
Reference in New Issue
Block a user