diff --git a/src/backend/utils/adt/jsonb_gin.c b/src/backend/utils/adt/jsonb_gin.c
index 204fb8b..9172268 100644
*** a/src/backend/utils/adt/jsonb_gin.c
--- b/src/backend/utils/adt/jsonb_gin.c
*************** gin_extract_jsonb_path(PG_FUNCTION_ARGS)
*** 375,406 ****
  				parent = stack;
  				stack = (PathHashStack *) palloc(sizeof(PathHashStack));
  
! 				if (parent->parent)
! 				{
! 					/*
! 					 * We pass forward hashes from previous container nesting
! 					 * levels so that nested arrays with an outermost nested
! 					 * object will have element hashes mixed with the
! 					 * outermost key.  It's also somewhat useful to have
! 					 * nested objects' innermost values have hashes that are a
! 					 * function of not just their own key, but outer keys too.
! 					 *
! 					 * Nesting an array within another array will not alter
! 					 * innermost scalar element hash values, but that seems
! 					 * inconsequential.
! 					 */
! 					stack->hash = parent->hash;
! 				}
! 				else
! 				{
! 					/*
! 					 * At the outermost level, initialize hash with container
! 					 * type proxy value.  Note that this makes JB_FARRAY and
! 					 * JB_FOBJECT part of the on-disk representation, but they
! 					 * are that in the base jsonb object storage already.
! 					 */
! 					stack->hash = (r == WJB_BEGIN_ARRAY) ? JB_FARRAY : JB_FOBJECT;
! 				}
  				stack->parent = parent;
  				break;
  			case WJB_KEY:
--- 375,390 ----
  				parent = stack;
  				stack = (PathHashStack *) palloc(sizeof(PathHashStack));
  
! 				/*
! 				 * We pass forward hashes from outer nesting levels so that
! 				 * the hashes for nested values will include outer keys as
! 				 * well as their own keys.
! 				 *
! 				 * Nesting an array within another array will not alter
! 				 * innermost scalar element hash values, but that seems
! 				 * inconsequential.
! 				 */
! 				stack->hash = parent->hash;
  				stack->parent = parent;
  				break;
  			case WJB_KEY:
*************** gin_extract_jsonb_path(PG_FUNCTION_ARGS)
*** 419,425 ****
  				JsonbHashScalarValue(&v, &stack->hash);
  				/* and emit an index entry */
  				entries[i++] = UInt32GetDatum(stack->hash);
! 				/* Note: we assume we'll see KEY before another VALUE */
  				break;
  			case WJB_END_ARRAY:
  			case WJB_END_OBJECT:
--- 403,410 ----
  				JsonbHashScalarValue(&v, &stack->hash);
  				/* and emit an index entry */
  				entries[i++] = UInt32GetDatum(stack->hash);
! 				/* reset hash for next sub-object */
! 				stack->hash = stack->parent->hash;
  				break;
  			case WJB_END_ARRAY:
  			case WJB_END_OBJECT:
