@@ -245,6 +245,18 @@ make_gin_key(JsonbValue *v, uint32 hash)
245245key -> type = v -> type | (v -> val .boolean ?GINKeyTrue :0 );
246246SET_VARSIZE (key ,GINKEYLEN );
247247}
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+ }
248260else if (v -> type == jbvNumeric )
249261{
250262key = (GINKey * )palloc (GINKeyLenNumeric (VARSIZE_ANY (v -> val .numeric )));
@@ -387,6 +399,10 @@ compare_gin_key_value(GINKey *arg1, GINKey *arg2)
387399{
388400case jbvNull :
389401return 0 ;
402+ case jbvArray :
403+ return 0 ;
404+ case jbvObject :
405+ return 0 ;
390406case jbvBool :
391407if (GINKeyIsTrue (arg1 )== GINKeyIsTrue (arg2 ))
392408return 0 ;
@@ -979,16 +995,20 @@ gin_extract_jsonb_hash_value_internal(Jsonb *jb, int32 *nentries)
979995switch (r )
980996{
981997case 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 ;
9821006case WJB_BEGIN_OBJECT :
1007+ entries [i ++ ]= PointerGetDatum (make_gin_key (& v ,stack -> hash ));
9831008tmp = stack ;
9841009stack = (PathHashStack * )palloc (sizeof (PathHashStack ));
9851010stack -> parent = tmp ;
9861011stack -> 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- }
9921012break ;
9931013case WJB_KEY :
9941014/* Initialize hash from parent */