@@ -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{
286286 GINKey * key ;
287- char * jqBase = value -> jqBase ;
288- int len , jqPos = value -> jqPos ;
287+ int32 len ;
288+ char * s ;
289289 Numeric numeric ;
290290
291291 switch (value -> type )
@@ -296,21 +296,19 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
296296 SET_VARSIZE (key , GINKEYLEN );
297297 break ;
298298 case jqiString :
299- read_int32 (len , jqBase , jqPos );
300299 key = (GINKey * )palloc (GINKeyLenString );
301300 key -> 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 );
304303 SET_VARSIZE (key , GINKeyLenString );
305304 break ;
306305 case jqiBool :
307- read_byte (len , jqBase , jqPos );
308306 key = (GINKey * )palloc (GINKEYLEN );
309- key -> type = jbvBool | (len ? GINKeyTrue : 0 );
307+ key -> type = jbvBool | (jsqGetBool ( value ) ? GINKeyTrue : 0 );
310308 SET_VARSIZE (key , GINKEYLEN );
311309 break ;
312310 case jqiNumeric :
313- numeric = ( Numeric )( jqBase + jqPos );
311+ numeric = jsqGetNumeric ( value );
314312 key = (GINKey * )palloc (GINKeyLenNumeric (VARSIZE_ANY (numeric )));
315313 key -> type = jbvNumeric ;
316314 memcpy (GINKeyDataNumeric (key ), numeric , VARSIZE_ANY (numeric ));
@@ -319,6 +317,7 @@ make_gin_query_key(JsQueryValue *value, uint32 hash)
319317 default :
320318 elog (ERROR ,"Wrong state" );
321319 }
320+
322321 key -> hash = hash ;
323322 return key ;
324323}
@@ -852,10 +851,11 @@ make_hash_entry_handler(ExtractedNode *node, Pointer extra)
852851 {
853852 if (node -> bounds .exact -> type == jqiAny )
854853 {
855- JsQueryValue value ;
856- value .jqBase = NULL ;
857- value .jqPos = 0 ;
854+ JsQueryItemR value ;
855+
858856 value .type = jqiNull ;
857+ value .nextPos = 0 ;
858+ value .base = NULL ;
859859 key = make_gin_query_key (& value , hash );
860860 partialMatch = true;
861861 keyExtra -> lossy = true;
0 commit comments