@@ -244,6 +244,18 @@ make_gin_key(JsonbValue *v, uint32 hash)
244
244
key -> type = v -> type | (v -> val .boolean ? GINKeyTrue : 0 );
245
245
SET_VARSIZE (key , GINKEYLEN );
246
246
}
247
+ else if (v -> type == jbvArray )
248
+ {
249
+ key = (GINKey * )palloc (GINKEYLEN );
250
+ key -> type = v -> type ;
251
+ SET_VARSIZE (key , GINKEYLEN );
252
+ }
253
+ else if (v -> type == jbvObject )
254
+ {
255
+ key = (GINKey * )palloc (GINKEYLEN );
256
+ key -> type = v -> type ;
257
+ SET_VARSIZE (key , GINKEYLEN );
258
+ }
247
259
else if (v -> type == jbvNumeric )
248
260
{
249
261
key = (GINKey * )palloc (GINKeyLenNumeric (VARSIZE_ANY (v -> val .numeric )));
@@ -386,6 +398,10 @@ compare_gin_key_value(GINKey *arg1, GINKey *arg2)
386
398
{
387
399
case jbvNull :
388
400
return 0 ;
401
+ case jbvArray :
402
+ return 0 ;
403
+ case jbvObject :
404
+ return 0 ;
389
405
case jbvBool :
390
406
if (GINKeyIsTrue (arg1 ) == GINKeyIsTrue (arg2 ))
391
407
return 0 ;
@@ -978,16 +994,20 @@ gin_extract_jsonb_hash_value_internal(Jsonb *jb, int32 *nentries)
978
994
switch (r )
979
995
{
980
996
case WJB_BEGIN_ARRAY :
997
+ entries [i ++ ] = PointerGetDatum (make_gin_key (& v , stack -> hash ));
998
+ tmp = stack ;
999
+ stack = (PathHashStack * ) palloc (sizeof (PathHashStack ));
1000
+ stack -> parent = tmp ;
1001
+ stack -> hash = stack -> parent -> hash ;
1002
+ stack -> hash = (stack -> hash << 1 ) | (stack -> hash >> 31 );
1003
+ stack -> hash ^= JB_FARRAY ;
1004
+ break ;
981
1005
case WJB_BEGIN_OBJECT :
1006
+ entries [i ++ ] = PointerGetDatum (make_gin_key (& v , stack -> hash ));
982
1007
tmp = stack ;
983
1008
stack = (PathHashStack * ) palloc (sizeof (PathHashStack ));
984
1009
stack -> parent = tmp ;
985
1010
stack -> hash = stack -> parent -> hash ;
986
- if (r == WJB_BEGIN_ARRAY )
987
- {
988
- stack -> hash = (stack -> hash << 1 ) | (stack -> hash >> 31 );
989
- stack -> hash ^= JB_FARRAY ;
990
- }
991
1011
break ;
992
1012
case WJB_KEY :
993
1013
/* Initialize hash from parent */
0 commit comments