diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-12 23:14:21 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-12 23:14:21 +0000 |
commit | ec498cdcbb7e7b430acc7236ab19ef70f116441a (patch) | |
tree | 48ab9fa79a3b9ac79f58a6079c28328243312f56 /src/backend/utils | |
parent | 00832809a0fe271487d6851af72d0d88246a5d94 (diff) | |
download | postgresql-ec498cdcbb7e7b430acc7236ab19ef70f116441a.tar.gz postgresql-ec498cdcbb7e7b430acc7236ab19ef70f116441a.zip |
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.
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/cache/ts_cache.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index 08ae22528a4..81ff577125e 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -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); |