@@ -681,6 +681,46 @@ get_path_bloom(PathHashStack *stack)
681
681
return res ;
682
682
}
683
683
684
+ static void
685
+ log_gin_key (GINKey * key )
686
+ {
687
+ if (GINKeyType (key ) == jbvNull )
688
+ {
689
+ elog (NOTICE , "hash = %X, NULL" , key -> hash );
690
+ }
691
+ else if (GINKeyType (key ) == jbvBool )
692
+ {
693
+ if (GINKeyIsTrue (key ))
694
+ elog (NOTICE , "hash = %X, true" , key -> hash );
695
+ else
696
+ elog (NOTICE , "hash = %X, false" , key -> hash );
697
+ }
698
+ else if (GINKeyType (key ) == jbvNumeric )
699
+ {
700
+ if (GINKeyIsTrue (key ))
701
+ {
702
+ elog (NOTICE , "hash = %X, -inf" , key -> hash );
703
+ }
704
+ else
705
+ {
706
+ char * s ;
707
+ s = DatumGetCString (DirectFunctionCall1 (numeric_out , PointerGetDatum (GINKeyDataNumeric (key ))));
708
+ elog (NOTICE , "hash = %X, \"%s\"" , key -> hash , s );
709
+ }
710
+ }
711
+ else if (GINKeyType (key ) == jbvString )
712
+ {
713
+ char * s = (char * )palloc (GINKeyStringLen (key ) + 1 );
714
+ s [GINKeyStringLen (key )] = '\0' ;
715
+ memcpy (s , GINKeyDataString (key ), GINKeyStringLen (key ));
716
+ elog (NOTICE , "hash = %X, \"%s\"" , key -> hash , s );
717
+ }
718
+ else
719
+ {
720
+ elog (ERROR , "GINKey must be scalar" );
721
+ }
722
+ }
723
+
684
724
static GINKey *
685
725
make_gin_key (JsonbValue * v , uint32 hash )
686
726
{
@@ -768,6 +808,7 @@ make_gin_query_key_minus_inf(uint32 hash)
768
808
769
809
key = (GINKey * )palloc (GINKEYLEN );
770
810
key -> type = jbvNumeric | GINKeyTrue ;
811
+ key -> hash = hash ;
771
812
SET_VARSIZE (key , GINKEYLEN );
772
813
return key ;
773
814
}
@@ -843,6 +884,9 @@ gin_compare_partial_jsonb_bloom_value(PG_FUNCTION_ARGS)
843
884
StrategyNumber strategy = PG_GETARG_UINT16 (2 );
844
885
int32 result ;
845
886
887
+ /*log_gin_key(partial_key);
888
+ log_gin_key(key);*/
889
+
846
890
if (strategy == JsQueryMatchStrategyNumber )
847
891
{
848
892
KeyExtra * extra_data = (KeyExtra * )PG_GETARG_POINTER (3 );
0 commit comments