@@ -679,7 +679,7 @@ UpdateGraphOnDisk(Relation index, FmgrInfo *procinfo, Oid collation, HnswElement
679
679
* Insert a tuple into the index
680
680
*/
681
681
bool
682
- HnswInsertTupleOnDisk (Relation index , Datum value , Datum * values , bool * isnull , ItemPointer heap_tid , bool building )
682
+ HnswInsertTupleOnDisk (Relation index , Datum value , ItemPointer heaptid , bool building )
683
683
{
684
684
HnswElement entryPoint ;
685
685
HnswElement element ;
@@ -701,7 +701,7 @@ HnswInsertTupleOnDisk(Relation index, Datum value, Datum *values, bool *isnull,
701
701
HnswGetMetaPageInfo (index , & m , & entryPoint );
702
702
703
703
/* Create an element */
704
- element = HnswInitElement (base , heap_tid , m , HnswGetMl (m ), HnswGetMaxLevel (m ), NULL );
704
+ element = HnswInitElement (base , heaptid , m , HnswGetMl (m ), HnswGetMaxLevel (m ), NULL );
705
705
HnswPtrStore (base , element -> value , DatumGetPointer (value ));
706
706
707
707
/* Prevent concurrent inserts when likely updating entry point */
@@ -734,31 +734,18 @@ HnswInsertTupleOnDisk(Relation index, Datum value, Datum *values, bool *isnull,
734
734
* Insert a tuple into the index
735
735
*/
736
736
static void
737
- HnswInsertTuple (Relation index , Datum * values , bool * isnull , ItemPointer heap_tid )
737
+ HnswInsertTuple (Relation index , Datum * values , bool * isnull , ItemPointer heaptid )
738
738
{
739
739
Datum value ;
740
740
const HnswTypeInfo * typeInfo = HnswGetTypeInfo (index );
741
- FmgrInfo * normprocinfo ;
741
+ FmgrInfo * normprocinfo = HnswOptionalProcInfo ( index , HNSW_NORM_PROC ) ;
742
742
Oid collation = index -> rd_indcollation [0 ];
743
743
744
- /* Detoast once for all calls */
745
- value = PointerGetDatum (PG_DETOAST_DATUM (values [0 ]));
746
-
747
- /* Check value */
748
- if (typeInfo -> checkValue != NULL )
749
- typeInfo -> checkValue (DatumGetPointer (value ));
750
-
751
- /* Normalize if needed */
752
- normprocinfo = HnswOptionalProcInfo (index , HNSW_NORM_PROC );
753
- if (normprocinfo != NULL )
754
- {
755
- if (!HnswCheckNorm (normprocinfo , collation , value ))
756
- return ;
757
-
758
- value = HnswNormValue (typeInfo , collation , value );
759
- }
744
+ /* Form index value */
745
+ if (!HnswFormIndexValue (& value , values , isnull , typeInfo , normprocinfo , collation ))
746
+ return ;
760
747
761
- HnswInsertTupleOnDisk (index , value , values , isnull , heap_tid , false);
748
+ HnswInsertTupleOnDisk (index , value , heaptid , false);
762
749
}
763
750
764
751
/*
0 commit comments