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

Commitbf8884a

Browse files
committed
teach gin extract to ignore length of array
1 parent94fe153 commitbf8884a

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

‎expected/jsquery.out

Lines 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

Lines 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
casejqiAnd:
5556
casejqiOr:
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
returnresult;
244+
casejqiLength:
245+
returnNULL;
243246
default:
244247
elog(ERROR,"Wrong state: %d",jsq->type);
245248
}
249+
246250
returnNULL;
247251
}
248252

‎sql/jsquery.sql

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp