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 f26ac6d

Browse filesBrowse files
committed
Merge with jsquery 0.36.
1 parent 73b7912 commit f26ac6d
Copy full SHA for f26ac6d

12 files changed

+166
-87
lines changed

‎expected/jsquery.out

Copy file name to clipboardExpand all lines: expected/jsquery.out
+31-1Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ select 'a in (0,1,2)'::jsquery;
354354
"a" IN (0, 1, 2)
355355
(1 row)
356356

357-
select 'a in (0,null, "null", xxx, "zzz", 2)'::jsquery;
357+
select 'a IN (0,null, "null", xxx, "zzz", 2)'::jsquery;
358358
jsquery
359359
-------------------------------------------
360360
"a" IN (0, null, "null", "xxx", "zzz", 2)
@@ -786,3 +786,33 @@ select '[1,2,3]'::jsonb @@ '#($ = 2)';
786786
t
787787
(1 row)
788788

789+
select '{"a": {"b": 3, "c": "hey"}, "x": [5,6]}'::jsonb @@ '%.b=3';
790+
?column?
791+
----------
792+
t
793+
(1 row)
794+
795+
select '{"a": {"b": 3, "c": "hey"}, "x": [5,6]}'::jsonb @@ 'a.%=3';
796+
?column?
797+
----------
798+
t
799+
(1 row)
800+
801+
select '{"a": {"b": 3, "c": "hey"}, "x": [5,6]}'::jsonb @@ '%.%="hey"';
802+
?column?
803+
----------
804+
t
805+
(1 row)
806+
807+
select '{"a": {"b": 3, "c": "hey"}, "x": [5,6]}'::jsonb @@ '%="hey"';
808+
?column?
809+
----------
810+
f
811+
(1 row)
812+
813+
select '{"a": {"b": 3, "c": "hey"}, "x": [5,6]}'::jsonb @@ '%=[5,6]';
814+
?column?
815+
----------
816+
t
817+
(1 row)
818+

‎jsonb_gin_ops.c

Copy file name to clipboardExpand all lines: jsonb_gin_ops.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ get_query_path_bloom(PathItem *pathItem, bool *lossy)
179179
val = get_bloom_value(hash);
180180
res |= val;
181181
}
182-
else if (pathItem->type == iAny)
182+
else if (pathItem->type == iAny || pathItem->type == iAnyKey)
183183
{
184184
*lossy = true;
185185
}
@@ -783,7 +783,7 @@ get_query_path_hash(PathItem *pathItem, uint32 *hash)
783783
}
784784
else
785785
{
786-
if (pathItem->type == iAny)
786+
if (pathItem->type == iAny || pathItem->type == iAnyKey)
787787
{
788788
return false;
789789
}

‎jsquery.h

Copy file name to clipboardExpand all lines: jsquery.h
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ struct JsQueryItem {
4949
jqiGreaterOrEqual = '}',
5050
jqiContains = '@',
5151
jqiContained = '^',
52-
jqiOverlap = '%',
52+
jqiOverlap = 'O',
5353
jqiAny = '*',
5454
jqiAnyArray = '#',
55+
jqiAnyKey = '%',
5556
jqiKey = 'K',
5657
jqiCurrent = '$',
5758
jqiIn = 'I'
@@ -108,7 +109,8 @@ typedef enum
108109
{
109110
iAny = 1,
110111
iAnyArray,
111-
iKey
112+
iKey,
113+
iAnyKey
112114
} PathItemType;
113115

114116
typedef struct PathItem PathItem;

‎jsquery_constr.c

Copy file name to clipboardExpand all lines: jsquery_constr.c
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ copyJsQuery(StringInfo buf, char *jqBase, int32 jqPos)
118118
case jqiAny:
119119
case jqiCurrent:
120120
case jqiAnyArray:
121+
case jqiAnyKey:
121122
break;
122123
default:
123124
elog(ERROR, "Unknown JsQueryItem type: %d", type);

‎jsquery_extract.c

Copy file name to clipboardExpand all lines: jsquery_extract.c
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ recursiveExtract(char *jqBase, int32 jqPos, bool indirect, PathItem *path)
109109
pathItem->type = iAnyArray;
110110
pathItem->parent = path;
111111
return recursiveExtract(jqBase, nextPos, true, pathItem);
112+
case jqiAnyKey:
113+
Assert(nextPos != 0);
114+
pathItem = (PathItem *)palloc(sizeof(PathItem));
115+
pathItem->type = iAnyKey;
116+
pathItem->parent = path;
117+
return recursiveExtract(jqBase, nextPos, true, pathItem);
112118
case jqiCurrent:
113119
return recursiveExtract(jqBase, nextPos, indirect, path);
114120
case jqiEqual:

0 commit comments

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