@@ -558,61 +558,41 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
558
558
gistentryinit (* e , (Datum ) 0 , r , pg , o , l );
559
559
}
560
560
561
-
562
- /*
563
- * initialize a GiST entry with a compressed version of key
564
- */
565
- void
566
- gistcentryinit (GISTSTATE * giststate , int nkey ,
567
- GISTENTRY * e , Datum k , Relation r ,
568
- Page pg , OffsetNumber o , bool l , bool isNull )
569
- {
570
- if (!isNull )
571
- {
572
- GISTENTRY * cep ;
573
-
574
- gistentryinit (* e , k , r , pg , o , l );
575
- cep = (GISTENTRY * )
576
- DatumGetPointer (FunctionCall1Coll (& giststate -> compressFn [nkey ],
577
- giststate -> supportCollation [nkey ],
578
- PointerGetDatum (e )));
579
- /* compressFn may just return the given pointer */
580
- if (cep != e )
581
- gistentryinit (* e , cep -> key , cep -> rel , cep -> page , cep -> offset ,
582
- cep -> leafkey );
583
- }
584
- else
585
- gistentryinit (* e , (Datum ) 0 , r , pg , o , l );
586
- }
587
-
588
561
IndexTuple
589
562
gistFormTuple (GISTSTATE * giststate , Relation r ,
590
- Datum attdata [], bool isnull [], bool newValues )
563
+ Datum attdata [], bool isnull [], bool isleaf )
591
564
{
592
- GISTENTRY centry [INDEX_MAX_KEYS ];
593
565
Datum compatt [INDEX_MAX_KEYS ];
594
566
int i ;
595
567
IndexTuple res ;
596
568
569
+ /*
570
+ * Call the compress method on each attribute.
571
+ */
597
572
for (i = 0 ; i < r -> rd_att -> natts ; i ++ )
598
573
{
599
574
if (isnull [i ])
600
575
compatt [i ] = (Datum ) 0 ;
601
576
else
602
577
{
603
- gistcentryinit (giststate , i , & centry [i ], attdata [i ],
604
- r , NULL , (OffsetNumber ) 0 ,
605
- newValues ,
606
- FALSE);
607
- compatt [i ] = centry [i ].key ;
578
+ GISTENTRY centry ;
579
+ GISTENTRY * cep ;
580
+
581
+ gistentryinit (centry , attdata [i ], r , NULL , (OffsetNumber ) 0 ,
582
+ isleaf );
583
+ cep = (GISTENTRY * )
584
+ DatumGetPointer (FunctionCall1Coll (& giststate -> compressFn [i ],
585
+ giststate -> supportCollation [i ],
586
+ PointerGetDatum (& centry )));
587
+ compatt [i ] = cep -> key ;
608
588
}
609
589
}
610
590
611
591
res = index_form_tuple (giststate -> tupdesc , compatt , isnull );
612
592
613
593
/*
614
594
* The offset number on tuples on internal pages is unused. For historical
615
- * reasons, it is set 0xffff.
595
+ * reasons, it is set to 0xffff.
616
596
*/
617
597
ItemPointerSetOffsetNumber (& (res -> t_tid ), 0xffff );
618
598
return res ;
0 commit comments