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 bf8884a

Browse filesBrowse files
committed
teach gin extract to ignore length of array
1 parent 94fe153 commit bf8884a
Copy full SHA for bf8884a

File tree

3 files changed

+21
-1
lines changed
Filter options

3 files changed

+21
-1
lines changed

‎expected/jsquery.out

Copy file name to clipboardExpand all lines: expected/jsquery.out
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,20 @@ SELECT gin_debug_query_value_path('NOT #:(NOT x=1) AND NOT %:(NOT y=1) AND NOT *
19741974

19751975
(1 row)
19761976

1977+
SELECT gin_debug_query_value_path('(@# > 0 and #: = 16)');
1978+
gin_debug_query_value_path
1979+
----------------------------
1980+
NULL +
1981+
1982+
(1 row)
1983+
1984+
SELECT gin_debug_query_value_path('*.@# ($ = 4 or $ = 2)');
1985+
gin_debug_query_value_path
1986+
----------------------------
1987+
NULL +
1988+
1989+
(1 row)
1990+
19771991
---table and index
19781992
select count(*) from test_jsquery where (v->>'review_helpful_votes')::int4 > 0;
19791993
count

‎jsquery_extract.c

Copy file name to clipboardExpand all lines: jsquery_extract.c
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ recursiveExtract(JsQueryItem *jsq, bool not, bool indirect, PathItem *path)
5050

5151
check_stack_depth();
5252

53-
switch(jsq->type) {
53+
switch(jsq->type)
54+
{
5455
case jqiAnd:
5556
case jqiOr:
5657
type = ((jsq->type == jqiAnd) == not) ? eOr : eAnd;
@@ -240,9 +241,12 @@ recursiveExtract(JsQueryItem *jsq, bool not, bool indirect, PathItem *path)
240241
result->indirect = indirect;
241242
result->isType = jsqGetIsType(jsq);
242243
return result;
244+
case jqiLength:
245+
return NULL;
243246
default:
244247
elog(ERROR,"Wrong state: %d", jsq->type);
245248
}
249+
246250
return NULL;
247251
}
248252

‎sql/jsquery.sql

Copy file name to clipboardExpand all lines: sql/jsquery.sql
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ SELECT gin_debug_query_value_path('x is object');
371371
SELECT gin_debug_query_value_path('#:(x=1) AND %:(y=1) AND *:(z=1)');
372372
SELECT gin_debug_query_value_path('#:(NOT x=1) AND %:(NOT y=1) AND *:(NOT z=1)');
373373
SELECT gin_debug_query_value_path('NOT #:(NOT x=1) AND NOT %:(NOT y=1) AND NOT *:(NOT z=1)');
374+
SELECT gin_debug_query_value_path('(@# > 0 and #: = 16)');
375+
SELECT gin_debug_query_value_path('*.@# ($ = 4 or $ = 2)');
374376

375377
---table and index
376378

0 commit comments

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