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