Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1ef3ad2

Browse files
author
Alexander Korotkov
committed
Fix jqiIndexArray handling in GIN.
1 parentbd4989b commit1ef3ad2

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

‎jsonb_gin_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ get_query_path_hash(PathItem *pathItem, uint32 *hash)
947947
*hash= (*hash <<1) | (*hash >>31);
948948
*hash ^=hash_any((unsignedchar*)pathItem->s,pathItem->len);
949949
}
950-
elseif (pathItem->type==iAnyArray)
950+
elseif (pathItem->type==iAnyArray||pathItem->type==iIndexArray)
951951
{
952952
*hash= (*hash <<1) | (*hash >>31);
953953
*hash ^=JB_FARRAY;

‎jsquery.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,16 @@ typedef enum
170170
iAny=jqiAny,
171171
iAnyArray=jqiAnyArray,
172172
iKey=jqiKey,
173-
iAnyKey=jqiAnyKey
173+
iAnyKey=jqiAnyKey,
174+
iIndexArray=jqiIndexArray
174175
}PathItemType;
175176

176177
typedefstructPathItemPathItem;
177178
structPathItem
178179
{
179180
PathItemTypetype;
180181
intlen;
182+
intarrayIndex;
181183
char*s;
182184
PathItem*parent;
183185
};

‎jsquery_extract.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ recursiveExtract(JsQueryItem *jsq, bool not, bool indirect, PathItem *path)
106106
jsqGetNext(jsq,&elem);
107107
returnrecursiveExtract(&elem,not, true,pathItem);
108108
casejqiIndexArray:
109+
pathItem= (PathItem*)palloc(sizeof(PathItem));
110+
pathItem->type=iIndexArray;
111+
pathItem->arrayIndex=jsq->arrayIndex;
112+
pathItem->parent=path;
113+
jsqGetNext(jsq,&elem);
114+
returnrecursiveExtract(&elem,not, true,pathItem);
109115
casejqiAnyArray:
110116
casejqiAllArray:
111117
if ((not&&jsq->type==jqiAnyArray)|| (!not&&jsq->type==jqiAllArray))
@@ -864,6 +870,9 @@ debugPath(StringInfo buf, PathItem *path)
864870
casejqiAnyArray:
865871
appendStringInfoChar(buf,'#');
866872
break;
873+
casejqiIndexArray:
874+
appendStringInfo(buf,"#%d",path->arrayIndex);
875+
break;
867876
casejqiKey:
868877
appendBinaryStringInfo(buf,path->s,path->len);
869878
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp