88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.40 2005/11/06 19:29:00 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/access/hash/hashinsert.c,v 1.41 2006/01/25 23:26:11 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
2020
2121
2222static OffsetNumber _hash_pgaddtup (Relation rel ,Buffer buf ,
23- Size itemsize ,HashItem hitem );
23+ Size itemsize ,IndexTuple itup );
2424
2525
2626/*
27- *_hash_doinsert() -- Handle insertion of a singleHashItem in the table .
27+ *_hash_doinsert() -- Handle insertion of a singleindex tuple .
2828 *
2929 *This routine is called by the public interface routines, hashbuild
30- *and hashinsert. By here, hashitem is completely filled in.
31- *The datum to be used as a "key" is in the hashitem.
30+ *and hashinsert. By here, itup is completely filled in.
3231 */
3332void
34- _hash_doinsert (Relation rel ,HashItem hitem )
33+ _hash_doinsert (Relation rel ,IndexTuple itup )
3534{
3635Buffer buf ;
3736Buffer metabuf ;
3837HashMetaPage metap ;
39- IndexTuple itup ;
4038BlockNumber blkno ;
4139Page page ;
4240HashPageOpaque pageopaque ;
@@ -51,17 +49,14 @@ _hash_doinsert(Relation rel, HashItem hitem)
5149 * Compute the hash key for the item. We do this first so as not to need
5250 * to hold any locks while running the hash function.
5351 */
54- itup = & (hitem -> hash_itup );
5552if (rel -> rd_rel -> relnatts != 1 )
5653elog (ERROR ,"hash indexes support only one index key" );
5754datum = index_getattr (itup ,1 ,RelationGetDescr (rel ),& isnull );
5855Assert (!isnull );
5956hashkey = _hash_datum2hashkey (rel ,datum );
6057
6158/* compute item size too */
62- itemsz = IndexTupleDSize (hitem -> hash_itup )
63- + (sizeof (HashItemData )- sizeof (IndexTupleData ));
64-
59+ itemsz = IndexTupleDSize (* itup );
6560itemsz = MAXALIGN (itemsz );/* be safe, PageAddItem will do this but we
6661 * need to be consistent */
6762
@@ -157,7 +152,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
157152}
158153
159154/* found page with enough space, so add the item here */
160- (void )_hash_pgaddtup (rel ,buf ,itemsz ,hitem );
155+ (void )_hash_pgaddtup (rel ,buf ,itemsz ,itup );
161156
162157/* write and release the modified page */
163158_hash_wrtbuf (rel ,buf );
@@ -199,7 +194,7 @@ static OffsetNumber
199194_hash_pgaddtup (Relation rel ,
200195Buffer buf ,
201196Size itemsize ,
202- HashItem hitem )
197+ IndexTuple itup )
203198{
204199OffsetNumber itup_off ;
205200Page page ;
@@ -208,7 +203,7 @@ _hash_pgaddtup(Relation rel,
208203page = BufferGetPage (buf );
209204
210205itup_off = OffsetNumberNext (PageGetMaxOffsetNumber (page ));
211- if (PageAddItem (page , (Item )hitem ,itemsize ,itup_off ,LP_USED )
206+ if (PageAddItem (page , (Item )itup ,itemsize ,itup_off ,LP_USED )
212207== InvalidOffsetNumber )
213208elog (ERROR ,"failed to add index item to \"%s\"" ,
214209RelationGetRelationName (rel ));