@@ -558,61 +558,41 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
558558 gistentryinit (* e , (Datum ) 0 , r , pg , o , l );
559559}
560560
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-
588561IndexTuple
589562gistFormTuple (GISTSTATE * giststate , Relation r ,
590- Datum attdata [], bool isnull [], bool newValues )
563+ Datum attdata [], bool isnull [], bool isleaf )
591564{
592- GISTENTRY centry [INDEX_MAX_KEYS ];
593565 Datum compatt [INDEX_MAX_KEYS ];
594566 int i ;
595567 IndexTuple res ;
596568
569+ /*
570+ * Call the compress method on each attribute.
571+ */
597572 for (i = 0 ; i < r -> rd_att -> natts ; i ++ )
598573 {
599574 if (isnull [i ])
600575 compatt [i ] = (Datum ) 0 ;
601576 else
602577 {
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 ;
608588 }
609589 }
610590
611591 res = index_form_tuple (giststate -> tupdesc , compatt , isnull );
612592
613593 /*
614594 * 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.
616596 */
617597 ItemPointerSetOffsetNumber (& (res -> t_tid ), 0xffff );
618598 return res ;
0 commit comments