88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.124 2005/08/11 13: 22:33 momjian Exp $
11+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/24 22:54:35 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -49,8 +49,7 @@ static void _bt_insertonpg(Relation rel, Buffer buf,
4949bool split_only_page );
5050static Buffer _bt_split (Relation rel ,Buffer buf ,OffsetNumber firstright ,
5151OffsetNumber newitemoff ,Size newitemsz ,
52- BTItem newitem ,bool newitemonleft ,
53- OffsetNumber * itup_off ,BlockNumber * itup_blkno );
52+ BTItem newitem ,bool newitemonleft );
5453static OffsetNumber _bt_findsplitloc (Relation rel ,Page page ,
5554OffsetNumber newitemoff ,
5655Size newitemsz ,
@@ -365,8 +364,6 @@ _bt_insertonpg(Relation rel,
365364{
366365Page page ;
367366BTPageOpaque lpageop ;
368- OffsetNumber itup_off ;
369- BlockNumber itup_blkno ;
370367OffsetNumber newitemoff ;
371368OffsetNumber firstright = InvalidOffsetNumber ;
372369Size itemsz ;
@@ -490,8 +487,7 @@ _bt_insertonpg(Relation rel,
490487
491488/* split the buffer into left and right halves */
492489rbuf = _bt_split (rel ,buf ,firstright ,
493- newitemoff ,itemsz ,btitem ,newitemonleft ,
494- & itup_off ,& itup_blkno );
490+ newitemoff ,itemsz ,btitem ,newitemonleft );
495491
496492/*----------
497493 * By here,
@@ -516,6 +512,8 @@ _bt_insertonpg(Relation rel,
516512Buffer metabuf = InvalidBuffer ;
517513Page metapg = NULL ;
518514BTMetaPageData * metad = NULL ;
515+ OffsetNumber itup_off ;
516+ BlockNumber itup_blkno ;
519517
520518itup_off = newitemoff ;
521519itup_blkno = BufferGetBlockNumber (buf );
@@ -640,14 +638,12 @@ _bt_insertonpg(Relation rel,
640638 *must be inserted along with the data from the old page.
641639 *
642640 *Returns the new right sibling of buf, pinned and write-locked.
643- *The pin and lock on buf are maintained. *itup_off and *itup_blkno
644- *are set to the exact location where newitem was inserted.
641+ *The pin and lock on buf are maintained.
645642 */
646643static Buffer
647644_bt_split (Relation rel ,Buffer buf ,OffsetNumber firstright ,
648645OffsetNumber newitemoff ,Size newitemsz ,BTItem newitem ,
649- bool newitemonleft ,
650- OffsetNumber * itup_off ,BlockNumber * itup_blkno )
646+ bool newitemonleft )
651647{
652648Buffer rbuf ;
653649Page origpage ;
@@ -659,6 +655,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
659655Buffer sbuf = InvalidBuffer ;
660656Page spage = NULL ;
661657BTPageOpaque sopaque = NULL ;
658+ OffsetNumber itup_off = 0 ;
659+ BlockNumber itup_blkno = 0 ;
662660Size itemsz ;
663661ItemId itemid ;
664662BTItem item ;
@@ -752,16 +750,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
752750{
753751_bt_pgaddtup (rel ,leftpage ,newitemsz ,newitem ,leftoff ,
754752"left sibling" );
755- * itup_off = leftoff ;
756- * itup_blkno = BufferGetBlockNumber (buf );
753+ itup_off = leftoff ;
754+ itup_blkno = BufferGetBlockNumber (buf );
757755leftoff = OffsetNumberNext (leftoff );
758756}
759757else
760758{
761759_bt_pgaddtup (rel ,rightpage ,newitemsz ,newitem ,rightoff ,
762760"right sibling" );
763- * itup_off = rightoff ;
764- * itup_blkno = BufferGetBlockNumber (rbuf );
761+ itup_off = rightoff ;
762+ itup_blkno = BufferGetBlockNumber (rbuf );
765763rightoff = OffsetNumberNext (rightoff );
766764}
767765}
@@ -788,16 +786,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
788786{
789787_bt_pgaddtup (rel ,leftpage ,newitemsz ,newitem ,leftoff ,
790788"left sibling" );
791- * itup_off = leftoff ;
792- * itup_blkno = BufferGetBlockNumber (buf );
789+ itup_off = leftoff ;
790+ itup_blkno = BufferGetBlockNumber (buf );
793791leftoff = OffsetNumberNext (leftoff );
794792}
795793else
796794{
797795_bt_pgaddtup (rel ,rightpage ,newitemsz ,newitem ,rightoff ,
798796"right sibling" );
799- * itup_off = rightoff ;
800- * itup_blkno = BufferGetBlockNumber (rbuf );
797+ itup_off = rightoff ;
798+ itup_blkno = BufferGetBlockNumber (rbuf );
801799rightoff = OffsetNumberNext (rightoff );
802800}
803801}
@@ -839,7 +837,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
839837XLogRecData rdata [4 ];
840838
841839xlrec .target .node = rel -> rd_node ;
842- ItemPointerSet (& (xlrec .target .tid ),* itup_blkno ,* itup_off );
840+ ItemPointerSet (& (xlrec .target .tid ),itup_blkno ,itup_off );
843841if (newitemonleft )
844842xlrec .otherblk = BufferGetBlockNumber (rbuf );
845843else