@@ -59,7 +59,7 @@ typedef struct
5959static uint32 get_bloom_value (uint32 hash );
6060static uint32 get_path_bloom (PathHashStack * stack );
6161static GINKey * make_gin_key (JsonbValue * v ,uint32 hash );
62- static GINKey * make_gin_query_key (JsQueryValue * value ,uint32 hash );
62+ static GINKey * make_gin_query_key (JsQueryItemR * value ,uint32 hash );
6363static GINKey * make_gin_query_key_minus_inf (uint32 hash );
6464static int32 compare_gin_key_value (GINKey * arg1 ,GINKey * arg2 );
6565static int add_entry (Entries * e ,Datum key ,Pointer extra ,bool pmatch );
@@ -281,11 +281,11 @@ make_gin_key(JsonbValue *v, uint32 hash)
281281}
282282
283283static GINKey *
284- make_gin_query_key (JsQueryValue * value ,uint32 hash )
284+ make_gin_query_key (JsQueryItemR * value ,uint32 hash )
285285{
286286GINKey * key ;
287- char * jqBase = value -> jqBase ;
288- int len , jqPos = value -> jqPos ;
287+ int32 len ;
288+ char * s ;
289289Numeric numeric ;
290290
291291switch (value -> type )
@@ -296,21 +296,19 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
296296SET_VARSIZE (key ,GINKEYLEN );
297297break ;
298298case jqiString :
299- read_int32 (len ,jqBase ,jqPos );
300299key = (GINKey * )palloc (GINKeyLenString );
301300key -> type = jbvString ;
302- GINKeyDataString ( key ) = hash_any (( unsigned char * ) jqBase + jqPos ,
303- len );
301+ s = jsqGetString ( value , & len );
302+ GINKeyDataString ( key ) = hash_any (( unsigned char * ) s , len );
304303SET_VARSIZE (key ,GINKeyLenString );
305304break ;
306305case jqiBool :
307- read_byte (len ,jqBase ,jqPos );
308306key = (GINKey * )palloc (GINKEYLEN );
309- key -> type = jbvBool | (len ?GINKeyTrue :0 );
307+ key -> type = jbvBool | (jsqGetBool ( value ) ?GINKeyTrue :0 );
310308SET_VARSIZE (key ,GINKEYLEN );
311309break ;
312310case jqiNumeric :
313- numeric = ( Numeric )( jqBase + jqPos );
311+ numeric = jsqGetNumeric ( value );
314312key = (GINKey * )palloc (GINKeyLenNumeric (VARSIZE_ANY (numeric )));
315313key -> type = jbvNumeric ;
316314memcpy (GINKeyDataNumeric (key ),numeric ,VARSIZE_ANY (numeric ));
@@ -319,6 +317,7 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
319317default :
320318elog (ERROR ,"Wrong state" );
321319}
320+
322321key -> hash = hash ;
323322return key ;
324323}
@@ -852,10 +851,11 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
852851{
853852if (node -> bounds .exact -> type == jqiAny )
854853{
855- JsQueryValue value ;
856- value .jqBase = NULL ;
857- value .jqPos = 0 ;
854+ JsQueryItemR value ;
855+
858856value .type = jqiNull ;
857+ value .nextPos = 0 ;
858+ value .base = NULL ;
859859key = make_gin_query_key (& value ,hash );
860860partialMatch = true;
861861keyExtra -> lossy = true;