@@ -681,6 +681,46 @@ get_path_bloom(PathHashStack *stack)
681681 return res ;
682682}
683683
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+
684724static GINKey *
685725make_gin_key (JsonbValue * v , uint32 hash )
686726{
@@ -768,6 +808,7 @@ make_gin_query_key_minus_inf(uint32 hash)
768808
769809 key = (GINKey * )palloc (GINKEYLEN );
770810 key -> type = jbvNumeric | GINKeyTrue ;
811+ key -> hash = hash ;
771812 SET_VARSIZE (key , GINKEYLEN );
772813 return key ;
773814}
@@ -843,6 +884,9 @@ gin_compare_partial_jsonb_bloom_value(PG_FUNCTION_ARGS)
843884 StrategyNumber strategy = PG_GETARG_UINT16 (2 );
844885 int32 result ;
845886
887+ /*log_gin_key(partial_key);
888+ log_gin_key(key);*/
889+
846890 if (strategy == JsQueryMatchStrategyNumber )
847891 {
848892 KeyExtra * extra_data = (KeyExtra * )PG_GETARG_POINTER (3 );
0 commit comments