Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1cfc4b1

Browse filesBrowse files
committed
Fix = * for jsonb_hash_value_ops.
1 parent aa36e6f commit 1cfc4b1
Copy full SHA for 1cfc4b1

File tree

1 file changed

+25
-5
lines changed
Filter options

1 file changed

+25
-5
lines changed

‎jsonb_gin_ops.c

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.