From 7971539020a344dce3a8b3b9b93ff4f10e2f823a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 19 Aug 1998 02:04:17 +0000 Subject: heap_fetch requires buffer pointer, must be released; heap_getnext no longer returns buffer pointer, can be gotten from scan; descriptor; bootstrap can create multi-key indexes; pg_procname index now is multi-key index; oidint2, oidint4, oidname are gone (must be removed from regression tests); use System Cache rather than sequential scan in many places; heap_modifytuple no longer takes buffer parameter; remove unused buffer parameter in a few other functions; oid8 is not index-able; remove some use of single-character variable names; cleanup Buffer variables usage and scan descriptor looping; cleaned up allocation and freeing of tuples; 18k lines of diff; --- src/backend/utils/adt/selfuncs.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/backend/utils/adt/selfuncs.c') diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index d444ced1071..a5a0b86e4a4 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.20 1998/07/27 19:38:20 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.21 1998/08/19 02:03:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -295,7 +295,8 @@ getattdisbursion(Oid relid, AttrNumber attnum) if (nvals > 0) return (nvals); - atp = SearchSysCacheTuple(RELOID, ObjectIdGetDatum(relid), + atp = SearchSysCacheTuple(RELOID, + ObjectIdGetDatum(relid), 0, 0, 0); /* @@ -334,8 +335,8 @@ gethilokey(Oid relid, char **high, char **low) { - Relation rdesc; - HeapScanDesc sdesc; + Relation rel; + HeapScanDesc scan; static ScanKeyData key[3] = { {0, Anum_pg_statistic_starelid, F_OIDEQ, {0, 0, F_OIDEQ}}, {0, Anum_pg_statistic_staattnum, F_INT2EQ, {0, 0, F_INT2EQ}}, @@ -344,13 +345,13 @@ gethilokey(Oid relid, bool isnull; HeapTuple tuple; - rdesc = heap_openr(StatisticRelationName); + rel = heap_openr(StatisticRelationName); key[0].sk_argument = ObjectIdGetDatum(relid); key[1].sk_argument = Int16GetDatum((int16) attnum); key[2].sk_argument = ObjectIdGetDatum(opid); - sdesc = heap_beginscan(rdesc, 0, SnapshotNow, 3, key); - tuple = heap_getnext(sdesc, 0, (Buffer *) NULL); + scan = heap_beginscan(rel, 0, SnapshotNow, 3, key); + tuple = heap_getnext(scan, 0); if (!HeapTupleIsValid(tuple)) { *high = "n"; @@ -365,19 +366,19 @@ gethilokey(Oid relid, *high = textout((struct varlena *) heap_getattr(tuple, Anum_pg_statistic_stahikey, - RelationGetTupleDescriptor(rdesc), + RelationGetTupleDescriptor(rel), &isnull)); if (isnull) elog(DEBUG, "gethilokey: high key is null"); *low = textout((struct varlena *) heap_getattr(tuple, Anum_pg_statistic_stalokey, - RelationGetTupleDescriptor(rdesc), + RelationGetTupleDescriptor(rel), &isnull)); if (isnull) elog(DEBUG, "gethilokey: low key is null"); - heap_endscan(sdesc); - heap_close(rdesc); + heap_endscan(scan); + heap_close(rel); } float64 @@ -497,7 +498,8 @@ hashsel(Oid operatorObjectId, * have selectivity functions */ - atp = SearchSysCacheTuple(RELOID, ObjectIdGetDatum(indexrelid), + atp = SearchSysCacheTuple(RELOID, + ObjectIdGetDatum(indexrelid), 0, 0, 0); if (!HeapTupleIsValid(atp)) { @@ -549,7 +551,8 @@ hashnpage(Oid operatorObjectId, int npage; int ntuples; - atp = SearchSysCacheTuple(RELOID, ObjectIdGetDatum(indexrelid), + atp = SearchSysCacheTuple(RELOID, + ObjectIdGetDatum(indexrelid), 0, 0, 0); if (!HeapTupleIsValid(atp)) { -- cgit v1.2.3