diff options
Diffstat (limited to 'src/backend/access/hash')
-rw-r--r-- | src/backend/access/hash/hash.c | 34 | ||||
-rw-r--r-- | src/backend/access/hash/hashinsert.c | 12 |
2 files changed, 16 insertions, 30 deletions
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index a97d780c06e..1fd901e96a3 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.76 2004/12/31 21:59:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.77 2005/03/21 01:23:57 tgl Exp $ * * NOTES * This file contains only the public interface routines. @@ -36,8 +36,8 @@ typedef struct static void hashbuildCallback(Relation index, HeapTuple htup, - Datum *attdata, - char *nulls, + Datum *values, + bool *isnull, bool tupleIsAlive, void *state); @@ -103,18 +103,17 @@ hashbuild(PG_FUNCTION_ARGS) static void hashbuildCallback(Relation index, HeapTuple htup, - Datum *attdata, - char *nulls, + Datum *values, + bool *isnull, bool tupleIsAlive, void *state) { HashBuildState *buildstate = (HashBuildState *) state; IndexTuple itup; HashItem hitem; - InsertIndexResult res; /* form an index tuple and point it at the heap tuple */ - itup = index_formtuple(RelationGetDescr(index), attdata, nulls); + itup = index_form_tuple(RelationGetDescr(index), values, isnull); itup->t_tid = htup->t_self; /* Hash indexes don't index nulls, see notes in hashinsert */ @@ -126,10 +125,7 @@ hashbuildCallback(Relation index, hitem = _hash_formitem(itup); - res = _hash_doinsert(index, hitem); - - if (res) - pfree(res); + _hash_doinsert(index, hitem); buildstate->indtuples += 1; @@ -141,27 +137,25 @@ hashbuildCallback(Relation index, * hashinsert() -- insert an index tuple into a hash table. * * Hash on the index tuple's key, find the appropriate location - * for the new tuple, put it there, and return an InsertIndexResult - * to the caller. + * for the new tuple, and put it there. */ Datum hashinsert(PG_FUNCTION_ARGS) { Relation rel = (Relation) PG_GETARG_POINTER(0); - Datum *datum = (Datum *) PG_GETARG_POINTER(1); - char *nulls = (char *) PG_GETARG_POINTER(2); + Datum *values = (Datum *) PG_GETARG_POINTER(1); + bool *isnull = (bool *) PG_GETARG_POINTER(2); ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3); #ifdef NOT_USED Relation heapRel = (Relation) PG_GETARG_POINTER(4); bool checkUnique = PG_GETARG_BOOL(5); #endif - InsertIndexResult res; HashItem hitem; IndexTuple itup; /* generate an index tuple */ - itup = index_formtuple(RelationGetDescr(rel), datum, nulls); + itup = index_form_tuple(RelationGetDescr(rel), values, isnull); itup->t_tid = *ht_ctid; /* @@ -176,17 +170,17 @@ hashinsert(PG_FUNCTION_ARGS) if (IndexTupleHasNulls(itup)) { pfree(itup); - PG_RETURN_POINTER(NULL); + PG_RETURN_BOOL(false); } hitem = _hash_formitem(itup); - res = _hash_doinsert(rel, hitem); + _hash_doinsert(rel, hitem); pfree(hitem); pfree(itup); - PG_RETURN_POINTER(res); + PG_RETURN_BOOL(true); } diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c index 22ad1a09108..a09b8b4bc15 100644 --- a/src/backend/access/hash/hashinsert.c +++ b/src/backend/access/hash/hashinsert.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.35 2004/12/31 21:59:13 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.36 2005/03/21 01:23:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -30,7 +30,7 @@ static OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, * and hashinsert. By here, hashitem is completely filled in. * The datum to be used as a "key" is in the hashitem. */ -InsertIndexResult +void _hash_doinsert(Relation rel, HashItem hitem) { Buffer buf; @@ -39,7 +39,6 @@ _hash_doinsert(Relation rel, HashItem hitem) IndexTuple itup; BlockNumber itup_blkno; OffsetNumber itup_off; - InsertIndexResult res; BlockNumber blkno; Page page; HashPageOpaque pageopaque; @@ -190,13 +189,6 @@ _hash_doinsert(Relation rel, HashItem hitem) /* Finally drop our pin on the metapage */ _hash_dropbuf(rel, metabuf); - - /* Create the return data structure */ - res = (InsertIndexResult) palloc(sizeof(InsertIndexResultData)); - - ItemPointerSet(&(res->pointerData), itup_blkno, itup_off); - - return res; } /* |