1 select jsonb '{"a": 12}' @? '$';
7 select jsonb '{"a": 12}' @? '1';
13 select jsonb '{"a": 12}' @? '$.a.b';
19 select jsonb '{"a": 12}' @? '$.b';
25 select jsonb '{"a": 12}' @? '$.a + 2';
31 select jsonb '{"a": 12}' @? '$.b + 2';
37 select jsonb '{"a": {"a": 12}}' @? '$.a.a';
43 select jsonb '{"a": {"a": 12}}' @? '$.*.a';
49 select jsonb '{"b": {"a": 12}}' @? '$.*.a';
55 select jsonb '{"b": {"a": 12}}' @? '$.*.b';
61 select jsonb '{"b": {"a": 12}}' @? 'strict $.*.b';
67 select jsonb '{}' @? '$.*';
73 select jsonb '{"a": 1}' @? '$.*';
79 select jsonb '{"a": {"b": 1}}' @? 'lax $.**{1}';
85 select jsonb '{"a": {"b": 1}}' @? 'lax $.**{2}';
91 select jsonb '{"a": {"b": 1}}' @? 'lax $.**{3}';
97 select jsonb '[]' @? '$[*]';
103 select jsonb '[1]' @? '$[*]';
109 select jsonb '[1]' @? '$[1]';
115 select jsonb '[1]' @? 'strict $[1]';
121 select jsonb_path_query('[1]', 'strict $[1]');
122 ERROR: jsonpath array subscript is out of bounds
123 select jsonb_path_query('[1]', 'strict $[1]', silent => true);
128 select jsonb '[1]' @? 'lax $[10000000000000000]';
134 select jsonb '[1]' @? 'strict $[10000000000000000]';
140 select jsonb_path_query('[1]', 'lax $[10000000000000000]');
141 ERROR: jsonpath array subscript is out of integer range
142 select jsonb_path_query('[1]', 'strict $[10000000000000000]');
143 ERROR: jsonpath array subscript is out of integer range
144 select jsonb '[1]' @? '$[0]';
150 select jsonb '[1]' @? '$[0.3]';
156 select jsonb '[1]' @? '$[0.5]';
162 select jsonb '[1]' @? '$[0.9]';
168 select jsonb '[1]' @? '$[1.2]';
174 select jsonb '[1]' @? 'strict $[1.2]';
180 select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] > @.b[*])';
186 select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$ ? (@.a[*] >= @.b[*])';
192 select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? '$ ? (@.a[*] >= @.b[*])';
198 select jsonb '{"a": [1,2,3], "b": [3,4,"5"]}' @? 'strict $ ? (@.a[*] >= @.b[*])';
204 select jsonb '{"a": [1,2,3], "b": [3,4,null]}' @? '$ ? (@.a[*] >= @.b[*])';
210 select jsonb '1' @? '$ ? ((@ == "1") is unknown)';
216 select jsonb '1' @? '$ ? ((@ == 1) is unknown)';
222 select jsonb '[{"a": 1}, {"a": 2}]' @? '$[0 to 1] ? (@.a > 1)';
228 select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => false);
234 select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'lax $[*].a', silent => true);
240 select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => false);
241 ERROR: jsonpath member accessor can only be applied to an object
242 select jsonb_path_exists('[{"a": 1}, {"a": 2}, 3]', 'strict $[*].a', silent => true);
248 select jsonb_path_query('1', 'lax $.a');
253 select jsonb_path_query('1', 'strict $.a');
254 ERROR: jsonpath member accessor can only be applied to an object
255 select jsonb_path_query('1', 'strict $.*');
256 ERROR: jsonpath wildcard member accessor can only be applied to an object
257 select jsonb_path_query('1', 'strict $.a', silent => true);
262 select jsonb_path_query('1', 'strict $.*', silent => true);
267 select jsonb_path_query('[]', 'lax $.a');
272 select jsonb_path_query('[]', 'strict $.a');
273 ERROR: jsonpath member accessor can only be applied to an object
274 select jsonb_path_query('[]', 'strict $.a', silent => true);
279 select jsonb_path_query('{}', 'lax $.a');
284 select jsonb_path_query('{}', 'strict $.a');
285 ERROR: JSON object does not contain key "a"
286 select jsonb_path_query('{}', 'strict $.a', silent => true);
291 select jsonb_path_query('1', 'strict $[1]');
292 ERROR: jsonpath array accessor can only be applied to an array
293 select jsonb_path_query('1', 'strict $[*]');
294 ERROR: jsonpath wildcard array accessor can only be applied to an array
295 select jsonb_path_query('[]', 'strict $[1]');
296 ERROR: jsonpath array subscript is out of bounds
297 select jsonb_path_query('[]', 'strict $["a"]');
298 ERROR: jsonpath array subscript is not a single numeric value
299 select jsonb_path_query('1', 'strict $[1]', silent => true);
304 select jsonb_path_query('1', 'strict $[*]', silent => true);
309 select jsonb_path_query('[]', 'strict $[1]', silent => true);
314 select jsonb_path_query('[]', 'strict $["a"]', silent => true);
319 select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.a');
325 select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.b');
331 select jsonb_path_query('{"a": 12, "b": {"a": 13}}', '$.*');
338 select jsonb_path_query('{"a": 12, "b": {"a": 13}}', 'lax $.*.a');
344 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].a');
350 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[*].*');
357 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0].a');
362 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[1].a');
368 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[2].a');
373 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0,1].a');
379 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10].a');
385 select jsonb_path_query('[12, {"a": 13}, {"b": 14}]', 'lax $[0 to 10 / 0].a');
386 ERROR: division by zero
387 select jsonb_path_query('[12, {"a": 13}, {"b": 14}, "ccc", true]', '$[2.5 - 1 to $.size() - 2]');
395 select jsonb_path_query('1', 'lax $[0]');
401 select jsonb_path_query('1', 'lax $[*]');
407 select jsonb_path_query('[1]', 'lax $[0]');
413 select jsonb_path_query('[1]', 'lax $[*]');
419 select jsonb_path_query('[1,2,3]', 'lax $[*]');
427 select jsonb_path_query('[1,2,3]', 'strict $[*].a');
428 ERROR: jsonpath member accessor can only be applied to an object
429 select jsonb_path_query('[1,2,3]', 'strict $[*].a', silent => true);
434 select jsonb_path_query('[]', '$[last]');
439 select jsonb_path_query('[]', '$[last ? (exists(last))]');
444 select jsonb_path_query('[]', 'strict $[last]');
445 ERROR: jsonpath array subscript is out of bounds
446 select jsonb_path_query('[]', 'strict $[last]', silent => true);
451 select jsonb_path_query('[1]', '$[last]');
457 select jsonb_path_query('[1,2,3]', '$[last]');
463 select jsonb_path_query('[1,2,3]', '$[last - 1]');
469 select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "number")]');
475 select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]');
476 ERROR: jsonpath array subscript is not a single numeric value
477 select jsonb_path_query('[1,2,3]', '$[last ? (@.type() == "string")]', silent => true);
482 select * from jsonb_path_query('{"a": 10}', '$');
488 select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)');
489 ERROR: could not find jsonpath variable "value"
490 select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '1');
491 ERROR: "vars" argument is not an object
492 DETAIL: Jsonpath parameters should be encoded as key-value pairs of "vars" object.
493 select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '[{"value" : 13}]');
494 ERROR: "vars" argument is not an object
495 DETAIL: Jsonpath parameters should be encoded as key-value pairs of "vars" object.
496 select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 13}');
502 select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)', '{"value" : 8}');
507 select * from jsonb_path_query('{"a": 10}', '$.a ? (@ < $value)', '{"value" : 13}');
513 select * from jsonb_path_query('[10,11,12,13,14,15]', '$[*] ? (@ < $value)', '{"value" : 13}');
521 select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0,1] ? (@ < $x.value)', '{"x": {"value" : 13}}');
528 select * from jsonb_path_query('[10,11,12,13,14,15]', '$[0 to 2] ? (@ < $value)', '{"value" : 15}');
536 select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == "1")');
542 select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : "1"}');
548 select * from jsonb_path_query('[1,"1",2,"2",null]', '$[*] ? (@ == $value)', '{"value" : null}');
554 select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ != null)');
561 select * from jsonb_path_query('[1, "2", null]', '$[*] ? (@ == null)');
567 select * from jsonb_path_query('{}', '$ ? (@ == @)');
572 select * from jsonb_path_query('[]', 'strict $ ? (@ == @)');
577 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**');
585 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}');
591 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}');
599 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}');
605 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}');
612 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2}');
618 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{2 to last}');
624 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{3 to last}');
629 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{last}');
635 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**.b ? (@ > 0)');
641 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0}.b ? (@ > 0)');
646 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1}.b ? (@ > 0)');
652 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{0 to last}.b ? (@ > 0)');
658 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to last}.b ? (@ > 0)');
664 select jsonb_path_query('{"a": {"b": 1}}', 'lax $.**{1 to 2}.b ? (@ > 0)');
670 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**.b ? (@ > 0)');
676 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0}.b ? (@ > 0)');
681 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1}.b ? (@ > 0)');
686 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{0 to last}.b ? (@ > 0)');
692 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to last}.b ? (@ > 0)');
698 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{1 to 2}.b ? (@ > 0)');
704 select jsonb_path_query('{"a": {"c": {"b": 1}}}', 'lax $.**{2 to 3}.b ? (@ > 0)');
710 select jsonb '{"a": {"b": 1}}' @? '$.**.b ? ( @ > 0)';
716 select jsonb '{"a": {"b": 1}}' @? '$.**{0}.b ? ( @ > 0)';
722 select jsonb '{"a": {"b": 1}}' @? '$.**{1}.b ? ( @ > 0)';
728 select jsonb '{"a": {"b": 1}}' @? '$.**{0 to last}.b ? ( @ > 0)';
734 select jsonb '{"a": {"b": 1}}' @? '$.**{1 to last}.b ? ( @ > 0)';
740 select jsonb '{"a": {"b": 1}}' @? '$.**{1 to 2}.b ? ( @ > 0)';
746 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**.b ? ( @ > 0)';
752 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0}.b ? ( @ > 0)';
758 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1}.b ? ( @ > 0)';
764 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{0 to last}.b ? ( @ > 0)';
770 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to last}.b ? ( @ > 0)';
776 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{1 to 2}.b ? ( @ > 0)';
782 select jsonb '{"a": {"c": {"b": 1}}}' @? '$.**{2 to 3}.b ? ( @ > 0)';
788 select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x))');
794 select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.y))');
799 select jsonb_path_query('{"g": {"x": 2}}', '$.g ? (exists (@.x ? (@ >= 2) ))');
805 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x))');
811 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? (exists (@.x + "3"))');
816 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'lax $.g ? ((exists (@.x + "3")) is unknown)');
823 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? (exists (@.x))');
829 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g[*] ? ((exists (@.x)) is unknown)');
835 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? (exists (@[*].x))');
840 select jsonb_path_query('{"g": [{"x": 2}, {"y": 3}]}', 'strict $.g ? ((exists (@[*].x)) is unknown)');
842 ----------------------
850 '[true, false, null]',
851 '$[*] ? (@ == true && ($x == true && $y == true) ||
852 @ == false && !($x == true && $y == true) ||
853 @ == null && ($x == true && $y == true) is unknown)',
854 jsonb_build_object('x', x, 'y', y)
857 (values (jsonb 'true'), ('false'), ('"null"')) x(x),
858 (values (jsonb 'true'), ('false'), ('"null"')) y(y);
860 --------+--------+--------
865 false | false | false
866 false | "null" | false
868 "null" | false | false
869 "null" | "null" | null
875 '[true, false, null]',
876 '$[*] ? (@ == true && ($x == true || $y == true) ||
877 @ == false && !($x == true || $y == true) ||
878 @ == null && ($x == true || $y == true) is unknown)',
879 jsonb_build_object('x', x, 'y', y)
882 (values (jsonb 'true'), ('false'), ('"null"')) x(x),
883 (values (jsonb 'true'), ('false'), ('"null"')) y(y);
885 --------+--------+--------
890 false | false | false
891 false | "null" | null
893 "null" | false | null
894 "null" | "null" | null
897 select jsonb '{"a": 1, "b":1}' @? '$ ? (@.a == @.b)';
903 select jsonb '{"c": {"a": 1, "b":1}}' @? '$ ? (@.a == @.b)';
909 select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? (@.a == @.b)';
915 select jsonb '{"c": {"a": 1, "b":1}}' @? '$.c ? ($.c.a == @.b)';
921 select jsonb '{"c": {"a": 1, "b":1}}' @? '$.* ? (@.a == @.b)';
927 select jsonb '{"a": 1, "b":1}' @? '$.** ? (@.a == @.b)';
933 select jsonb '{"c": {"a": 1, "b":1}}' @? '$.** ? (@.a == @.b)';
939 select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == 1 + 1)');
945 select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (1 + 1))');
951 select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == @.b + 1)');
957 select jsonb_path_query('{"c": {"a": 2, "b":1}}', '$.** ? (@.a == (@.b + 1))');
963 select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - 1)';
969 select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -1)';
975 select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == -@.b)';
981 select jsonb '{"c": {"a": -1, "b":1}}' @? '$.** ? (@.a == - @.b)';
987 select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - @.b)';
993 select jsonb '{"c": {"a": 2, "b":1}}' @? '$.** ? (@.a == 1 - - @.b)';
999 select jsonb '{"c": {"a": 0, "b":1}}' @? '$.** ? (@.a == 1 - +@.b)';
1005 select jsonb '[1,2,3]' @? '$ ? (+@[*] > +2)';
1011 select jsonb '[1,2,3]' @? '$ ? (+@[*] > +3)';
1017 select jsonb '[1,2,3]' @? '$ ? (-@[*] < -2)';
1023 select jsonb '[1,2,3]' @? '$ ? (-@[*] < -3)';
1029 select jsonb '1' @? '$ ? ($ > 0)';
1035 -- arithmetic errors
1036 select jsonb_path_query('[1,2,0,3]', '$[*] ? (2 / @ > 0)');
1044 select jsonb_path_query('[1,2,0,3]', '$[*] ? ((2 / @ > 0) is unknown)');
1050 select jsonb_path_query('0', '1 / $');
1051 ERROR: division by zero
1052 select jsonb_path_query('0', '1 / $ + 2');
1053 ERROR: division by zero
1054 select jsonb_path_query('0', '-(3 + 1 % $)');
1055 ERROR: division by zero
1056 select jsonb_path_query('1', '$ + "2"');
1057 ERROR: right operand of jsonpath operator + is not a single numeric value
1058 select jsonb_path_query('[1, 2]', '3 * $');
1059 ERROR: right operand of jsonpath operator * is not a single numeric value
1060 select jsonb_path_query('"a"', '-$');
1061 ERROR: operand of unary jsonpath operator - is not a numeric value
1062 select jsonb_path_query('[1,"2",3]', '+$');
1063 ERROR: operand of unary jsonpath operator + is not a numeric value
1064 select jsonb_path_query('1', '$ + "2"', silent => true);
1069 select jsonb_path_query('[1, 2]', '3 * $', silent => true);
1074 select jsonb_path_query('"a"', '-$', silent => true);
1079 select jsonb_path_query('[1,"2",3]', '+$', silent => true);
1085 select jsonb '["1",2,0,3]' @? '-$[*]';
1091 select jsonb '[1,"2",0,3]' @? '-$[*]';
1097 select jsonb '["1",2,0,3]' @? 'strict -$[*]';
1103 select jsonb '[1,"2",0,3]' @? 'strict -$[*]';
1109 -- unwrapping of operator arguments in lax mode
1110 select jsonb_path_query('{"a": [2]}', 'lax $.a * 3');
1116 select jsonb_path_query('{"a": [2]}', 'lax $.a + 3');
1122 select jsonb_path_query('{"a": [2, 3, 4]}', 'lax -$.a');
1131 select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3');
1132 ERROR: left operand of jsonpath operator * is not a single numeric value
1133 select jsonb_path_query('{"a": [1, 2]}', 'lax $.a * 3', silent => true);
1138 -- extension: boolean expressions
1139 select jsonb_path_query('2', '$ > 1');
1145 select jsonb_path_query('2', '$ <= 1');
1151 select jsonb_path_query('2', '$ == "2"');
1157 select jsonb '2' @? '$ == "2"';
1163 select jsonb '2' @@ '$ > 1';
1169 select jsonb '2' @@ '$ <= 1';
1175 select jsonb '2' @@ '$ == "2"';
1181 select jsonb '2' @@ '1';
1187 select jsonb '{}' @@ '$';
1193 select jsonb '[]' @@ '$';
1199 select jsonb '[1,2,3]' @@ '$[*]';
1205 select jsonb '[]' @@ '$[*]';
1211 select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
1217 select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
1223 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => false);
1229 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => true);
1235 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => false);
1241 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => true);
1247 select jsonb_path_query('[null,1,true,"a",[],{}]', '$.type()');
1253 select jsonb_path_query('[null,1,true,"a",[],{}]', 'lax $.type()');
1259 select jsonb_path_query('[null,1,true,"a",[],{}]', '$[*].type()');
1270 select jsonb_path_query('null', 'null.type()');
1276 select jsonb_path_query('null', 'true.type()');
1282 select jsonb_path_query('null', '(123).type()');
1288 select jsonb_path_query('null', '"123".type()');
1294 select jsonb_path_query('{"a": 2}', '($.a - 5).abs() + 10');
1300 select jsonb_path_query('{"a": 2.5}', '-($.a * $.a).floor() % 4.3');
1306 select jsonb_path_query('[1, 2, 3]', '($[*] > 2) ? (@ == true)');
1312 select jsonb_path_query('[1, 2, 3]', '($[*] > 3).type()');
1318 select jsonb_path_query('[1, 2, 3]', '($[*].a > 3).type()');
1324 select jsonb_path_query('[1, 2, 3]', 'strict ($[*].a > 3).type()');
1330 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()');
1331 ERROR: jsonpath item method .size() can only be applied to an array
1332 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()', silent => true);
1337 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'lax $[*].size()');
1351 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].abs()');
1361 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].floor()');
1371 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling()');
1381 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs()');
1391 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs().type()');
1401 select jsonb_path_query('[{},1]', '$[*].keyvalue()');
1402 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1403 select jsonb_path_query('[{},1]', '$[*].keyvalue()', silent => true);
1408 select jsonb_path_query('{}', '$.keyvalue()');
1413 select jsonb_path_query('{"a": 1, "b": [1, 2], "c": {"a": "bbb"}}', '$.keyvalue()');
1415 ----------------------------------------------
1416 {"id": 0, "key": "a", "value": 1}
1417 {"id": 0, "key": "b", "value": [1, 2]}
1418 {"id": 0, "key": "c", "value": {"a": "bbb"}}
1421 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', '$[*].keyvalue()');
1423 -----------------------------------------------
1424 {"id": 12, "key": "a", "value": 1}
1425 {"id": 12, "key": "b", "value": [1, 2]}
1426 {"id": 72, "key": "c", "value": {"a": "bbb"}}
1429 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue()');
1430 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1431 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'lax $.keyvalue()');
1433 -----------------------------------------------
1434 {"id": 12, "key": "a", "value": 1}
1435 {"id": 12, "key": "b", "value": [1, 2]}
1436 {"id": 72, "key": "c", "value": {"a": "bbb"}}
1439 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue().a');
1440 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1441 select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue()';
1447 select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue().key';
1453 select jsonb_path_query('null', '$.double()');
1454 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1455 select jsonb_path_query('true', '$.double()');
1456 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1457 select jsonb_path_query('null', '$.double()', silent => true);
1462 select jsonb_path_query('true', '$.double()', silent => true);
1467 select jsonb_path_query('[]', '$.double()');
1472 select jsonb_path_query('[]', 'strict $.double()');
1473 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1474 select jsonb_path_query('{}', '$.double()');
1475 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1476 select jsonb_path_query('[]', 'strict $.double()', silent => true);
1481 select jsonb_path_query('{}', '$.double()', silent => true);
1486 select jsonb_path_query('1.23', '$.double()');
1492 select jsonb_path_query('"1.23"', '$.double()');
1498 select jsonb_path_query('"1.23aaa"', '$.double()');
1499 ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
1500 select jsonb_path_query('1e1000', '$.double()');
1501 ERROR: numeric argument of jsonpath item method .double() is out of range for type double precision
1502 select jsonb_path_query('"nan"', '$.double()');
1503 ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
1504 select jsonb_path_query('"NaN"', '$.double()');
1505 ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
1506 select jsonb_path_query('"inf"', '$.double()');
1507 ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
1508 select jsonb_path_query('"-inf"', '$.double()');
1509 ERROR: string argument of jsonpath item method .double() is not a valid representation of a double precision number
1510 select jsonb_path_query('"inf"', '$.double()', silent => true);
1515 select jsonb_path_query('"-inf"', '$.double()', silent => true);
1520 select jsonb_path_query('{}', '$.abs()');
1521 ERROR: jsonpath item method .abs() can only be applied to a numeric value
1522 select jsonb_path_query('true', '$.floor()');
1523 ERROR: jsonpath item method .floor() can only be applied to a numeric value
1524 select jsonb_path_query('"1.2"', '$.ceiling()');
1525 ERROR: jsonpath item method .ceiling() can only be applied to a numeric value
1526 select jsonb_path_query('{}', '$.abs()', silent => true);
1531 select jsonb_path_query('true', '$.floor()', silent => true);
1536 select jsonb_path_query('"1.2"', '$.ceiling()', silent => true);
1541 select jsonb_path_query('["", "a", "abc", "abcabc"]', '$[*] ? (@ starts with "abc")');
1548 select jsonb_path_query('["", "a", "abc", "abcabc"]', 'strict $ ? (@[*] starts with "abc")');
1550 ----------------------------
1551 ["", "a", "abc", "abcabc"]
1554 select jsonb_path_query('["", "a", "abd", "abdabc"]', 'strict $ ? (@[*] starts with "abc")');
1559 select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? (@[*] starts with "abc")');
1564 select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? ((@[*] starts with "abc") is unknown)');
1566 ----------------------------
1567 ["abc", "abcabc", null, 1]
1570 select jsonb_path_query('[[null, 1, "abc", "abcabc"]]', 'lax $ ? (@[*] starts with "abc")');
1572 ----------------------------
1573 [null, 1, "abc", "abcabc"]
1576 select jsonb_path_query('[[null, 1, "abd", "abdabc"]]', 'lax $ ? ((@[*] starts with "abc") is unknown)');
1578 ----------------------------
1579 [null, 1, "abd", "abdabc"]
1582 select jsonb_path_query('[null, 1, "abd", "abdabc"]', 'lax $[*] ? ((@ starts with "abc") is unknown)');
1589 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c")');
1596 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "i")');
1604 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "m")');
1612 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "s")');
1620 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "q")');
1627 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "")');
1633 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "q")');
1639 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "q")');
1644 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "iq")');
1650 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "")');
1656 select jsonb_path_query('null', '$.datetime()');
1657 ERROR: jsonpath item method .datetime() can only be applied to a string
1658 select jsonb_path_query('true', '$.datetime()');
1659 ERROR: jsonpath item method .datetime() can only be applied to a string
1660 select jsonb_path_query('1', '$.datetime()');
1661 ERROR: jsonpath item method .datetime() can only be applied to a string
1662 select jsonb_path_query('[]', '$.datetime()');
1667 select jsonb_path_query('[]', 'strict $.datetime()');
1668 ERROR: jsonpath item method .datetime() can only be applied to a string
1669 select jsonb_path_query('{}', '$.datetime()');
1670 ERROR: jsonpath item method .datetime() can only be applied to a string
1671 select jsonb_path_query('"bogus"', '$.datetime()');
1672 ERROR: datetime format is not recognized: "bogus"
1673 HINT: Use a datetime template argument to specify the input data format.
1674 select jsonb_path_query('"12:34"', '$.datetime("aaa")');
1675 ERROR: invalid datetime format separator: "a"
1676 select jsonb_path_query('"aaaa"', '$.datetime("HH24")');
1677 ERROR: invalid value "aa" for "HH24"
1678 DETAIL: Value must be an integer.
1679 select jsonb '"10-03-2017"' @? '$.datetime("dd-mm-yyyy")';
1685 select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy")');
1691 select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy").type()');
1697 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy")');
1698 ERROR: trailing characters remain in input string after datetime format
1699 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy").type()');
1700 ERROR: trailing characters remain in input string after datetime format
1701 select jsonb_path_query('"10-03-2017 12:34"', ' $.datetime("dd-mm-yyyy HH24:MI").type()');
1703 -------------------------------
1704 "timestamp without time zone"
1707 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM").type()');
1709 ----------------------------
1710 "timestamp with time zone"
1713 select jsonb_path_query('"12:34:56"', '$.datetime("HH24:MI:SS").type()');
1715 --------------------------
1716 "time without time zone"
1719 select jsonb_path_query('"12:34:56 +05:20"', '$.datetime("HH24:MI:SS TZH:TZM").type()');
1721 -----------------------
1722 "time with time zone"
1725 select jsonb_path_query('"10-03-2017T12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1727 -----------------------
1728 "2017-03-10T12:34:56"
1731 select jsonb_path_query('"10-03-2017t12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1732 ERROR: unmatched format character "T"
1733 select jsonb_path_query('"10-03-2017 12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1734 ERROR: unmatched format character "T"
1735 set time zone '+00';
1736 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")');
1738 -----------------------
1739 "2017-03-10T12:34:00"
1742 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1743 ERROR: input string is too short for datetime format
1744 select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1746 -----------------------------
1747 "2017-03-10T12:34:00+05:00"
1750 select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1752 -----------------------------
1753 "2017-03-10T12:34:00-05:00"
1756 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
1758 -----------------------------
1759 "2017-03-10T12:34:00+05:20"
1762 select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
1764 -----------------------------
1765 "2017-03-10T12:34:00-05:20"
1768 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")');
1774 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")');
1775 ERROR: input string is too short for datetime format
1776 select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")');
1782 select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")');
1788 select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")');
1794 select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")');
1800 set time zone '+10';
1801 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")');
1803 -----------------------
1804 "2017-03-10T12:34:00"
1807 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1808 ERROR: input string is too short for datetime format
1809 select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1811 -----------------------------
1812 "2017-03-10T12:34:00+05:00"
1815 select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
1817 -----------------------------
1818 "2017-03-10T12:34:00-05:00"
1821 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
1823 -----------------------------
1824 "2017-03-10T12:34:00+05:20"
1827 select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
1829 -----------------------------
1830 "2017-03-10T12:34:00-05:20"
1833 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")');
1839 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")');
1840 ERROR: input string is too short for datetime format
1841 select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")');
1847 select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")');
1853 select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")');
1859 select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")');
1865 set time zone default;
1866 select jsonb_path_query('"2017-03-10"', '$.datetime().type()');
1872 select jsonb_path_query('"2017-03-10"', '$.datetime()');
1878 select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime().type()');
1880 -------------------------------
1881 "timestamp without time zone"
1884 select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime()');
1886 -----------------------
1887 "2017-03-10T12:34:56"
1890 select jsonb_path_query('"2017-03-10 12:34:56+3"', '$.datetime().type()');
1892 ----------------------------
1893 "timestamp with time zone"
1896 select jsonb_path_query('"2017-03-10 12:34:56+3"', '$.datetime()');
1898 -----------------------------
1899 "2017-03-10T12:34:56+03:00"
1902 select jsonb_path_query('"2017-03-10 12:34:56+3:10"', '$.datetime().type()');
1904 ----------------------------
1905 "timestamp with time zone"
1908 select jsonb_path_query('"2017-03-10 12:34:56+3:10"', '$.datetime()');
1910 -----------------------------
1911 "2017-03-10T12:34:56+03:10"
1914 select jsonb_path_query('"2017-03-10T12:34:56+3:10"', '$.datetime()');
1916 -----------------------------
1917 "2017-03-10T12:34:56+03:10"
1920 select jsonb_path_query('"2017-03-10t12:34:56+3:10"', '$.datetime()');
1921 ERROR: datetime format is not recognized: "2017-03-10t12:34:56+3:10"
1922 HINT: Use a datetime template argument to specify the input data format.
1923 select jsonb_path_query('"12:34:56"', '$.datetime().type()');
1925 --------------------------
1926 "time without time zone"
1929 select jsonb_path_query('"12:34:56"', '$.datetime()');
1935 select jsonb_path_query('"12:34:56+3"', '$.datetime().type()');
1937 -----------------------
1938 "time with time zone"
1941 select jsonb_path_query('"12:34:56+3"', '$.datetime()');
1947 select jsonb_path_query('"12:34:56+3:10"', '$.datetime().type()');
1949 -----------------------
1950 "time with time zone"
1953 select jsonb_path_query('"12:34:56+3:10"', '$.datetime()');
1959 set time zone '+00';
1961 select jsonb_path_query(
1962 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
1963 '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))');
1964 ERROR: cannot convert value from date to timestamptz without time zone usage
1965 HINT: Use *_tz() function for time zone support.
1966 select jsonb_path_query(
1967 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
1968 '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))');
1969 ERROR: cannot convert value from date to timestamptz without time zone usage
1970 HINT: Use *_tz() function for time zone support.
1971 select jsonb_path_query(
1972 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
1973 '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))');
1974 ERROR: cannot convert value from date to timestamptz without time zone usage
1975 HINT: Use *_tz() function for time zone support.
1976 select jsonb_path_query_tz(
1977 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
1978 '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))');
1980 -----------------------------
1982 "2017-03-10T00:00:00"
1983 "2017-03-10T03:00:00+03:00"
1986 select jsonb_path_query_tz(
1987 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
1988 '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))');
1990 -----------------------------
1993 "2017-03-10T00:00:00"
1994 "2017-03-10T12:34:56"
1995 "2017-03-10T03:00:00+03:00"
1998 select jsonb_path_query_tz(
1999 '["2017-03-10", "2017-03-11", "2017-03-09", "12:34:56", "01:02:03+04", "2017-03-10 00:00:00", "2017-03-10 12:34:56", "2017-03-10 01:02:03+04", "2017-03-10 03:00:00+03"]',
2000 '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))');
2002 -----------------------------
2004 "2017-03-10T01:02:03+04:00"
2008 select jsonb_path_query(
2009 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2010 '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))');
2011 ERROR: cannot convert value from time to timetz without time zone usage
2012 HINT: Use *_tz() function for time zone support.
2013 select jsonb_path_query(
2014 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2015 '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))');
2016 ERROR: cannot convert value from time to timetz without time zone usage
2017 HINT: Use *_tz() function for time zone support.
2018 select jsonb_path_query(
2019 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2020 '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))');
2021 ERROR: cannot convert value from time to timetz without time zone usage
2022 HINT: Use *_tz() function for time zone support.
2023 select jsonb_path_query_tz(
2024 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2025 '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))');
2027 ---------------------
2032 select jsonb_path_query_tz(
2033 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2034 '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))');
2036 ---------------------
2042 select jsonb_path_query_tz(
2043 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
2044 '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))');
2046 ---------------------
2052 -- timetz comparison
2053 select jsonb_path_query(
2054 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2055 '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))');
2056 ERROR: cannot convert value from time to timetz without time zone usage
2057 HINT: Use *_tz() function for time zone support.
2058 select jsonb_path_query(
2059 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2060 '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))');
2061 ERROR: cannot convert value from time to timetz without time zone usage
2062 HINT: Use *_tz() function for time zone support.
2063 select jsonb_path_query(
2064 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2065 '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))');
2066 ERROR: cannot convert value from time to timetz without time zone usage
2067 HINT: Use *_tz() function for time zone support.
2068 select jsonb_path_query_tz(
2069 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2070 '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))');
2072 ---------------------
2076 select jsonb_path_query_tz(
2077 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2078 '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))');
2080 ---------------------
2088 select jsonb_path_query_tz(
2089 '["12:34:00+01", "12:35:00+01", "12:36:00+01", "12:35:00+02", "12:35:00-02", "10:35:00", "11:35:00", "12:35:00", "2017-03-10", "2017-03-10 12:35:00", "2017-03-10 12:35:00 +1"]',
2090 '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))');
2092 ---------------------
2098 -- timestamp comparison
2099 select jsonb_path_query(
2100 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2101 '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2102 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2103 HINT: Use *_tz() function for time zone support.
2104 select jsonb_path_query(
2105 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2106 '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2107 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2108 HINT: Use *_tz() function for time zone support.
2109 select jsonb_path_query(
2110 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2111 '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2112 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2113 HINT: Use *_tz() function for time zone support.
2114 select jsonb_path_query_tz(
2115 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2116 '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2118 -----------------------------
2119 "2017-03-10T12:35:00"
2120 "2017-03-10T13:35:00+01:00"
2123 select jsonb_path_query_tz(
2124 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2125 '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2127 -----------------------------
2128 "2017-03-10T12:35:00"
2129 "2017-03-10T12:36:00"
2130 "2017-03-10T13:35:00+01:00"
2131 "2017-03-10T12:35:00-01:00"
2135 select jsonb_path_query_tz(
2136 '["2017-03-10 12:34:00", "2017-03-10 12:35:00", "2017-03-10 12:36:00", "2017-03-10 12:35:00+01", "2017-03-10 13:35:00+01", "2017-03-10 12:35:00-01", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2137 '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
2139 -----------------------------
2140 "2017-03-10T12:34:00"
2141 "2017-03-10T12:35:00+01:00"
2145 -- timestamptz comparison
2146 select jsonb_path_query(
2147 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2148 '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2149 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2150 HINT: Use *_tz() function for time zone support.
2151 select jsonb_path_query(
2152 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2153 '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2154 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2155 HINT: Use *_tz() function for time zone support.
2156 select jsonb_path_query(
2157 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2158 '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2159 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2160 HINT: Use *_tz() function for time zone support.
2161 select jsonb_path_query_tz(
2162 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2163 '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2165 -----------------------------
2166 "2017-03-10T12:35:00+01:00"
2167 "2017-03-10T11:35:00"
2170 select jsonb_path_query_tz(
2171 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2172 '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2174 -----------------------------
2175 "2017-03-10T12:35:00+01:00"
2176 "2017-03-10T12:36:00+01:00"
2177 "2017-03-10T12:35:00-02:00"
2178 "2017-03-10T11:35:00"
2179 "2017-03-10T12:35:00"
2183 select jsonb_path_query_tz(
2184 '["2017-03-10 12:34:00+01", "2017-03-10 12:35:00+01", "2017-03-10 12:36:00+01", "2017-03-10 12:35:00+02", "2017-03-10 12:35:00-02", "2017-03-10 10:35:00", "2017-03-10 11:35:00", "2017-03-10 12:35:00", "2017-03-10", "2017-03-11", "12:34:56", "12:34:56+01"]',
2185 '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
2187 -----------------------------
2188 "2017-03-10T12:34:00+01:00"
2189 "2017-03-10T12:35:00+02:00"
2190 "2017-03-10T10:35:00"
2194 -- overflow during comparison
2195 select jsonb_path_query('"1000000-01-01"', '$.datetime() > "2020-01-01 12:00:00".datetime()'::jsonpath);
2201 set time zone default;
2202 -- jsonpath operators
2203 SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*]');
2210 SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*] ? (@.a > 10)');
2215 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
2216 ERROR: JSON object does not contain key "a"
2217 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a');
2218 jsonb_path_query_array
2219 ------------------------
2223 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
2224 jsonb_path_query_array
2225 ------------------------
2229 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
2230 jsonb_path_query_array
2231 ------------------------
2235 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
2236 jsonb_path_query_array
2237 ------------------------
2241 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
2242 jsonb_path_query_array
2243 ------------------------
2247 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
2248 ERROR: JSON object does not contain key "a"
2249 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a', silent => true);
2250 jsonb_path_query_first
2251 ------------------------
2255 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a');
2256 jsonb_path_query_first
2257 ------------------------
2261 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
2262 jsonb_path_query_first
2263 ------------------------
2267 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
2268 jsonb_path_query_first
2269 ------------------------
2273 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
2274 jsonb_path_query_first
2275 ------------------------
2279 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
2280 jsonb_path_query_first
2281 ------------------------
2285 SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*].a ? (@ > 1)';
2291 SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*] ? (@.a > 2)';
2297 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 1)');
2303 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 1, "max": 4}');
2309 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 3, "max": 4}');
2315 SELECT jsonb_path_match('true', '$', silent => false);
2321 SELECT jsonb_path_match('false', '$', silent => false);
2327 SELECT jsonb_path_match('null', '$', silent => false);
2333 SELECT jsonb_path_match('1', '$', silent => true);
2339 SELECT jsonb_path_match('1', '$', silent => false);
2340 ERROR: single boolean result is expected
2341 SELECT jsonb_path_match('"a"', '$', silent => false);
2342 ERROR: single boolean result is expected
2343 SELECT jsonb_path_match('{}', '$', silent => false);
2344 ERROR: single boolean result is expected
2345 SELECT jsonb_path_match('[true]', '$', silent => false);
2346 ERROR: single boolean result is expected
2347 SELECT jsonb_path_match('{}', 'lax $.a', silent => false);
2348 ERROR: single boolean result is expected
2349 SELECT jsonb_path_match('{}', 'strict $.a', silent => false);
2350 ERROR: JSON object does not contain key "a"
2351 SELECT jsonb_path_match('{}', 'strict $.a', silent => true);
2357 SELECT jsonb_path_match('[true, true]', '$[*]', silent => false);
2358 ERROR: single boolean result is expected
2359 SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1';
2365 SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 2';
2371 SELECT jsonb_path_match('[{"a": 1}, {"a": 2}]', '$[*].a > 1');
2377 -- test string comparison (Unicode codepoint collation)
2380 SELECT jsonb_build_object('s', s), num
2381 FROM unnest('{"", "a", "ab", "abc", "abcd", "b", "A", "AB", "ABC", "ABc", "ABcD", "B"}'::text[]) WITH ORDINALITY AS a(s, num)
2385 jsonb_path_query_first(s1.j, '$.s < $s', vars => s2.j) lt,
2386 jsonb_path_query_first(s1.j, '$.s <= $s', vars => s2.j) le,
2387 jsonb_path_query_first(s1.j, '$.s == $s', vars => s2.j) eq,
2388 jsonb_path_query_first(s1.j, '$.s >= $s', vars => s2.j) ge,
2389 jsonb_path_query_first(s1.j, '$.s > $s', vars => s2.j) gt
2391 ORDER BY s1.num, s2.num;
2392 j | j | lt | le | eq | ge | gt
2393 ---------------+---------------+-------+-------+-------+-------+-------
2394 {"s": ""} | {"s": ""} | false | true | true | true | false
2395 {"s": ""} | {"s": "a"} | true | true | false | false | false
2396 {"s": ""} | {"s": "ab"} | true | true | false | false | false
2397 {"s": ""} | {"s": "abc"} | true | true | false | false | false
2398 {"s": ""} | {"s": "abcd"} | true | true | false | false | false
2399 {"s": ""} | {"s": "b"} | true | true | false | false | false
2400 {"s": ""} | {"s": "A"} | true | true | false | false | false
2401 {"s": ""} | {"s": "AB"} | true | true | false | false | false
2402 {"s": ""} | {"s": "ABC"} | true | true | false | false | false
2403 {"s": ""} | {"s": "ABc"} | true | true | false | false | false
2404 {"s": ""} | {"s": "ABcD"} | true | true | false | false | false
2405 {"s": ""} | {"s": "B"} | true | true | false | false | false
2406 {"s": "a"} | {"s": ""} | false | false | false | true | true
2407 {"s": "a"} | {"s": "a"} | false | true | true | true | false
2408 {"s": "a"} | {"s": "ab"} | true | true | false | false | false
2409 {"s": "a"} | {"s": "abc"} | true | true | false | false | false
2410 {"s": "a"} | {"s": "abcd"} | true | true | false | false | false
2411 {"s": "a"} | {"s": "b"} | true | true | false | false | false
2412 {"s": "a"} | {"s": "A"} | false | false | false | true | true
2413 {"s": "a"} | {"s": "AB"} | false | false | false | true | true
2414 {"s": "a"} | {"s": "ABC"} | false | false | false | true | true
2415 {"s": "a"} | {"s": "ABc"} | false | false | false | true | true
2416 {"s": "a"} | {"s": "ABcD"} | false | false | false | true | true
2417 {"s": "a"} | {"s": "B"} | false | false | false | true | true
2418 {"s": "ab"} | {"s": ""} | false | false | false | true | true
2419 {"s": "ab"} | {"s": "a"} | false | false | false | true | true
2420 {"s": "ab"} | {"s": "ab"} | false | true | true | true | false
2421 {"s": "ab"} | {"s": "abc"} | true | true | false | false | false
2422 {"s": "ab"} | {"s": "abcd"} | true | true | false | false | false
2423 {"s": "ab"} | {"s": "b"} | true | true | false | false | false
2424 {"s": "ab"} | {"s": "A"} | false | false | false | true | true
2425 {"s": "ab"} | {"s": "AB"} | false | false | false | true | true
2426 {"s": "ab"} | {"s": "ABC"} | false | false | false | true | true
2427 {"s": "ab"} | {"s": "ABc"} | false | false | false | true | true
2428 {"s": "ab"} | {"s": "ABcD"} | false | false | false | true | true
2429 {"s": "ab"} | {"s": "B"} | false | false | false | true | true
2430 {"s": "abc"} | {"s": ""} | false | false | false | true | true
2431 {"s": "abc"} | {"s": "a"} | false | false | false | true | true
2432 {"s": "abc"} | {"s": "ab"} | false | false | false | true | true
2433 {"s": "abc"} | {"s": "abc"} | false | true | true | true | false
2434 {"s": "abc"} | {"s": "abcd"} | true | true | false | false | false
2435 {"s": "abc"} | {"s": "b"} | true | true | false | false | false
2436 {"s": "abc"} | {"s": "A"} | false | false | false | true | true
2437 {"s": "abc"} | {"s": "AB"} | false | false | false | true | true
2438 {"s": "abc"} | {"s": "ABC"} | false | false | false | true | true
2439 {"s": "abc"} | {"s": "ABc"} | false | false | false | true | true
2440 {"s": "abc"} | {"s": "ABcD"} | false | false | false | true | true
2441 {"s": "abc"} | {"s": "B"} | false | false | false | true | true
2442 {"s": "abcd"} | {"s": ""} | false | false | false | true | true
2443 {"s": "abcd"} | {"s": "a"} | false | false | false | true | true
2444 {"s": "abcd"} | {"s": "ab"} | false | false | false | true | true
2445 {"s": "abcd"} | {"s": "abc"} | false | false | false | true | true
2446 {"s": "abcd"} | {"s": "abcd"} | false | true | true | true | false
2447 {"s": "abcd"} | {"s": "b"} | true | true | false | false | false
2448 {"s": "abcd"} | {"s": "A"} | false | false | false | true | true
2449 {"s": "abcd"} | {"s": "AB"} | false | false | false | true | true
2450 {"s": "abcd"} | {"s": "ABC"} | false | false | false | true | true
2451 {"s": "abcd"} | {"s": "ABc"} | false | false | false | true | true
2452 {"s": "abcd"} | {"s": "ABcD"} | false | false | false | true | true
2453 {"s": "abcd"} | {"s": "B"} | false | false | false | true | true
2454 {"s": "b"} | {"s": ""} | false | false | false | true | true
2455 {"s": "b"} | {"s": "a"} | false | false | false | true | true
2456 {"s": "b"} | {"s": "ab"} | false | false | false | true | true
2457 {"s": "b"} | {"s": "abc"} | false | false | false | true | true
2458 {"s": "b"} | {"s": "abcd"} | false | false | false | true | true
2459 {"s": "b"} | {"s": "b"} | false | true | true | true | false
2460 {"s": "b"} | {"s": "A"} | false | false | false | true | true
2461 {"s": "b"} | {"s": "AB"} | false | false | false | true | true
2462 {"s": "b"} | {"s": "ABC"} | false | false | false | true | true
2463 {"s": "b"} | {"s": "ABc"} | false | false | false | true | true
2464 {"s": "b"} | {"s": "ABcD"} | false | false | false | true | true
2465 {"s": "b"} | {"s": "B"} | false | false | false | true | true
2466 {"s": "A"} | {"s": ""} | false | false | false | true | true
2467 {"s": "A"} | {"s": "a"} | true | true | false | false | false
2468 {"s": "A"} | {"s": "ab"} | true | true | false | false | false
2469 {"s": "A"} | {"s": "abc"} | true | true | false | false | false
2470 {"s": "A"} | {"s": "abcd"} | true | true | false | false | false
2471 {"s": "A"} | {"s": "b"} | true | true | false | false | false
2472 {"s": "A"} | {"s": "A"} | false | true | true | true | false
2473 {"s": "A"} | {"s": "AB"} | true | true | false | false | false
2474 {"s": "A"} | {"s": "ABC"} | true | true | false | false | false
2475 {"s": "A"} | {"s": "ABc"} | true | true | false | false | false
2476 {"s": "A"} | {"s": "ABcD"} | true | true | false | false | false
2477 {"s": "A"} | {"s": "B"} | true | true | false | false | false
2478 {"s": "AB"} | {"s": ""} | false | false | false | true | true
2479 {"s": "AB"} | {"s": "a"} | true | true | false | false | false
2480 {"s": "AB"} | {"s": "ab"} | true | true | false | false | false
2481 {"s": "AB"} | {"s": "abc"} | true | true | false | false | false
2482 {"s": "AB"} | {"s": "abcd"} | true | true | false | false | false
2483 {"s": "AB"} | {"s": "b"} | true | true | false | false | false
2484 {"s": "AB"} | {"s": "A"} | false | false | false | true | true
2485 {"s": "AB"} | {"s": "AB"} | false | true | true | true | false
2486 {"s": "AB"} | {"s": "ABC"} | true | true | false | false | false
2487 {"s": "AB"} | {"s": "ABc"} | true | true | false | false | false
2488 {"s": "AB"} | {"s": "ABcD"} | true | true | false | false | false
2489 {"s": "AB"} | {"s": "B"} | true | true | false | false | false
2490 {"s": "ABC"} | {"s": ""} | false | false | false | true | true
2491 {"s": "ABC"} | {"s": "a"} | true | true | false | false | false
2492 {"s": "ABC"} | {"s": "ab"} | true | true | false | false | false
2493 {"s": "ABC"} | {"s": "abc"} | true | true | false | false | false
2494 {"s": "ABC"} | {"s": "abcd"} | true | true | false | false | false
2495 {"s": "ABC"} | {"s": "b"} | true | true | false | false | false
2496 {"s": "ABC"} | {"s": "A"} | false | false | false | true | true
2497 {"s": "ABC"} | {"s": "AB"} | false | false | false | true | true
2498 {"s": "ABC"} | {"s": "ABC"} | false | true | true | true | false
2499 {"s": "ABC"} | {"s": "ABc"} | true | true | false | false | false
2500 {"s": "ABC"} | {"s": "ABcD"} | true | true | false | false | false
2501 {"s": "ABC"} | {"s": "B"} | true | true | false | false | false
2502 {"s": "ABc"} | {"s": ""} | false | false | false | true | true
2503 {"s": "ABc"} | {"s": "a"} | true | true | false | false | false
2504 {"s": "ABc"} | {"s": "ab"} | true | true | false | false | false
2505 {"s": "ABc"} | {"s": "abc"} | true | true | false | false | false
2506 {"s": "ABc"} | {"s": "abcd"} | true | true | false | false | false
2507 {"s": "ABc"} | {"s": "b"} | true | true | false | false | false
2508 {"s": "ABc"} | {"s": "A"} | false | false | false | true | true
2509 {"s": "ABc"} | {"s": "AB"} | false | false | false | true | true
2510 {"s": "ABc"} | {"s": "ABC"} | false | false | false | true | true
2511 {"s": "ABc"} | {"s": "ABc"} | false | true | true | true | false
2512 {"s": "ABc"} | {"s": "ABcD"} | true | true | false | false | false
2513 {"s": "ABc"} | {"s": "B"} | true | true | false | false | false
2514 {"s": "ABcD"} | {"s": ""} | false | false | false | true | true
2515 {"s": "ABcD"} | {"s": "a"} | true | true | false | false | false
2516 {"s": "ABcD"} | {"s": "ab"} | true | true | false | false | false
2517 {"s": "ABcD"} | {"s": "abc"} | true | true | false | false | false
2518 {"s": "ABcD"} | {"s": "abcd"} | true | true | false | false | false
2519 {"s": "ABcD"} | {"s": "b"} | true | true | false | false | false
2520 {"s": "ABcD"} | {"s": "A"} | false | false | false | true | true
2521 {"s": "ABcD"} | {"s": "AB"} | false | false | false | true | true
2522 {"s": "ABcD"} | {"s": "ABC"} | false | false | false | true | true
2523 {"s": "ABcD"} | {"s": "ABc"} | false | false | false | true | true
2524 {"s": "ABcD"} | {"s": "ABcD"} | false | true | true | true | false
2525 {"s": "ABcD"} | {"s": "B"} | true | true | false | false | false
2526 {"s": "B"} | {"s": ""} | false | false | false | true | true
2527 {"s": "B"} | {"s": "a"} | true | true | false | false | false
2528 {"s": "B"} | {"s": "ab"} | true | true | false | false | false
2529 {"s": "B"} | {"s": "abc"} | true | true | false | false | false
2530 {"s": "B"} | {"s": "abcd"} | true | true | false | false | false
2531 {"s": "B"} | {"s": "b"} | true | true | false | false | false
2532 {"s": "B"} | {"s": "A"} | false | false | false | true | true
2533 {"s": "B"} | {"s": "AB"} | false | false | false | true | true
2534 {"s": "B"} | {"s": "ABC"} | false | false | false | true | true
2535 {"s": "B"} | {"s": "ABc"} | false | false | false | true | true
2536 {"s": "B"} | {"s": "ABcD"} | false | false | false | true | true
2537 {"s": "B"} | {"s": "B"} | false | true | true | true | false