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 -- any key on arrays with and without unwrapping.
1139 select jsonb_path_query('{"a": [1,2,3], "b": [3,4,5]}', '$.*');
1146 select jsonb_path_query('[1,2,3]', '$.*');
1151 select jsonb_path_query('[1,2,3,{"b": [3,4,5]}]', 'lax $.*');
1157 select jsonb_path_query('[1,2,3,{"b": [3,4,5]}]', 'strict $.*');
1158 ERROR: jsonpath wildcard member accessor can only be applied to an object
1159 select jsonb_path_query('[1,2,3,{"b": [3,4,5]}]', 'strict $.*', NULL, true);
1164 select jsonb '{"a": [1,2,3], "b": [3,4,5]}' @? '$.*';
1170 select jsonb '[1,2,3]' @? '$.*';
1176 select jsonb '[1,2,3,{"b": [3,4,5]}]' @? 'lax $.*';
1182 select jsonb '[1,2,3,{"b": [3,4,5]}]' @? 'strict $.*';
1188 -- extension: boolean expressions
1189 select jsonb_path_query('2', '$ > 1');
1195 select jsonb_path_query('2', '$ <= 1');
1201 select jsonb_path_query('2', '$ == "2"');
1207 select jsonb '2' @? '$ == "2"';
1213 select jsonb '2' @@ '$ > 1';
1219 select jsonb '2' @@ '$ <= 1';
1225 select jsonb '2' @@ '$ == "2"';
1231 select jsonb '2' @@ '1';
1237 select jsonb '{}' @@ '$';
1243 select jsonb '[]' @@ '$';
1249 select jsonb '[1,2,3]' @@ '$[*]';
1255 select jsonb '[]' @@ '$[*]';
1261 select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] > $x) [1]', '{"x": 1}');
1267 select jsonb_path_match('[[1, true], [2, false]]', 'strict $[*] ? (@[0] < $x) [1]', '{"x": 2}');
1273 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => false);
1279 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'lax exists($[*].a)', silent => true);
1285 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => false);
1291 select jsonb_path_match('[{"a": 1}, {"a": 2}, 3]', 'strict exists($[*].a)', silent => true);
1297 select jsonb_path_query('[null,1,true,"a",[],{}]', '$.type()');
1303 select jsonb_path_query('[null,1,true,"a",[],{}]', 'lax $.type()');
1309 select jsonb_path_query('[null,1,true,"a",[],{}]', '$[*].type()');
1320 select jsonb_path_query('null', 'null.type()');
1326 select jsonb_path_query('null', 'true.type()');
1332 select jsonb_path_query('null', '(123).type()');
1338 select jsonb_path_query('null', '"123".type()');
1344 select jsonb_path_query('{"a": 2}', '($.a - 5).abs() + 10');
1350 select jsonb_path_query('{"a": 2.5}', '-($.a * $.a).floor() % 4.3');
1356 select jsonb_path_query('[1, 2, 3]', '($[*] > 2) ? (@ == true)');
1362 select jsonb_path_query('[1, 2, 3]', '($[*] > 3).type()');
1368 select jsonb_path_query('[1, 2, 3]', '($[*].a > 3).type()');
1374 select jsonb_path_query('[1, 2, 3]', 'strict ($[*].a > 3).type()');
1380 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()');
1381 ERROR: jsonpath item method .size() can only be applied to an array
1382 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'strict $[*].size()', silent => true);
1387 select jsonb_path_query('[1,null,true,"11",[],[1],[1,2,3],{},{"a":1,"b":2}]', 'lax $[*].size()');
1401 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].abs()');
1411 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].floor()');
1421 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling()');
1431 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs()');
1441 select jsonb_path_query('[0, 1, -2, -3.4, 5.6]', '$[*].ceiling().abs().type()');
1451 select jsonb_path_query('[{},1]', '$[*].keyvalue()');
1452 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1453 select jsonb_path_query('[{},1]', '$[*].keyvalue()', silent => true);
1458 select jsonb_path_query('{}', '$.keyvalue()');
1463 select jsonb_path_query('{"a": 1, "b": [1, 2], "c": {"a": "bbb"}}', '$.keyvalue()');
1465 ----------------------------------------------
1466 {"id": 0, "key": "a", "value": 1}
1467 {"id": 0, "key": "b", "value": [1, 2]}
1468 {"id": 0, "key": "c", "value": {"a": "bbb"}}
1471 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', '$[*].keyvalue()');
1473 -----------------------------------------------
1474 {"id": 12, "key": "a", "value": 1}
1475 {"id": 12, "key": "b", "value": [1, 2]}
1476 {"id": 72, "key": "c", "value": {"a": "bbb"}}
1479 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue()');
1480 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1481 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'lax $.keyvalue()');
1483 -----------------------------------------------
1484 {"id": 12, "key": "a", "value": 1}
1485 {"id": 12, "key": "b", "value": [1, 2]}
1486 {"id": 72, "key": "c", "value": {"a": "bbb"}}
1489 select jsonb_path_query('[{"a": 1, "b": [1, 2]}, {"c": {"a": "bbb"}}]', 'strict $.keyvalue().a');
1490 ERROR: jsonpath item method .keyvalue() can only be applied to an object
1491 select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue()';
1497 select jsonb '{"a": 1, "b": [1, 2]}' @? 'lax $.keyvalue().key';
1503 select jsonb_path_query('null', '$.double()');
1504 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1505 select jsonb_path_query('true', '$.double()');
1506 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1507 select jsonb_path_query('null', '$.double()', silent => true);
1512 select jsonb_path_query('true', '$.double()', silent => true);
1517 select jsonb_path_query('[]', '$.double()');
1522 select jsonb_path_query('[]', 'strict $.double()');
1523 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1524 select jsonb_path_query('{}', '$.double()');
1525 ERROR: jsonpath item method .double() can only be applied to a string or numeric value
1526 select jsonb_path_query('[]', 'strict $.double()', silent => true);
1531 select jsonb_path_query('{}', '$.double()', silent => true);
1536 select jsonb_path_query('1.23', '$.double()');
1542 select jsonb_path_query('"1.23"', '$.double()');
1548 select jsonb_path_query('"1.23aaa"', '$.double()');
1549 ERROR: argument "1.23aaa" of jsonpath item method .double() is invalid for type double precision
1550 select jsonb_path_query('1e1000', '$.double()');
1551 ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .double() is invalid for type double precision
1552 select jsonb_path_query('"nan"', '$.double()');
1553 ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
1554 select jsonb_path_query('"NaN"', '$.double()');
1555 ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
1556 select jsonb_path_query('"inf"', '$.double()');
1557 ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
1558 select jsonb_path_query('"-inf"', '$.double()');
1559 ERROR: NaN or Infinity is not allowed for jsonpath item method .double()
1560 select jsonb_path_query('"inf"', '$.double()', silent => true);
1565 select jsonb_path_query('"-inf"', '$.double()', silent => true);
1570 select jsonb_path_query('{}', '$.abs()');
1571 ERROR: jsonpath item method .abs() can only be applied to a numeric value
1572 select jsonb_path_query('true', '$.floor()');
1573 ERROR: jsonpath item method .floor() can only be applied to a numeric value
1574 select jsonb_path_query('"1.2"', '$.ceiling()');
1575 ERROR: jsonpath item method .ceiling() can only be applied to a numeric value
1576 select jsonb_path_query('{}', '$.abs()', silent => true);
1581 select jsonb_path_query('true', '$.floor()', silent => true);
1586 select jsonb_path_query('"1.2"', '$.ceiling()', silent => true);
1591 select jsonb_path_query('["", "a", "abc", "abcabc"]', '$[*] ? (@ starts with "abc")');
1598 select jsonb_path_query('["", "a", "abc", "abcabc"]', 'strict $ ? (@[*] starts with "abc")');
1600 ----------------------------
1601 ["", "a", "abc", "abcabc"]
1604 select jsonb_path_query('["", "a", "abd", "abdabc"]', 'strict $ ? (@[*] starts with "abc")');
1609 select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? (@[*] starts with "abc")');
1614 select jsonb_path_query('["abc", "abcabc", null, 1]', 'strict $ ? ((@[*] starts with "abc") is unknown)');
1616 ----------------------------
1617 ["abc", "abcabc", null, 1]
1620 select jsonb_path_query('[[null, 1, "abc", "abcabc"]]', 'lax $ ? (@[*] starts with "abc")');
1622 ----------------------------
1623 [null, 1, "abc", "abcabc"]
1626 select jsonb_path_query('[[null, 1, "abd", "abdabc"]]', 'lax $ ? ((@[*] starts with "abc") is unknown)');
1628 ----------------------------
1629 [null, 1, "abd", "abdabc"]
1632 select jsonb_path_query('[null, 1, "abd", "abdabc"]', 'lax $[*] ? ((@ starts with "abc") is unknown)');
1639 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c")');
1646 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "i")');
1654 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "m")');
1662 select jsonb_path_query('[null, 1, "abc", "abd", "aBdC", "abdacb", "babc", "adc\nabc", "ab\nadc"]', 'lax $[*] ? (@ like_regex "^ab.*c" flag "s")');
1670 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "q")');
1677 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "a\\b" flag "")');
1683 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "q")');
1689 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "q")');
1694 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\B$" flag "iq")');
1700 select jsonb_path_query('[null, 1, "a\b", "a\\b", "^a\\b$"]', 'lax $[*] ? (@ like_regex "^a\\b$" flag "")');
1706 select jsonb_path_query('null', '$.datetime()');
1707 ERROR: jsonpath item method .datetime() can only be applied to a string
1708 select jsonb_path_query('true', '$.datetime()');
1709 ERROR: jsonpath item method .datetime() can only be applied to a string
1710 select jsonb_path_query('1', '$.datetime()');
1711 ERROR: jsonpath item method .datetime() can only be applied to a string
1712 select jsonb_path_query('[]', '$.datetime()');
1717 select jsonb_path_query('[]', 'strict $.datetime()');
1718 ERROR: jsonpath item method .datetime() can only be applied to a string
1719 select jsonb_path_query('{}', '$.datetime()');
1720 ERROR: jsonpath item method .datetime() can only be applied to a string
1721 select jsonb_path_query('"bogus"', '$.datetime()');
1722 ERROR: datetime format is not recognized: "bogus"
1723 HINT: Use a datetime template argument to specify the input data format.
1724 select jsonb_path_query('"12:34"', '$.datetime("aaa")');
1725 ERROR: invalid datetime format separator: "a"
1726 select jsonb_path_query('"aaaa"', '$.datetime("HH24")');
1727 ERROR: invalid value "aa" for "HH24"
1728 DETAIL: Value must be an integer.
1729 select jsonb '"10-03-2017"' @? '$.datetime("dd-mm-yyyy")';
1735 select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy")');
1741 select jsonb_path_query('"10-03-2017"', '$.datetime("dd-mm-yyyy").type()');
1747 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy")');
1748 ERROR: trailing characters remain in input string after datetime format
1749 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy").type()');
1750 ERROR: trailing characters remain in input string after datetime format
1751 select jsonb_path_query('"10-03-2017 12:34"', ' $.datetime("dd-mm-yyyy HH24:MI").type()');
1753 -------------------------------
1754 "timestamp without time zone"
1757 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM").type()');
1759 ----------------------------
1760 "timestamp with time zone"
1763 select jsonb_path_query('"12:34:56"', '$.datetime("HH24:MI:SS").type()');
1765 --------------------------
1766 "time without time zone"
1769 select jsonb_path_query('"12:34:56 +05:20"', '$.datetime("HH24:MI:SS TZH:TZM").type()');
1771 -----------------------
1772 "time with time zone"
1775 select jsonb_path_query('"10-03-2017T12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1777 -----------------------
1778 "2017-03-10T12:34:56"
1781 select jsonb_path_query('"10-03-2017t12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1782 ERROR: unmatched format character "T"
1783 select jsonb_path_query('"10-03-2017 12:34:56"', '$.datetime("dd-mm-yyyy\"T\"HH24:MI:SS")');
1784 ERROR: unmatched format character "T"
1786 select jsonb_path_query('null', '$.bigint()');
1787 ERROR: jsonpath item method .bigint() can only be applied to a string or numeric value
1788 select jsonb_path_query('true', '$.bigint()');
1789 ERROR: jsonpath item method .bigint() can only be applied to a string or numeric value
1790 select jsonb_path_query('null', '$.bigint()', silent => true);
1795 select jsonb_path_query('true', '$.bigint()', silent => true);
1800 select jsonb_path_query('[]', '$.bigint()');
1805 select jsonb_path_query('[]', 'strict $.bigint()');
1806 ERROR: jsonpath item method .bigint() can only be applied to a string or numeric value
1807 select jsonb_path_query('{}', '$.bigint()');
1808 ERROR: jsonpath item method .bigint() can only be applied to a string or numeric value
1809 select jsonb_path_query('[]', 'strict $.bigint()', silent => true);
1814 select jsonb_path_query('{}', '$.bigint()', silent => true);
1819 select jsonb_path_query('"1.23"', '$.bigint()');
1820 ERROR: argument "1.23" of jsonpath item method .bigint() is invalid for type bigint
1821 select jsonb_path_query('"1.23aaa"', '$.bigint()');
1822 ERROR: argument "1.23aaa" of jsonpath item method .bigint() is invalid for type bigint
1823 select jsonb_path_query('1e1000', '$.bigint()');
1824 ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .bigint() is invalid for type bigint
1825 select jsonb_path_query('"nan"', '$.bigint()');
1826 ERROR: argument "nan" of jsonpath item method .bigint() is invalid for type bigint
1827 select jsonb_path_query('"NaN"', '$.bigint()');
1828 ERROR: argument "NaN" of jsonpath item method .bigint() is invalid for type bigint
1829 select jsonb_path_query('"inf"', '$.bigint()');
1830 ERROR: argument "inf" of jsonpath item method .bigint() is invalid for type bigint
1831 select jsonb_path_query('"-inf"', '$.bigint()');
1832 ERROR: argument "-inf" of jsonpath item method .bigint() is invalid for type bigint
1833 select jsonb_path_query('"inf"', '$.bigint()', silent => true);
1838 select jsonb_path_query('"-inf"', '$.bigint()', silent => true);
1843 select jsonb_path_query('123', '$.bigint()');
1849 select jsonb_path_query('"123"', '$.bigint()');
1855 select jsonb_path_query('1.23', '$.bigint()');
1861 select jsonb_path_query('1.83', '$.bigint()');
1867 select jsonb_path_query('1234567890123', '$.bigint()');
1873 select jsonb_path_query('"1234567890123"', '$.bigint()');
1879 select jsonb_path_query('12345678901234567890', '$.bigint()');
1880 ERROR: argument "12345678901234567890" of jsonpath item method .bigint() is invalid for type bigint
1881 select jsonb_path_query('"12345678901234567890"', '$.bigint()');
1882 ERROR: argument "12345678901234567890" of jsonpath item method .bigint() is invalid for type bigint
1883 select jsonb_path_query('"+123"', '$.bigint()');
1889 select jsonb_path_query('-123', '$.bigint()');
1895 select jsonb_path_query('"-123"', '$.bigint()');
1901 select jsonb_path_query('123', '$.bigint() * 2');
1908 select jsonb_path_query('null', '$.boolean()');
1909 ERROR: jsonpath item method .boolean() can only be applied to a boolean, string, or numeric value
1910 select jsonb_path_query('null', '$.boolean()', silent => true);
1915 select jsonb_path_query('[]', '$.boolean()');
1920 select jsonb_path_query('[]', 'strict $.boolean()');
1921 ERROR: jsonpath item method .boolean() can only be applied to a boolean, string, or numeric value
1922 select jsonb_path_query('{}', '$.boolean()');
1923 ERROR: jsonpath item method .boolean() can only be applied to a boolean, string, or numeric value
1924 select jsonb_path_query('[]', 'strict $.boolean()', silent => true);
1929 select jsonb_path_query('{}', '$.boolean()', silent => true);
1934 select jsonb_path_query('1.23', '$.boolean()');
1935 ERROR: argument "1.23" of jsonpath item method .boolean() is invalid for type boolean
1936 select jsonb_path_query('"1.23"', '$.boolean()');
1937 ERROR: argument "1.23" of jsonpath item method .boolean() is invalid for type boolean
1938 select jsonb_path_query('"1.23aaa"', '$.boolean()');
1939 ERROR: argument "1.23aaa" of jsonpath item method .boolean() is invalid for type boolean
1940 select jsonb_path_query('1e1000', '$.boolean()');
1941 ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .boolean() is invalid for type boolean
1942 select jsonb_path_query('"nan"', '$.boolean()');
1943 ERROR: argument "nan" of jsonpath item method .boolean() is invalid for type boolean
1944 select jsonb_path_query('"NaN"', '$.boolean()');
1945 ERROR: argument "NaN" of jsonpath item method .boolean() is invalid for type boolean
1946 select jsonb_path_query('"inf"', '$.boolean()');
1947 ERROR: argument "inf" of jsonpath item method .boolean() is invalid for type boolean
1948 select jsonb_path_query('"-inf"', '$.boolean()');
1949 ERROR: argument "-inf" of jsonpath item method .boolean() is invalid for type boolean
1950 select jsonb_path_query('"inf"', '$.boolean()', silent => true);
1955 select jsonb_path_query('"-inf"', '$.boolean()', silent => true);
1960 select jsonb_path_query('"100"', '$.boolean()');
1961 ERROR: argument "100" of jsonpath item method .boolean() is invalid for type boolean
1962 select jsonb_path_query('true', '$.boolean()');
1968 select jsonb_path_query('false', '$.boolean()');
1974 select jsonb_path_query('1', '$.boolean()');
1980 select jsonb_path_query('0', '$.boolean()');
1986 select jsonb_path_query('-1', '$.boolean()');
1992 select jsonb_path_query('100', '$.boolean()');
1998 select jsonb_path_query('"1"', '$.boolean()');
2004 select jsonb_path_query('"0"', '$.boolean()');
2010 select jsonb_path_query('"true"', '$.boolean()');
2016 select jsonb_path_query('"false"', '$.boolean()');
2022 select jsonb_path_query('"TRUE"', '$.boolean()');
2028 select jsonb_path_query('"FALSE"', '$.boolean()');
2034 select jsonb_path_query('"yes"', '$.boolean()');
2040 select jsonb_path_query('"NO"', '$.boolean()');
2046 select jsonb_path_query('"T"', '$.boolean()');
2052 select jsonb_path_query('"f"', '$.boolean()');
2058 select jsonb_path_query('"y"', '$.boolean()');
2064 select jsonb_path_query('"N"', '$.boolean()');
2070 select jsonb_path_query('true', '$.boolean().type()');
2076 select jsonb_path_query('123', '$.boolean().type()');
2082 select jsonb_path_query('"Yes"', '$.boolean().type()');
2088 select jsonb_path_query_array('[1, "yes", false]', '$[*].boolean()');
2089 jsonb_path_query_array
2090 ------------------------
2095 select jsonb_path_query('null', '$.date()');
2096 ERROR: jsonpath item method .date() can only be applied to a string
2097 select jsonb_path_query('true', '$.date()');
2098 ERROR: jsonpath item method .date() can only be applied to a string
2099 select jsonb_path_query('1', '$.date()');
2100 ERROR: jsonpath item method .date() can only be applied to a string
2101 select jsonb_path_query('[]', '$.date()');
2106 select jsonb_path_query('[]', 'strict $.date()');
2107 ERROR: jsonpath item method .date() can only be applied to a string
2108 select jsonb_path_query('{}', '$.date()');
2109 ERROR: jsonpath item method .date() can only be applied to a string
2110 select jsonb_path_query('"bogus"', '$.date()');
2111 ERROR: date format is not recognized: "bogus"
2112 select jsonb '"2023-08-15"' @? '$.date()';
2118 select jsonb_path_query('"2023-08-15"', '$.date()');
2124 select jsonb_path_query('"2023-08-15"', '$.date().type()');
2130 select jsonb_path_query('"12:34:56"', '$.date()');
2131 ERROR: date format is not recognized: "12:34:56"
2132 select jsonb_path_query('"12:34:56 +05:30"', '$.date()');
2133 ERROR: date format is not recognized: "12:34:56 +05:30"
2134 select jsonb_path_query('"2023-08-15 12:34:56"', '$.date()');
2140 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.date()');
2141 ERROR: cannot convert value from timestamptz to date without time zone usage
2142 HINT: Use *_tz() function for time zone support.
2143 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.date()'); -- should work
2145 ---------------------
2149 select jsonb_path_query('"2023-08-15"', '$.date(2)');
2150 ERROR: syntax error at or near "2" of jsonpath input
2151 LINE 1: select jsonb_path_query('"2023-08-15"', '$.date(2)');
2154 select jsonb_path_query('null', '$.decimal()');
2155 ERROR: jsonpath item method .decimal() can only be applied to a string or numeric value
2156 select jsonb_path_query('true', '$.decimal()');
2157 ERROR: jsonpath item method .decimal() can only be applied to a string or numeric value
2158 select jsonb_path_query('null', '$.decimal()', silent => true);
2163 select jsonb_path_query('true', '$.decimal()', silent => true);
2168 select jsonb_path_query('[]', '$.decimal()');
2173 select jsonb_path_query('[]', 'strict $.decimal()');
2174 ERROR: jsonpath item method .decimal() can only be applied to a string or numeric value
2175 select jsonb_path_query('{}', '$.decimal()');
2176 ERROR: jsonpath item method .decimal() can only be applied to a string or numeric value
2177 select jsonb_path_query('[]', 'strict $.decimal()', silent => true);
2182 select jsonb_path_query('{}', '$.decimal()', silent => true);
2187 select jsonb_path_query('1.23', '$.decimal()');
2193 select jsonb_path_query('"1.23"', '$.decimal()');
2199 select jsonb_path_query('"1.23aaa"', '$.decimal()');
2200 ERROR: argument "1.23aaa" of jsonpath item method .decimal() is invalid for type numeric
2201 select jsonb_path_query('1e1000', '$.decimal()');
2203 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2204 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2207 select jsonb_path_query('"nan"', '$.decimal()');
2208 ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
2209 select jsonb_path_query('"NaN"', '$.decimal()');
2210 ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
2211 select jsonb_path_query('"inf"', '$.decimal()');
2212 ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
2213 select jsonb_path_query('"-inf"', '$.decimal()');
2214 ERROR: NaN or Infinity is not allowed for jsonpath item method .decimal()
2215 select jsonb_path_query('"inf"', '$.decimal()', silent => true);
2220 select jsonb_path_query('"-inf"', '$.decimal()', silent => true);
2225 select jsonb_path_query('123', '$.decimal()');
2231 select jsonb_path_query('"123"', '$.decimal()');
2237 select jsonb_path_query('12345678901234567890', '$.decimal()');
2239 ----------------------
2240 12345678901234567890
2243 select jsonb_path_query('"12345678901234567890"', '$.decimal()');
2245 ----------------------
2246 12345678901234567890
2249 select jsonb_path_query('"+12.3"', '$.decimal()');
2255 select jsonb_path_query('-12.3', '$.decimal()');
2261 select jsonb_path_query('"-12.3"', '$.decimal()');
2267 select jsonb_path_query('12.3', '$.decimal() * 2');
2273 select jsonb_path_query('12345.678', '$.decimal(6, 1)');
2279 select jsonb_path_query('12345.678', '$.decimal(6, 2)');
2280 ERROR: argument "12345.678" of jsonpath item method .decimal() is invalid for type numeric
2281 select jsonb_path_query('1234.5678', '$.decimal(6, 2)');
2287 select jsonb_path_query('12345.678', '$.decimal(4, 6)');
2288 ERROR: argument "12345.678" of jsonpath item method .decimal() is invalid for type numeric
2289 select jsonb_path_query('12345.678', '$.decimal(0, 6)');
2290 ERROR: NUMERIC precision 0 must be between 1 and 1000
2291 select jsonb_path_query('12345.678', '$.decimal(1001, 6)');
2292 ERROR: NUMERIC precision 1001 must be between 1 and 1000
2293 select jsonb_path_query('1234.5678', '$.decimal(+6, +2)');
2299 select jsonb_path_query('1234.5678', '$.decimal(+6, -2)');
2305 select jsonb_path_query('1234.5678', '$.decimal(-6, +2)');
2306 ERROR: NUMERIC precision -6 must be between 1 and 1000
2307 select jsonb_path_query('1234.5678', '$.decimal(6, -1001)');
2308 ERROR: NUMERIC scale -1001 must be between -1000 and 1000
2309 select jsonb_path_query('1234.5678', '$.decimal(6, 1001)');
2310 ERROR: NUMERIC scale 1001 must be between -1000 and 1000
2311 select jsonb_path_query('-1234.5678', '$.decimal(+6, -2)');
2317 select jsonb_path_query('0.0123456', '$.decimal(1,2)');
2323 select jsonb_path_query('0.0012345', '$.decimal(2,4)');
2329 select jsonb_path_query('-0.00123456', '$.decimal(2,-4)');
2335 select jsonb_path_query('12.3', '$.decimal(12345678901,1)');
2336 ERROR: precision of jsonpath item method .decimal() is out of range for type integer
2337 select jsonb_path_query('12.3', '$.decimal(1,12345678901)');
2338 ERROR: scale of jsonpath item method .decimal() is out of range for type integer
2340 select jsonb_path_query('null', '$.integer()');
2341 ERROR: jsonpath item method .integer() can only be applied to a string or numeric value
2342 select jsonb_path_query('true', '$.integer()');
2343 ERROR: jsonpath item method .integer() can only be applied to a string or numeric value
2344 select jsonb_path_query('null', '$.integer()', silent => true);
2349 select jsonb_path_query('true', '$.integer()', silent => true);
2354 select jsonb_path_query('[]', '$.integer()');
2359 select jsonb_path_query('[]', 'strict $.integer()');
2360 ERROR: jsonpath item method .integer() can only be applied to a string or numeric value
2361 select jsonb_path_query('{}', '$.integer()');
2362 ERROR: jsonpath item method .integer() can only be applied to a string or numeric value
2363 select jsonb_path_query('[]', 'strict $.integer()', silent => true);
2368 select jsonb_path_query('{}', '$.integer()', silent => true);
2373 select jsonb_path_query('"1.23"', '$.integer()');
2374 ERROR: argument "1.23" of jsonpath item method .integer() is invalid for type integer
2375 select jsonb_path_query('"1.23aaa"', '$.integer()');
2376 ERROR: argument "1.23aaa" of jsonpath item method .integer() is invalid for type integer
2377 select jsonb_path_query('1e1000', '$.integer()');
2378 ERROR: argument "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" of jsonpath item method .integer() is invalid for type integer
2379 select jsonb_path_query('"nan"', '$.integer()');
2380 ERROR: argument "nan" of jsonpath item method .integer() is invalid for type integer
2381 select jsonb_path_query('"NaN"', '$.integer()');
2382 ERROR: argument "NaN" of jsonpath item method .integer() is invalid for type integer
2383 select jsonb_path_query('"inf"', '$.integer()');
2384 ERROR: argument "inf" of jsonpath item method .integer() is invalid for type integer
2385 select jsonb_path_query('"-inf"', '$.integer()');
2386 ERROR: argument "-inf" of jsonpath item method .integer() is invalid for type integer
2387 select jsonb_path_query('"inf"', '$.integer()', silent => true);
2392 select jsonb_path_query('"-inf"', '$.integer()', silent => true);
2397 select jsonb_path_query('123', '$.integer()');
2403 select jsonb_path_query('"123"', '$.integer()');
2409 select jsonb_path_query('1.23', '$.integer()');
2415 select jsonb_path_query('1.83', '$.integer()');
2421 select jsonb_path_query('12345678901', '$.integer()');
2422 ERROR: argument "12345678901" of jsonpath item method .integer() is invalid for type integer
2423 select jsonb_path_query('"12345678901"', '$.integer()');
2424 ERROR: argument "12345678901" of jsonpath item method .integer() is invalid for type integer
2425 select jsonb_path_query('"+123"', '$.integer()');
2431 select jsonb_path_query('-123', '$.integer()');
2437 select jsonb_path_query('"-123"', '$.integer()');
2443 select jsonb_path_query('123', '$.integer() * 2');
2450 select jsonb_path_query('null', '$.number()');
2451 ERROR: jsonpath item method .number() can only be applied to a string or numeric value
2452 select jsonb_path_query('true', '$.number()');
2453 ERROR: jsonpath item method .number() can only be applied to a string or numeric value
2454 select jsonb_path_query('null', '$.number()', silent => true);
2459 select jsonb_path_query('true', '$.number()', silent => true);
2464 select jsonb_path_query('[]', '$.number()');
2469 select jsonb_path_query('[]', 'strict $.number()');
2470 ERROR: jsonpath item method .number() can only be applied to a string or numeric value
2471 select jsonb_path_query('{}', '$.number()');
2472 ERROR: jsonpath item method .number() can only be applied to a string or numeric value
2473 select jsonb_path_query('[]', 'strict $.number()', silent => true);
2478 select jsonb_path_query('{}', '$.number()', silent => true);
2483 select jsonb_path_query('1.23', '$.number()');
2489 select jsonb_path_query('"1.23"', '$.number()');
2495 select jsonb_path_query('"1.23aaa"', '$.number()');
2496 ERROR: argument "1.23aaa" of jsonpath item method .number() is invalid for type numeric
2497 select jsonb_path_query('1e1000', '$.number()');
2499 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2500 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2503 select jsonb_path_query('"nan"', '$.number()');
2504 ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
2505 select jsonb_path_query('"NaN"', '$.number()');
2506 ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
2507 select jsonb_path_query('"inf"', '$.number()');
2508 ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
2509 select jsonb_path_query('"-inf"', '$.number()');
2510 ERROR: NaN or Infinity is not allowed for jsonpath item method .number()
2511 select jsonb_path_query('"inf"', '$.number()', silent => true);
2516 select jsonb_path_query('"-inf"', '$.number()', silent => true);
2521 select jsonb_path_query('123', '$.number()');
2527 select jsonb_path_query('"123"', '$.number()');
2533 select jsonb_path_query('12345678901234567890', '$.number()');
2535 ----------------------
2536 12345678901234567890
2539 select jsonb_path_query('"12345678901234567890"', '$.number()');
2541 ----------------------
2542 12345678901234567890
2545 select jsonb_path_query('"+12.3"', '$.number()');
2551 select jsonb_path_query('-12.3', '$.number()');
2557 select jsonb_path_query('"-12.3"', '$.number()');
2563 select jsonb_path_query('12.3', '$.number() * 2');
2570 select jsonb_path_query('null', '$.string()');
2571 ERROR: jsonpath item method .string() can only be applied to a boolean, string, numeric, or datetime value
2572 select jsonb_path_query('null', '$.string()', silent => true);
2577 select jsonb_path_query('[]', '$.string()');
2582 select jsonb_path_query('[]', 'strict $.string()');
2583 ERROR: jsonpath item method .string() can only be applied to a boolean, string, numeric, or datetime value
2584 select jsonb_path_query('{}', '$.string()');
2585 ERROR: jsonpath item method .string() can only be applied to a boolean, string, numeric, or datetime value
2586 select jsonb_path_query('[]', 'strict $.string()', silent => true);
2591 select jsonb_path_query('{}', '$.string()', silent => true);
2596 select jsonb_path_query('1.23', '$.string()');
2602 select jsonb_path_query('"1.23"', '$.string()');
2608 select jsonb_path_query('"1.23aaa"', '$.string()');
2614 select jsonb_path_query('1234', '$.string()');
2620 select jsonb_path_query('true', '$.string()');
2626 select jsonb_path_query('1234', '$.string().type()');
2632 select jsonb_path_query('[2, true]', '$.string()');
2639 select jsonb_path_query_array('[1.23, "yes", false]', '$[*].string()');
2640 jsonb_path_query_array
2641 --------------------------
2642 ["1.23", "yes", "false"]
2645 select jsonb_path_query_array('[1.23, "yes", false]', '$[*].string().type()');
2646 jsonb_path_query_array
2647 --------------------------------
2648 ["string", "string", "string"]
2651 select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp().string()');
2652 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
2653 HINT: Use *_tz() function for time zone support.
2654 select jsonb_path_query_tz('"2023-08-15 12:34:56 +5:30"', '$.timestamp().string()'); -- should work
2656 -----------------------
2657 "2023-08-15T00:04:56"
2660 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp_tz().string()');
2661 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
2662 HINT: Use *_tz() function for time zone support.
2663 select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz().string()'); -- should work
2665 -----------------------------
2666 "2023-08-15T12:34:56-07:00"
2669 select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp_tz().string()');
2671 -----------------------------
2672 "2023-08-15T12:34:56+05:30"
2675 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
2677 -----------------------
2678 "2023-08-15T12:34:56"
2681 select jsonb_path_query('"12:34:56 +5:30"', '$.time_tz().string()');
2687 -- this timetz usage will absorb the UTC offset of the current timezone setting
2689 set local timezone = 'UTC-10';
2690 select jsonb_path_query_tz('"12:34:56"', '$.time_tz().string()');
2692 ---------------------
2697 select jsonb_path_query('"12:34:56"', '$.time().string()');
2703 select jsonb_path_query('"2023-08-15"', '$.date().string()');
2709 -- .string() does not react to timezone or datestyle
2711 set local timezone = 'UTC';
2712 set local datestyle = 'German';
2713 select jsonb_path_query('"2023-08-15 12:34:56 +5:30"', '$.timestamp_tz().string()');
2715 -----------------------------
2716 "2023-08-15T12:34:56+05:30"
2719 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().string()');
2721 -----------------------
2722 "2023-08-15T12:34:56"
2727 select jsonb_path_query('null', '$.time()');
2728 ERROR: jsonpath item method .time() can only be applied to a string
2729 select jsonb_path_query('true', '$.time()');
2730 ERROR: jsonpath item method .time() can only be applied to a string
2731 select jsonb_path_query('1', '$.time()');
2732 ERROR: jsonpath item method .time() can only be applied to a string
2733 select jsonb_path_query('[]', '$.time()');
2738 select jsonb_path_query('[]', 'strict $.time()');
2739 ERROR: jsonpath item method .time() can only be applied to a string
2740 select jsonb_path_query('{}', '$.time()');
2741 ERROR: jsonpath item method .time() can only be applied to a string
2742 select jsonb_path_query('"bogus"', '$.time()');
2743 ERROR: time format is not recognized: "bogus"
2744 select jsonb '"12:34:56"' @? '$.time()';
2750 select jsonb_path_query('"12:34:56"', '$.time()');
2756 select jsonb_path_query('"12:34:56"', '$.time().type()');
2758 --------------------------
2759 "time without time zone"
2762 select jsonb_path_query('"2023-08-15"', '$.time()');
2763 ERROR: time format is not recognized: "2023-08-15"
2764 select jsonb_path_query('"12:34:56 +05:30"', '$.time()');
2765 ERROR: cannot convert value from timetz to time without time zone usage
2766 HINT: Use *_tz() function for time zone support.
2767 select jsonb_path_query_tz('"12:34:56 +05:30"', '$.time()'); -- should work
2769 ---------------------
2773 select jsonb_path_query('"2023-08-15 12:34:56"', '$.time()');
2779 select jsonb_path_query('"12:34:56.789"', '$.time(-1)');
2780 ERROR: syntax error at or near "-" of jsonpath input
2781 LINE 1: select jsonb_path_query('"12:34:56.789"', '$.time(-1)');
2783 select jsonb_path_query('"12:34:56.789"', '$.time(2.0)');
2784 ERROR: syntax error at or near "2.0" of jsonpath input
2785 LINE 1: select jsonb_path_query('"12:34:56.789"', '$.time(2.0)');
2787 select jsonb_path_query('"12:34:56.789"', '$.time(12345678901)');
2788 ERROR: time precision of jsonpath item method .time() is out of range for type integer
2789 select jsonb_path_query('"12:34:56.789"', '$.time(0)');
2795 select jsonb_path_query('"12:34:56.789"', '$.time(2)');
2801 select jsonb_path_query('"12:34:56.789"', '$.time(5)');
2807 select jsonb_path_query('"12:34:56.789"', '$.time(10)');
2808 WARNING: TIME(10) precision reduced to maximum allowed, 6
2814 select jsonb_path_query('"12:34:56.789012"', '$.time(8)');
2815 WARNING: TIME(8) precision reduced to maximum allowed, 6
2822 select jsonb_path_query('null', '$.time_tz()');
2823 ERROR: jsonpath item method .time_tz() can only be applied to a string
2824 select jsonb_path_query('true', '$.time_tz()');
2825 ERROR: jsonpath item method .time_tz() can only be applied to a string
2826 select jsonb_path_query('1', '$.time_tz()');
2827 ERROR: jsonpath item method .time_tz() can only be applied to a string
2828 select jsonb_path_query('[]', '$.time_tz()');
2833 select jsonb_path_query('[]', 'strict $.time_tz()');
2834 ERROR: jsonpath item method .time_tz() can only be applied to a string
2835 select jsonb_path_query('{}', '$.time_tz()');
2836 ERROR: jsonpath item method .time_tz() can only be applied to a string
2837 select jsonb_path_query('"bogus"', '$.time_tz()');
2838 ERROR: time_tz format is not recognized: "bogus"
2839 select jsonb '"12:34:56 +05:30"' @? '$.time_tz()';
2845 select jsonb_path_query('"12:34:56 +05:30"', '$.time_tz()');
2851 select jsonb_path_query('"12:34:56 +05:30"', '$.time_tz().type()');
2853 -----------------------
2854 "time with time zone"
2857 select jsonb_path_query('"2023-08-15"', '$.time_tz()');
2858 ERROR: time_tz format is not recognized: "2023-08-15"
2859 select jsonb_path_query('"2023-08-15 12:34:56"', '$.time_tz()');
2860 ERROR: time_tz format is not recognized: "2023-08-15 12:34:56"
2861 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(-1)');
2862 ERROR: syntax error at or near "-" of jsonpath input
2863 LINE 1: select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(...
2865 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(2.0)');
2866 ERROR: syntax error at or near "2.0" of jsonpath input
2867 LINE 1: select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(...
2869 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(12345678901)');
2870 ERROR: time precision of jsonpath item method .time_tz() is out of range for type integer
2871 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(0)');
2877 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(2)');
2879 ---------------------
2883 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(5)');
2885 ----------------------
2886 "12:34:56.789+05:30"
2889 select jsonb_path_query('"12:34:56.789 +05:30"', '$.time_tz(10)');
2890 WARNING: TIME(10) WITH TIME ZONE precision reduced to maximum allowed, 6
2892 ----------------------
2893 "12:34:56.789+05:30"
2896 select jsonb_path_query('"12:34:56.789012 +05:30"', '$.time_tz(8)');
2897 WARNING: TIME(8) WITH TIME ZONE precision reduced to maximum allowed, 6
2899 -------------------------
2900 "12:34:56.789012+05:30"
2903 -- Test .timestamp()
2904 select jsonb_path_query('null', '$.timestamp()');
2905 ERROR: jsonpath item method .timestamp() can only be applied to a string
2906 select jsonb_path_query('true', '$.timestamp()');
2907 ERROR: jsonpath item method .timestamp() can only be applied to a string
2908 select jsonb_path_query('1', '$.timestamp()');
2909 ERROR: jsonpath item method .timestamp() can only be applied to a string
2910 select jsonb_path_query('[]', '$.timestamp()');
2915 select jsonb_path_query('[]', 'strict $.timestamp()');
2916 ERROR: jsonpath item method .timestamp() can only be applied to a string
2917 select jsonb_path_query('{}', '$.timestamp()');
2918 ERROR: jsonpath item method .timestamp() can only be applied to a string
2919 select jsonb_path_query('"bogus"', '$.timestamp()');
2920 ERROR: timestamp format is not recognized: "bogus"
2921 select jsonb '"2023-08-15 12:34:56"' @? '$.timestamp()';
2927 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp()');
2929 -----------------------
2930 "2023-08-15T12:34:56"
2933 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp().type()');
2935 -------------------------------
2936 "timestamp without time zone"
2939 select jsonb_path_query('"2023-08-15"', '$.timestamp()');
2941 -----------------------
2942 "2023-08-15T00:00:00"
2945 select jsonb_path_query('"12:34:56"', '$.timestamp()');
2946 ERROR: timestamp format is not recognized: "12:34:56"
2947 select jsonb_path_query('"12:34:56 +05:30"', '$.timestamp()');
2948 ERROR: timestamp format is not recognized: "12:34:56 +05:30"
2949 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(-1)');
2950 ERROR: syntax error at or near "-" of jsonpath input
2951 LINE 1: ...ect jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timesta...
2953 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(2.0)');
2954 ERROR: syntax error at or near "2.0" of jsonpath input
2955 LINE 1: ...ect jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timesta...
2957 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(12345678901)');
2958 ERROR: time precision of jsonpath item method .timestamp() is out of range for type integer
2959 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(0)');
2961 -----------------------
2962 "2023-08-15T12:34:57"
2965 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(2)');
2967 --------------------------
2968 "2023-08-15T12:34:56.79"
2971 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(5)');
2973 ---------------------------
2974 "2023-08-15T12:34:56.789"
2977 select jsonb_path_query('"2023-08-15 12:34:56.789"', '$.timestamp(10)');
2978 WARNING: TIMESTAMP(10) precision reduced to maximum allowed, 6
2980 ---------------------------
2981 "2023-08-15T12:34:56.789"
2984 select jsonb_path_query('"2023-08-15 12:34:56.789012"', '$.timestamp(8)');
2985 WARNING: TIMESTAMP(8) precision reduced to maximum allowed, 6
2987 ------------------------------
2988 "2023-08-15T12:34:56.789012"
2991 -- Test .timestamp_tz()
2992 select jsonb_path_query('null', '$.timestamp_tz()');
2993 ERROR: jsonpath item method .timestamp_tz() can only be applied to a string
2994 select jsonb_path_query('true', '$.timestamp_tz()');
2995 ERROR: jsonpath item method .timestamp_tz() can only be applied to a string
2996 select jsonb_path_query('1', '$.timestamp_tz()');
2997 ERROR: jsonpath item method .timestamp_tz() can only be applied to a string
2998 select jsonb_path_query('[]', '$.timestamp_tz()');
3003 select jsonb_path_query('[]', 'strict $.timestamp_tz()');
3004 ERROR: jsonpath item method .timestamp_tz() can only be applied to a string
3005 select jsonb_path_query('{}', '$.timestamp_tz()');
3006 ERROR: jsonpath item method .timestamp_tz() can only be applied to a string
3007 select jsonb_path_query('"bogus"', '$.timestamp_tz()');
3008 ERROR: timestamp_tz format is not recognized: "bogus"
3009 select jsonb '"2023-08-15 12:34:56 +05:30"' @? '$.timestamp_tz()';
3015 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp_tz()');
3017 -----------------------------
3018 "2023-08-15T12:34:56+05:30"
3021 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp_tz().type()');
3023 ----------------------------
3024 "timestamp with time zone"
3027 select jsonb_path_query('"2023-08-15"', '$.timestamp_tz()');
3028 ERROR: cannot convert value from date to timestamptz without time zone usage
3029 HINT: Use *_tz() function for time zone support.
3030 select jsonb_path_query_tz('"2023-08-15"', '$.timestamp_tz()'); -- should work
3032 -----------------------------
3033 "2023-08-15T00:00:00-07:00"
3036 select jsonb_path_query('"12:34:56"', '$.timestamp_tz()');
3037 ERROR: timestamp_tz format is not recognized: "12:34:56"
3038 select jsonb_path_query('"12:34:56 +05:30"', '$.timestamp_tz()');
3039 ERROR: timestamp_tz format is not recognized: "12:34:56 +05:30"
3040 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(-1)');
3041 ERROR: syntax error at or near "-" of jsonpath input
3042 LINE 1: ...nb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timesta...
3044 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(2.0)');
3045 ERROR: syntax error at or near "2.0" of jsonpath input
3046 LINE 1: ...nb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timesta...
3048 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(12345678901)');
3049 ERROR: time precision of jsonpath item method .timestamp_tz() is out of range for type integer
3050 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(0)');
3052 -----------------------------
3053 "2023-08-15T12:34:57+05:30"
3056 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(2)');
3058 --------------------------------
3059 "2023-08-15T12:34:56.79+05:30"
3062 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(5)');
3064 ---------------------------------
3065 "2023-08-15T12:34:56.789+05:30"
3068 select jsonb_path_query('"2023-08-15 12:34:56.789 +05:30"', '$.timestamp_tz(10)');
3069 WARNING: TIMESTAMP(10) WITH TIME ZONE precision reduced to maximum allowed, 6
3071 ---------------------------------
3072 "2023-08-15T12:34:56.789+05:30"
3075 select jsonb_path_query('"2023-08-15 12:34:56.789012 +05:30"', '$.timestamp_tz(8)');
3076 WARNING: TIMESTAMP(8) WITH TIME ZONE precision reduced to maximum allowed, 6
3078 ------------------------------------
3079 "2023-08-15T12:34:56.789012+05:30"
3082 set time zone '+00';
3083 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time()');
3084 ERROR: cannot convert value from timestamptz to time without time zone usage
3085 HINT: Use *_tz() function for time zone support.
3086 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.time()'); -- should work
3088 ---------------------
3092 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time_tz()');
3098 select jsonb_path_query('"12:34:56"', '$.time_tz()');
3099 ERROR: cannot convert value from time to timetz without time zone usage
3100 HINT: Use *_tz() function for time zone support.
3101 select jsonb_path_query_tz('"12:34:56"', '$.time_tz()'); -- should work
3103 ---------------------
3107 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp()');
3108 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3109 HINT: Use *_tz() function for time zone support.
3110 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.timestamp()'); -- should work
3112 -----------------------
3113 "2023-08-15T07:04:56"
3116 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp_tz()');
3117 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3118 HINT: Use *_tz() function for time zone support.
3119 select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz()'); -- should work
3121 -----------------------------
3122 "2023-08-15T12:34:56+00:00"
3125 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")');
3127 -----------------------
3128 "2017-03-10T12:34:00"
3131 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3132 ERROR: input string is too short for datetime format
3133 select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3135 -----------------------------
3136 "2017-03-10T12:34:00+05:00"
3139 select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3141 -----------------------------
3142 "2017-03-10T12:34:00-05:00"
3145 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
3147 -----------------------------
3148 "2017-03-10T12:34:00+05:20"
3151 select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
3153 -----------------------------
3154 "2017-03-10T12:34:00-05:20"
3157 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")');
3163 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")');
3164 ERROR: input string is too short for datetime format
3165 select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")');
3171 select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")');
3177 select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")');
3183 select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")');
3189 set time zone '+10';
3190 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time()');
3191 ERROR: cannot convert value from timestamptz to time without time zone usage
3192 HINT: Use *_tz() function for time zone support.
3193 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.time()'); -- should work
3195 ---------------------
3199 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time_tz()');
3205 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp()');
3206 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3207 HINT: Use *_tz() function for time zone support.
3208 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.timestamp()'); -- should work
3210 -----------------------
3211 "2023-08-15T17:04:56"
3214 select jsonb_path_query('"2023-08-15 12:34:56"', '$.timestamp_tz()');
3215 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3216 HINT: Use *_tz() function for time zone support.
3217 select jsonb_path_query_tz('"2023-08-15 12:34:56"', '$.timestamp_tz()'); -- should work
3219 -----------------------------
3220 "2023-08-15T12:34:56+10:00"
3223 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp_tz()');
3225 -----------------------------
3226 "2023-08-15T12:34:56+05:30"
3229 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI")');
3231 -----------------------
3232 "2017-03-10T12:34:00"
3235 select jsonb_path_query('"10-03-2017 12:34"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3236 ERROR: input string is too short for datetime format
3237 select jsonb_path_query('"10-03-2017 12:34 +05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3239 -----------------------------
3240 "2017-03-10T12:34:00+05:00"
3243 select jsonb_path_query('"10-03-2017 12:34 -05"', '$.datetime("dd-mm-yyyy HH24:MI TZH")');
3245 -----------------------------
3246 "2017-03-10T12:34:00-05:00"
3249 select jsonb_path_query('"10-03-2017 12:34 +05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
3251 -----------------------------
3252 "2017-03-10T12:34:00+05:20"
3255 select jsonb_path_query('"10-03-2017 12:34 -05:20"', '$.datetime("dd-mm-yyyy HH24:MI TZH:TZM")');
3257 -----------------------------
3258 "2017-03-10T12:34:00-05:20"
3261 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI")');
3267 select jsonb_path_query('"12:34"', '$.datetime("HH24:MI TZH")');
3268 ERROR: input string is too short for datetime format
3269 select jsonb_path_query('"12:34 +05"', '$.datetime("HH24:MI TZH")');
3275 select jsonb_path_query('"12:34 -05"', '$.datetime("HH24:MI TZH")');
3281 select jsonb_path_query('"12:34 +05:20"', '$.datetime("HH24:MI TZH:TZM")');
3287 select jsonb_path_query('"12:34 -05:20"', '$.datetime("HH24:MI TZH:TZM")');
3293 set time zone default;
3294 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time()');
3295 ERROR: cannot convert value from timestamptz to time without time zone usage
3296 HINT: Use *_tz() function for time zone support.
3297 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.time()'); -- should work
3299 ---------------------
3303 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.time_tz()');
3309 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp()');
3310 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3311 HINT: Use *_tz() function for time zone support.
3312 select jsonb_path_query_tz('"2023-08-15 12:34:56 +05:30"', '$.timestamp()'); -- should work
3314 -----------------------
3315 "2023-08-15T00:04:56"
3318 select jsonb_path_query('"2023-08-15 12:34:56 +05:30"', '$.timestamp_tz()');
3320 -----------------------------
3321 "2023-08-15T12:34:56+05:30"
3324 select jsonb_path_query('"2017-03-10"', '$.datetime().type()');
3330 select jsonb_path_query('"2017-03-10"', '$.datetime()');
3336 select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime().type()');
3338 -------------------------------
3339 "timestamp without time zone"
3342 select jsonb_path_query('"2017-03-10 12:34:56"', '$.datetime()');
3344 -----------------------
3345 "2017-03-10T12:34:56"
3348 select jsonb_path_query('"2017-03-10 12:34:56+3"', '$.datetime().type()');
3350 ----------------------------
3351 "timestamp with time zone"
3354 select jsonb_path_query('"2017-03-10 12:34:56+3"', '$.datetime()');
3356 -----------------------------
3357 "2017-03-10T12:34:56+03:00"
3360 select jsonb_path_query('"2017-03-10 12:34:56+3:10"', '$.datetime().type()');
3362 ----------------------------
3363 "timestamp with time zone"
3366 select jsonb_path_query('"2017-03-10 12:34:56+3:10"', '$.datetime()');
3368 -----------------------------
3369 "2017-03-10T12:34:56+03:10"
3372 select jsonb_path_query('"2017-03-10T12:34:56+3:10"', '$.datetime()');
3374 -----------------------------
3375 "2017-03-10T12:34:56+03:10"
3378 select jsonb_path_query('"2017-03-10t12:34:56+3:10"', '$.datetime()');
3379 ERROR: datetime format is not recognized: "2017-03-10t12:34:56+3:10"
3380 HINT: Use a datetime template argument to specify the input data format.
3381 select jsonb_path_query('"2017-03-10 12:34:56.789+3:10"', '$.datetime()');
3383 ---------------------------------
3384 "2017-03-10T12:34:56.789+03:10"
3387 select jsonb_path_query('"2017-03-10T12:34:56.789+3:10"', '$.datetime()');
3389 ---------------------------------
3390 "2017-03-10T12:34:56.789+03:10"
3393 select jsonb_path_query('"2017-03-10t12:34:56.789+3:10"', '$.datetime()');
3394 ERROR: datetime format is not recognized: "2017-03-10t12:34:56.789+3:10"
3395 HINT: Use a datetime template argument to specify the input data format.
3396 select jsonb_path_query('"2017-03-10T12:34:56.789EST"', '$.datetime()');
3398 ---------------------------------
3399 "2017-03-10T12:34:56.789-05:00"
3402 select jsonb_path_query('"2017-03-10T12:34:56.789Z"', '$.datetime()');
3404 ---------------------------------
3405 "2017-03-10T12:34:56.789+00:00"
3408 select jsonb_path_query('"12:34:56"', '$.datetime().type()');
3410 --------------------------
3411 "time without time zone"
3414 select jsonb_path_query('"12:34:56"', '$.datetime()');
3420 select jsonb_path_query('"12:34:56+3"', '$.datetime().type()');
3422 -----------------------
3423 "time with time zone"
3426 select jsonb_path_query('"12:34:56+3"', '$.datetime()');
3432 select jsonb_path_query('"12:34:56+3:10"', '$.datetime().type()');
3434 -----------------------
3435 "time with time zone"
3438 select jsonb_path_query('"12:34:56+3:10"', '$.datetime()');
3444 set time zone '+00';
3446 select jsonb_path_query(
3447 '["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"]',
3448 '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))');
3449 ERROR: cannot convert value from date to timestamptz without time zone usage
3450 HINT: Use *_tz() function for time zone support.
3451 select jsonb_path_query(
3452 '["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"]',
3453 '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))');
3454 ERROR: cannot convert value from date to timestamptz without time zone usage
3455 HINT: Use *_tz() function for time zone support.
3456 select jsonb_path_query(
3457 '["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"]',
3458 '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))');
3459 ERROR: cannot convert value from date to timestamptz without time zone usage
3460 HINT: Use *_tz() function for time zone support.
3461 select jsonb_path_query_tz(
3462 '["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"]',
3463 '$[*].datetime() ? (@ == "10.03.2017".datetime("dd.mm.yyyy"))');
3465 -----------------------------
3467 "2017-03-10T00:00:00"
3468 "2017-03-10T03:00:00+03:00"
3471 select jsonb_path_query_tz(
3472 '["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"]',
3473 '$[*].datetime() ? (@ >= "10.03.2017".datetime("dd.mm.yyyy"))');
3475 -----------------------------
3478 "2017-03-10T00:00:00"
3479 "2017-03-10T12:34:56"
3480 "2017-03-10T03:00:00+03:00"
3483 select jsonb_path_query_tz(
3484 '["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"]',
3485 '$[*].datetime() ? (@ < "10.03.2017".datetime("dd.mm.yyyy"))');
3487 -----------------------------
3489 "2017-03-10T01:02:03+04:00"
3492 select jsonb_path_query_tz(
3493 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3494 '$[*].datetime() ? (@ == "2017-03-10".date())');
3496 -----------------------------
3498 "2017-03-10T00:00:00"
3499 "2017-03-10T03:00:00+03:00"
3502 select jsonb_path_query_tz(
3503 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3504 '$[*].datetime() ? (@ >= "2017-03-10".date())');
3506 -----------------------------
3509 "2017-03-10T00:00:00"
3510 "2017-03-10T12:34:56"
3511 "2017-03-10T03:00:00+03:00"
3514 select jsonb_path_query_tz(
3515 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3516 '$[*].datetime() ? (@ < "2017-03-10".date())');
3518 -----------------------------
3520 "2017-03-10T01:02:03+04:00"
3523 select jsonb_path_query(
3524 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3525 '$[*].date() ? (@ == "2017-03-10".date())');
3526 ERROR: cannot convert value from timestamptz to date without time zone usage
3527 HINT: Use *_tz() function for time zone support.
3528 select jsonb_path_query(
3529 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3530 '$[*].date() ? (@ >= "2017-03-10".date())');
3531 ERROR: cannot convert value from timestamptz to date without time zone usage
3532 HINT: Use *_tz() function for time zone support.
3533 select jsonb_path_query(
3534 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3535 '$[*].date() ? (@ < "2017-03-10".date())');
3536 ERROR: cannot convert value from timestamptz to date without time zone usage
3537 HINT: Use *_tz() function for time zone support.
3538 select jsonb_path_query_tz(
3539 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3540 '$[*].date() ? (@ == "2017-03-10".date())');
3542 ---------------------
3549 select jsonb_path_query_tz(
3550 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3551 '$[*].date() ? (@ >= "2017-03-10".date())');
3553 ---------------------
3561 select jsonb_path_query_tz(
3562 '["2017-03-10", "2017-03-11", "2017-03-09", "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"]',
3563 '$[*].date() ? (@ < "2017-03-10".date())');
3565 ---------------------
3571 select jsonb_path_query(
3572 '["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"]',
3573 '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))');
3574 ERROR: cannot convert value from time to timetz without time zone usage
3575 HINT: Use *_tz() function for time zone support.
3576 select jsonb_path_query(
3577 '["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"]',
3578 '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))');
3579 ERROR: cannot convert value from time to timetz without time zone usage
3580 HINT: Use *_tz() function for time zone support.
3581 select jsonb_path_query(
3582 '["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"]',
3583 '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))');
3584 ERROR: cannot convert value from time to timetz without time zone usage
3585 HINT: Use *_tz() function for time zone support.
3586 select jsonb_path_query_tz(
3587 '["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"]',
3588 '$[*].datetime() ? (@ == "12:35".datetime("HH24:MI"))');
3590 ---------------------
3595 select jsonb_path_query_tz(
3596 '["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"]',
3597 '$[*].datetime() ? (@ >= "12:35".datetime("HH24:MI"))');
3599 ---------------------
3605 select jsonb_path_query_tz(
3606 '["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"]',
3607 '$[*].datetime() ? (@ < "12:35".datetime("HH24:MI"))');
3609 ---------------------
3615 select jsonb_path_query_tz(
3616 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3617 '$[*].datetime() ? (@ == "12:35:00".time())');
3619 ---------------------
3624 select jsonb_path_query_tz(
3625 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3626 '$[*].datetime() ? (@ >= "12:35:00".time())');
3628 ---------------------
3634 select jsonb_path_query_tz(
3635 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3636 '$[*].datetime() ? (@ < "12:35:00".time())');
3638 ---------------------
3644 select jsonb_path_query(
3645 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3646 '$[*].time() ? (@ == "12:35:00".time())');
3647 ERROR: cannot convert value from timetz to time without time zone usage
3648 HINT: Use *_tz() function for time zone support.
3649 select jsonb_path_query(
3650 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3651 '$[*].time() ? (@ >= "12:35:00".time())');
3652 ERROR: cannot convert value from timetz to time without time zone usage
3653 HINT: Use *_tz() function for time zone support.
3654 select jsonb_path_query(
3655 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3656 '$[*].time() ? (@ < "12:35:00".time())');
3657 ERROR: cannot convert value from timetz to time without time zone usage
3658 HINT: Use *_tz() function for time zone support.
3659 select jsonb_path_query(
3660 '["12:34:00.123", "12:35:00.123", "12:36:00.1123", "12:35:00.1123+00", "12:35:00.123+01", "13:35:00.123+01", "2017-03-10 12:35:00.1", "2017-03-10 12:35:00.123+01"]',
3661 '$[*].time(2) ? (@ >= "12:35:00.123".time(2))');
3662 ERROR: cannot convert value from timetz to time without time zone usage
3663 HINT: Use *_tz() function for time zone support.
3664 select jsonb_path_query_tz(
3665 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3666 '$[*].time() ? (@ == "12:35:00".time())');
3668 ---------------------
3675 select jsonb_path_query_tz(
3676 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3677 '$[*].time() ? (@ >= "12:35:00".time())');
3679 ---------------------
3688 select jsonb_path_query_tz(
3689 '["12:34:00", "12:35:00", "12:36:00", "12:35:00+00", "12:35:00+01", "13:35:00+01", "2017-03-10 12:35:00", "2017-03-10 12:35:00+01"]',
3690 '$[*].time() ? (@ < "12:35:00".time())');
3692 ---------------------
3697 select jsonb_path_query_tz(
3698 '["12:34:00.123", "12:35:00.123", "12:36:00.1123", "12:35:00.1123+00", "12:35:00.123+01", "13:35:00.123+01", "2017-03-10 12:35:00.1", "2017-03-10 12:35:00.123+01"]',
3699 '$[*].time(2) ? (@ >= "12:35:00.123".time(2))');
3701 ---------------------
3708 -- timetz comparison
3709 select jsonb_path_query(
3710 '["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"]',
3711 '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))');
3712 ERROR: cannot convert value from time to timetz without time zone usage
3713 HINT: Use *_tz() function for time zone support.
3714 select jsonb_path_query(
3715 '["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"]',
3716 '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))');
3717 ERROR: cannot convert value from time to timetz without time zone usage
3718 HINT: Use *_tz() function for time zone support.
3719 select jsonb_path_query(
3720 '["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"]',
3721 '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))');
3722 ERROR: cannot convert value from time to timetz without time zone usage
3723 HINT: Use *_tz() function for time zone support.
3724 select jsonb_path_query_tz(
3725 '["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"]',
3726 '$[*].datetime() ? (@ == "12:35 +1".datetime("HH24:MI TZH"))');
3728 ---------------------
3732 select jsonb_path_query_tz(
3733 '["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"]',
3734 '$[*].datetime() ? (@ >= "12:35 +1".datetime("HH24:MI TZH"))');
3736 ---------------------
3744 select jsonb_path_query_tz(
3745 '["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"]',
3746 '$[*].datetime() ? (@ < "12:35 +1".datetime("HH24:MI TZH"))');
3748 ---------------------
3754 select jsonb_path_query_tz(
3755 '["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 12:35:00 +1"]',
3756 '$[*].datetime() ? (@ == "12:35:00 +1".time_tz())');
3758 ---------------------
3762 select jsonb_path_query_tz(
3763 '["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 12:35:00 +1"]',
3764 '$[*].datetime() ? (@ >= "12:35:00 +1".time_tz())');
3766 ---------------------
3774 select jsonb_path_query_tz(
3775 '["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 12:35:00 +1"]',
3776 '$[*].datetime() ? (@ < "12:35:00 +1".time_tz())');
3778 ---------------------
3784 select jsonb_path_query(
3785 '["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 12:35:00 +1"]',
3786 '$[*].time_tz() ? (@ == "12:35:00 +1".time_tz())');
3787 ERROR: cannot convert value from time to timetz without time zone usage
3788 HINT: Use *_tz() function for time zone support.
3789 select jsonb_path_query(
3790 '["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 12:35:00 +1"]',
3791 '$[*].time_tz() ? (@ >= "12:35:00 +1".time_tz())');
3792 ERROR: cannot convert value from time to timetz without time zone usage
3793 HINT: Use *_tz() function for time zone support.
3794 select jsonb_path_query(
3795 '["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 12:35:00 +1"]',
3796 '$[*].time_tz() ? (@ < "12:35:00 +1".time_tz())');
3797 ERROR: cannot convert value from time to timetz without time zone usage
3798 HINT: Use *_tz() function for time zone support.
3799 select jsonb_path_query(
3800 '["12:34:00.123+01", "12:35:00.123+01", "12:36:00.1123+01", "12:35:00.1123+02", "12:35:00.123-02", "10:35:00.123", "11:35:00.1", "12:35:00.123", "2017-03-10 12:35:00.123 +1"]',
3801 '$[*].time_tz(2) ? (@ >= "12:35:00.123 +1".time_tz(2))');
3802 ERROR: cannot convert value from time to timetz without time zone usage
3803 HINT: Use *_tz() function for time zone support.
3804 select jsonb_path_query_tz(
3805 '["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 12:35:00 +1"]',
3806 '$[*].time_tz() ? (@ == "12:35:00 +1".time_tz())');
3808 ---------------------
3812 select jsonb_path_query_tz(
3813 '["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 12:35:00 +1"]',
3814 '$[*].time_tz() ? (@ >= "12:35:00 +1".time_tz())');
3816 ---------------------
3825 select jsonb_path_query_tz(
3826 '["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 12:35:00 +1"]',
3827 '$[*].time_tz() ? (@ < "12:35:00 +1".time_tz())');
3829 ---------------------
3835 select jsonb_path_query_tz(
3836 '["12:34:00.123+01", "12:35:00.123+01", "12:36:00.1123+01", "12:35:00.1123+02", "12:35:00.123-02", "10:35:00.123", "11:35:00.1", "12:35:00.123", "2017-03-10 12:35:00.123 +1"]',
3837 '$[*].time_tz(2) ? (@ >= "12:35:00.123 +1".time_tz(2))');
3839 ---------------------
3847 -- timestamp comparison
3848 select jsonb_path_query(
3849 '["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"]',
3850 '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3851 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3852 HINT: Use *_tz() function for time zone support.
3853 select jsonb_path_query(
3854 '["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"]',
3855 '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3856 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3857 HINT: Use *_tz() function for time zone support.
3858 select jsonb_path_query(
3859 '["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"]',
3860 '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3861 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3862 HINT: Use *_tz() function for time zone support.
3863 select jsonb_path_query_tz(
3864 '["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"]',
3865 '$[*].datetime() ? (@ == "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3867 -----------------------------
3868 "2017-03-10T12:35:00"
3869 "2017-03-10T13:35:00+01:00"
3872 select jsonb_path_query_tz(
3873 '["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"]',
3874 '$[*].datetime() ? (@ >= "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3876 -----------------------------
3877 "2017-03-10T12:35:00"
3878 "2017-03-10T12:36:00"
3879 "2017-03-10T13:35:00+01:00"
3880 "2017-03-10T12:35:00-01:00"
3884 select jsonb_path_query_tz(
3885 '["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"]',
3886 '$[*].datetime() ? (@ < "10.03.2017 12:35".datetime("dd.mm.yyyy HH24:MI"))');
3888 -----------------------------
3889 "2017-03-10T12:34:00"
3890 "2017-03-10T12:35:00+01:00"
3894 select jsonb_path_query_tz(
3895 '["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"]',
3896 '$[*].datetime() ? (@ == "2017-03-10 12:35:00".timestamp())');
3898 -----------------------------
3899 "2017-03-10T12:35:00"
3900 "2017-03-10T13:35:00+01:00"
3903 select jsonb_path_query_tz(
3904 '["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"]',
3905 '$[*].datetime() ? (@ >= "2017-03-10 12:35:00".timestamp())');
3907 -----------------------------
3908 "2017-03-10T12:35:00"
3909 "2017-03-10T12:36:00"
3910 "2017-03-10T13:35:00+01:00"
3911 "2017-03-10T12:35:00-01:00"
3915 select jsonb_path_query_tz(
3916 '["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"]',
3917 '$[*].datetime() ? (@ < "2017-03-10 12:35:00".timestamp())');
3919 -----------------------------
3920 "2017-03-10T12:34:00"
3921 "2017-03-10T12:35:00+01:00"
3925 select jsonb_path_query(
3926 '["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"]',
3927 '$[*].timestamp() ? (@ == "2017-03-10 12:35:00".timestamp())');
3928 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3929 HINT: Use *_tz() function for time zone support.
3930 select jsonb_path_query(
3931 '["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"]',
3932 '$[*].timestamp() ? (@ >= "2017-03-10 12:35:00".timestamp())');
3933 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3934 HINT: Use *_tz() function for time zone support.
3935 select jsonb_path_query(
3936 '["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"]',
3937 '$[*].timestamp() ? (@ < "2017-03-10 12:35:00".timestamp())');
3938 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3939 HINT: Use *_tz() function for time zone support.
3940 select jsonb_path_query(
3941 '["2017-03-10 12:34:00.123", "2017-03-10 12:35:00.123", "2017-03-10 12:36:00.1123", "2017-03-10 12:35:00.1123+01", "2017-03-10 13:35:00.123+01", "2017-03-10 12:35:00.1-01", "2017-03-10", "2017-03-11"]',
3942 '$[*].timestamp(2) ? (@ >= "2017-03-10 12:35:00.123".timestamp(2))');
3943 ERROR: cannot convert value from timestamptz to timestamp without time zone usage
3944 HINT: Use *_tz() function for time zone support.
3945 select jsonb_path_query_tz(
3946 '["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"]',
3947 '$[*].timestamp() ? (@ == "2017-03-10 12:35:00".timestamp())');
3949 -----------------------
3950 "2017-03-10T12:35:00"
3951 "2017-03-10T12:35:00"
3954 select jsonb_path_query_tz(
3955 '["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"]',
3956 '$[*].timestamp() ? (@ >= "2017-03-10 12:35:00".timestamp())');
3958 -----------------------
3959 "2017-03-10T12:35:00"
3960 "2017-03-10T12:36:00"
3961 "2017-03-10T12:35:00"
3962 "2017-03-10T13:35:00"
3963 "2017-03-11T00:00:00"
3966 select jsonb_path_query_tz(
3967 '["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"]',
3968 '$[*].timestamp() ? (@ < "2017-03-10 12:35:00".timestamp())');
3970 -----------------------
3971 "2017-03-10T12:34:00"
3972 "2017-03-10T11:35:00"
3973 "2017-03-10T00:00:00"
3976 select jsonb_path_query_tz(
3977 '["2017-03-10 12:34:00.123", "2017-03-10 12:35:00.123", "2017-03-10 12:36:00.1123", "2017-03-10 12:35:00.1123+01", "2017-03-10 13:35:00.123+01", "2017-03-10 12:35:00.1-01", "2017-03-10", "2017-03-11"]',
3978 '$[*].timestamp(2) ? (@ >= "2017-03-10 12:35:00.123".timestamp(2))');
3980 --------------------------
3981 "2017-03-10T12:35:00.12"
3982 "2017-03-10T12:36:00.11"
3983 "2017-03-10T12:35:00.12"
3984 "2017-03-10T13:35:00.1"
3985 "2017-03-11T00:00:00"
3988 -- timestamptz comparison
3989 select jsonb_path_query(
3990 '["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"]',
3991 '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
3992 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3993 HINT: Use *_tz() function for time zone support.
3994 select jsonb_path_query(
3995 '["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"]',
3996 '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
3997 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
3998 HINT: Use *_tz() function for time zone support.
3999 select jsonb_path_query(
4000 '["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"]',
4001 '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
4002 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
4003 HINT: Use *_tz() function for time zone support.
4004 select jsonb_path_query_tz(
4005 '["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"]',
4006 '$[*].datetime() ? (@ == "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
4008 -----------------------------
4009 "2017-03-10T12:35:00+01:00"
4010 "2017-03-10T11:35:00"
4013 select jsonb_path_query_tz(
4014 '["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"]',
4015 '$[*].datetime() ? (@ >= "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
4017 -----------------------------
4018 "2017-03-10T12:35:00+01:00"
4019 "2017-03-10T12:36:00+01:00"
4020 "2017-03-10T12:35:00-02:00"
4021 "2017-03-10T11:35:00"
4022 "2017-03-10T12:35:00"
4026 select jsonb_path_query_tz(
4027 '["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"]',
4028 '$[*].datetime() ? (@ < "10.03.2017 12:35 +1".datetime("dd.mm.yyyy HH24:MI TZH"))');
4030 -----------------------------
4031 "2017-03-10T12:34:00+01:00"
4032 "2017-03-10T12:35:00+02:00"
4033 "2017-03-10T10:35:00"
4037 select jsonb_path_query_tz(
4038 '["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"]',
4039 '$[*].datetime() ? (@ == "2017-03-10 12:35:00 +1".timestamp_tz())');
4041 -----------------------------
4042 "2017-03-10T12:35:00+01:00"
4043 "2017-03-10T11:35:00"
4046 select jsonb_path_query_tz(
4047 '["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"]',
4048 '$[*].datetime() ? (@ >= "2017-03-10 12:35:00 +1".timestamp_tz())');
4050 -----------------------------
4051 "2017-03-10T12:35:00+01:00"
4052 "2017-03-10T12:36:00+01:00"
4053 "2017-03-10T12:35:00-02:00"
4054 "2017-03-10T11:35:00"
4055 "2017-03-10T12:35:00"
4059 select jsonb_path_query_tz(
4060 '["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"]',
4061 '$[*].datetime() ? (@ < "2017-03-10 12:35:00 +1".timestamp_tz())');
4063 -----------------------------
4064 "2017-03-10T12:34:00+01:00"
4065 "2017-03-10T12:35:00+02:00"
4066 "2017-03-10T10:35:00"
4070 select jsonb_path_query(
4071 '["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"]',
4072 '$[*].timestamp_tz() ? (@ == "2017-03-10 12:35:00 +1".timestamp_tz())');
4073 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
4074 HINT: Use *_tz() function for time zone support.
4075 select jsonb_path_query(
4076 '["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"]',
4077 '$[*].timestamp_tz() ? (@ >= "2017-03-10 12:35:00 +1".timestamp_tz())');
4078 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
4079 HINT: Use *_tz() function for time zone support.
4080 select jsonb_path_query(
4081 '["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"]',
4082 '$[*].timestamp_tz() ? (@ < "2017-03-10 12:35:00 +1".timestamp_tz())');
4083 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
4084 HINT: Use *_tz() function for time zone support.
4085 select jsonb_path_query(
4086 '["2017-03-10 12:34:00.123+01", "2017-03-10 12:35:00.123+01", "2017-03-10 12:36:00.1123+01", "2017-03-10 12:35:00.1123+02", "2017-03-10 12:35:00.123-02", "2017-03-10 10:35:00.123", "2017-03-10 11:35:00.1", "2017-03-10 12:35:00.123", "2017-03-10", "2017-03-11"]',
4087 '$[*].timestamp_tz(2) ? (@ >= "2017-03-10 12:35:00.123 +1".timestamp_tz(2))');
4088 ERROR: cannot convert value from timestamp to timestamptz without time zone usage
4089 HINT: Use *_tz() function for time zone support.
4090 select jsonb_path_query_tz(
4091 '["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"]',
4092 '$[*].timestamp_tz() ? (@ == "2017-03-10 12:35:00 +1".timestamp_tz())');
4094 -----------------------------
4095 "2017-03-10T12:35:00+01:00"
4096 "2017-03-10T11:35:00+00:00"
4099 select jsonb_path_query_tz(
4100 '["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"]',
4101 '$[*].timestamp_tz() ? (@ >= "2017-03-10 12:35:00 +1".timestamp_tz())');
4103 -----------------------------
4104 "2017-03-10T12:35:00+01:00"
4105 "2017-03-10T12:36:00+01:00"
4106 "2017-03-10T12:35:00-02:00"
4107 "2017-03-10T11:35:00+00:00"
4108 "2017-03-10T12:35:00+00:00"
4109 "2017-03-11T00:00:00+00:00"
4112 select jsonb_path_query_tz(
4113 '["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"]',
4114 '$[*].timestamp_tz() ? (@ < "2017-03-10 12:35:00 +1".timestamp_tz())');
4116 -----------------------------
4117 "2017-03-10T12:34:00+01:00"
4118 "2017-03-10T12:35:00+02:00"
4119 "2017-03-10T10:35:00+00:00"
4120 "2017-03-10T00:00:00+00:00"
4123 select jsonb_path_query_tz(
4124 '["2017-03-10 12:34:00.123+01", "2017-03-10 12:35:00.123+01", "2017-03-10 12:36:00.1123+01", "2017-03-10 12:35:00.1123+02", "2017-03-10 12:35:00.123-02", "2017-03-10 10:35:00.123", "2017-03-10 11:35:00.1", "2017-03-10 12:35:00.123", "2017-03-10", "2017-03-11"]',
4125 '$[*].timestamp_tz(2) ? (@ >= "2017-03-10 12:35:00.123 +1".timestamp_tz(2))');
4127 --------------------------------
4128 "2017-03-10T12:35:00.12+01:00"
4129 "2017-03-10T12:36:00.11+01:00"
4130 "2017-03-10T12:35:00.12-02:00"
4131 "2017-03-10T12:35:00.12+00:00"
4132 "2017-03-11T00:00:00+00:00"
4135 -- overflow during comparison
4136 select jsonb_path_query('"1000000-01-01"', '$.datetime() > "2020-01-01 12:00:00".datetime()'::jsonpath);
4142 set time zone default;
4143 -- jsonpath operators
4144 SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*]');
4151 SELECT jsonb_path_query('[{"a": 1}, {"a": 2}]', '$[*] ? (@.a > 10)');
4156 SELECT jsonb_path_query('[{"a": 1}]', '$undefined_var');
4157 ERROR: could not find jsonpath variable "undefined_var"
4158 SELECT jsonb_path_query('[{"a": 1}]', 'false');
4164 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
4165 ERROR: JSON object does not contain key "a"
4166 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a');
4167 jsonb_path_query_array
4168 ------------------------
4172 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
4173 jsonb_path_query_array
4174 ------------------------
4178 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
4179 jsonb_path_query_array
4180 ------------------------
4184 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
4185 jsonb_path_query_array
4186 ------------------------
4190 SELECT jsonb_path_query_array('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
4191 jsonb_path_query_array
4192 ------------------------
4196 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a');
4197 ERROR: JSON object does not contain key "a"
4198 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {}]', 'strict $[*].a', silent => true);
4199 jsonb_path_query_first
4200 ------------------------
4204 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a');
4205 jsonb_path_query_first
4206 ------------------------
4210 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ == 1)');
4211 jsonb_path_query_first
4212 ------------------------
4216 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 10)');
4217 jsonb_path_query_first
4218 ------------------------
4222 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 1, "max": 4}');
4223 jsonb_path_query_first
4224 ------------------------
4228 SELECT jsonb_path_query_first('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*].a ? (@ > $min && @ < $max)', vars => '{"min": 3, "max": 4}');
4229 jsonb_path_query_first
4230 ------------------------
4234 SELECT jsonb_path_query_first('[{"a": 1}]', '$undefined_var');
4235 ERROR: could not find jsonpath variable "undefined_var"
4236 SELECT jsonb_path_query_first('[{"a": 1}]', 'false');
4237 jsonb_path_query_first
4238 ------------------------
4242 SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*].a ? (@ > 1)';
4248 SELECT jsonb '[{"a": 1}, {"a": 2}]' @? '$[*] ? (@.a > 2)';
4254 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}]', '$[*].a ? (@ > 1)');
4260 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 1, "max": 4}');
4266 SELECT jsonb_path_exists('[{"a": 1}, {"a": 2}, {"a": 3}, {"a": 5}]', '$[*] ? (@.a > $min && @.a < $max)', vars => '{"min": 3, "max": 4}');
4272 SELECT jsonb_path_exists('[{"a": 1}]', '$undefined_var');
4273 ERROR: could not find jsonpath variable "undefined_var"
4274 SELECT jsonb_path_exists('[{"a": 1}]', 'false');
4280 SELECT jsonb_path_match('true', '$', silent => false);
4286 SELECT jsonb_path_match('false', '$', silent => false);
4292 SELECT jsonb_path_match('null', '$', silent => false);
4298 SELECT jsonb_path_match('1', '$', silent => true);
4304 SELECT jsonb_path_match('1', '$', silent => false);
4305 ERROR: single boolean result is expected
4306 SELECT jsonb_path_match('"a"', '$', silent => false);
4307 ERROR: single boolean result is expected
4308 SELECT jsonb_path_match('{}', '$', silent => false);
4309 ERROR: single boolean result is expected
4310 SELECT jsonb_path_match('[true]', '$', silent => false);
4311 ERROR: single boolean result is expected
4312 SELECT jsonb_path_match('{}', 'lax $.a', silent => false);
4313 ERROR: single boolean result is expected
4314 SELECT jsonb_path_match('{}', 'strict $.a', silent => false);
4315 ERROR: JSON object does not contain key "a"
4316 SELECT jsonb_path_match('{}', 'strict $.a', silent => true);
4322 SELECT jsonb_path_match('[true, true]', '$[*]', silent => false);
4323 ERROR: single boolean result is expected
4324 SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 1';
4330 SELECT jsonb '[{"a": 1}, {"a": 2}]' @@ '$[*].a > 2';
4336 SELECT jsonb_path_match('[{"a": 1}, {"a": 2}]', '$[*].a > 1');
4342 SELECT jsonb_path_match('[{"a": 1}]', '$undefined_var');
4343 ERROR: could not find jsonpath variable "undefined_var"
4344 SELECT jsonb_path_match('[{"a": 1}]', 'false');
4350 -- test string comparison (Unicode codepoint collation)
4353 SELECT jsonb_build_object('s', s), num
4354 FROM unnest('{"", "a", "ab", "abc", "abcd", "b", "A", "AB", "ABC", "ABc", "ABcD", "B"}'::text[]) WITH ORDINALITY AS a(s, num)
4358 jsonb_path_query_first(s1.j, '$.s < $s', vars => s2.j) lt,
4359 jsonb_path_query_first(s1.j, '$.s <= $s', vars => s2.j) le,
4360 jsonb_path_query_first(s1.j, '$.s == $s', vars => s2.j) eq,
4361 jsonb_path_query_first(s1.j, '$.s >= $s', vars => s2.j) ge,
4362 jsonb_path_query_first(s1.j, '$.s > $s', vars => s2.j) gt
4364 ORDER BY s1.num, s2.num;
4365 j | j | lt | le | eq | ge | gt
4366 ---------------+---------------+-------+-------+-------+-------+-------
4367 {"s": ""} | {"s": ""} | false | true | true | true | false
4368 {"s": ""} | {"s": "a"} | true | true | false | false | false
4369 {"s": ""} | {"s": "ab"} | true | true | false | false | false
4370 {"s": ""} | {"s": "abc"} | true | true | false | false | false
4371 {"s": ""} | {"s": "abcd"} | true | true | false | false | false
4372 {"s": ""} | {"s": "b"} | true | true | false | false | false
4373 {"s": ""} | {"s": "A"} | true | true | false | false | false
4374 {"s": ""} | {"s": "AB"} | true | true | false | false | false
4375 {"s": ""} | {"s": "ABC"} | true | true | false | false | false
4376 {"s": ""} | {"s": "ABc"} | true | true | false | false | false
4377 {"s": ""} | {"s": "ABcD"} | true | true | false | false | false
4378 {"s": ""} | {"s": "B"} | true | true | false | false | false
4379 {"s": "a"} | {"s": ""} | false | false | false | true | true
4380 {"s": "a"} | {"s": "a"} | false | true | true | true | false
4381 {"s": "a"} | {"s": "ab"} | true | true | false | false | false
4382 {"s": "a"} | {"s": "abc"} | true | true | false | false | false
4383 {"s": "a"} | {"s": "abcd"} | true | true | false | false | false
4384 {"s": "a"} | {"s": "b"} | true | true | false | false | false
4385 {"s": "a"} | {"s": "A"} | false | false | false | true | true
4386 {"s": "a"} | {"s": "AB"} | false | false | false | true | true
4387 {"s": "a"} | {"s": "ABC"} | false | false | false | true | true
4388 {"s": "a"} | {"s": "ABc"} | false | false | false | true | true
4389 {"s": "a"} | {"s": "ABcD"} | false | false | false | true | true
4390 {"s": "a"} | {"s": "B"} | false | false | false | true | true
4391 {"s": "ab"} | {"s": ""} | false | false | false | true | true
4392 {"s": "ab"} | {"s": "a"} | false | false | false | true | true
4393 {"s": "ab"} | {"s": "ab"} | false | true | true | true | false
4394 {"s": "ab"} | {"s": "abc"} | true | true | false | false | false
4395 {"s": "ab"} | {"s": "abcd"} | true | true | false | false | false
4396 {"s": "ab"} | {"s": "b"} | true | true | false | false | false
4397 {"s": "ab"} | {"s": "A"} | false | false | false | true | true
4398 {"s": "ab"} | {"s": "AB"} | false | false | false | true | true
4399 {"s": "ab"} | {"s": "ABC"} | false | false | false | true | true
4400 {"s": "ab"} | {"s": "ABc"} | false | false | false | true | true
4401 {"s": "ab"} | {"s": "ABcD"} | false | false | false | true | true
4402 {"s": "ab"} | {"s": "B"} | false | false | false | true | true
4403 {"s": "abc"} | {"s": ""} | false | false | false | true | true
4404 {"s": "abc"} | {"s": "a"} | false | false | false | true | true
4405 {"s": "abc"} | {"s": "ab"} | false | false | false | true | true
4406 {"s": "abc"} | {"s": "abc"} | false | true | true | true | false
4407 {"s": "abc"} | {"s": "abcd"} | true | true | false | false | false
4408 {"s": "abc"} | {"s": "b"} | true | true | false | false | false
4409 {"s": "abc"} | {"s": "A"} | false | false | false | true | true
4410 {"s": "abc"} | {"s": "AB"} | false | false | false | true | true
4411 {"s": "abc"} | {"s": "ABC"} | false | false | false | true | true
4412 {"s": "abc"} | {"s": "ABc"} | false | false | false | true | true
4413 {"s": "abc"} | {"s": "ABcD"} | false | false | false | true | true
4414 {"s": "abc"} | {"s": "B"} | false | false | false | true | true
4415 {"s": "abcd"} | {"s": ""} | false | false | false | true | true
4416 {"s": "abcd"} | {"s": "a"} | false | false | false | true | true
4417 {"s": "abcd"} | {"s": "ab"} | false | false | false | true | true
4418 {"s": "abcd"} | {"s": "abc"} | false | false | false | true | true
4419 {"s": "abcd"} | {"s": "abcd"} | false | true | true | true | false
4420 {"s": "abcd"} | {"s": "b"} | true | true | false | false | false
4421 {"s": "abcd"} | {"s": "A"} | false | false | false | true | true
4422 {"s": "abcd"} | {"s": "AB"} | false | false | false | true | true
4423 {"s": "abcd"} | {"s": "ABC"} | false | false | false | true | true
4424 {"s": "abcd"} | {"s": "ABc"} | false | false | false | true | true
4425 {"s": "abcd"} | {"s": "ABcD"} | false | false | false | true | true
4426 {"s": "abcd"} | {"s": "B"} | false | false | false | true | true
4427 {"s": "b"} | {"s": ""} | false | false | false | true | true
4428 {"s": "b"} | {"s": "a"} | false | false | false | true | true
4429 {"s": "b"} | {"s": "ab"} | false | false | false | true | true
4430 {"s": "b"} | {"s": "abc"} | false | false | false | true | true
4431 {"s": "b"} | {"s": "abcd"} | false | false | false | true | true
4432 {"s": "b"} | {"s": "b"} | false | true | true | true | false
4433 {"s": "b"} | {"s": "A"} | false | false | false | true | true
4434 {"s": "b"} | {"s": "AB"} | false | false | false | true | true
4435 {"s": "b"} | {"s": "ABC"} | false | false | false | true | true
4436 {"s": "b"} | {"s": "ABc"} | false | false | false | true | true
4437 {"s": "b"} | {"s": "ABcD"} | false | false | false | true | true
4438 {"s": "b"} | {"s": "B"} | false | false | false | true | true
4439 {"s": "A"} | {"s": ""} | false | false | false | true | true
4440 {"s": "A"} | {"s": "a"} | true | true | false | false | false
4441 {"s": "A"} | {"s": "ab"} | true | true | false | false | false
4442 {"s": "A"} | {"s": "abc"} | true | true | false | false | false
4443 {"s": "A"} | {"s": "abcd"} | true | true | false | false | false
4444 {"s": "A"} | {"s": "b"} | true | true | false | false | false
4445 {"s": "A"} | {"s": "A"} | false | true | true | true | false
4446 {"s": "A"} | {"s": "AB"} | true | true | false | false | false
4447 {"s": "A"} | {"s": "ABC"} | true | true | false | false | false
4448 {"s": "A"} | {"s": "ABc"} | true | true | false | false | false
4449 {"s": "A"} | {"s": "ABcD"} | true | true | false | false | false
4450 {"s": "A"} | {"s": "B"} | true | true | false | false | false
4451 {"s": "AB"} | {"s": ""} | false | false | false | true | true
4452 {"s": "AB"} | {"s": "a"} | true | true | false | false | false
4453 {"s": "AB"} | {"s": "ab"} | true | true | false | false | false
4454 {"s": "AB"} | {"s": "abc"} | true | true | false | false | false
4455 {"s": "AB"} | {"s": "abcd"} | true | true | false | false | false
4456 {"s": "AB"} | {"s": "b"} | true | true | false | false | false
4457 {"s": "AB"} | {"s": "A"} | false | false | false | true | true
4458 {"s": "AB"} | {"s": "AB"} | false | true | true | true | false
4459 {"s": "AB"} | {"s": "ABC"} | true | true | false | false | false
4460 {"s": "AB"} | {"s": "ABc"} | true | true | false | false | false
4461 {"s": "AB"} | {"s": "ABcD"} | true | true | false | false | false
4462 {"s": "AB"} | {"s": "B"} | true | true | false | false | false
4463 {"s": "ABC"} | {"s": ""} | false | false | false | true | true
4464 {"s": "ABC"} | {"s": "a"} | true | true | false | false | false
4465 {"s": "ABC"} | {"s": "ab"} | true | true | false | false | false
4466 {"s": "ABC"} | {"s": "abc"} | true | true | false | false | false
4467 {"s": "ABC"} | {"s": "abcd"} | true | true | false | false | false
4468 {"s": "ABC"} | {"s": "b"} | true | true | false | false | false
4469 {"s": "ABC"} | {"s": "A"} | false | false | false | true | true
4470 {"s": "ABC"} | {"s": "AB"} | false | false | false | true | true
4471 {"s": "ABC"} | {"s": "ABC"} | false | true | true | true | false
4472 {"s": "ABC"} | {"s": "ABc"} | true | true | false | false | false
4473 {"s": "ABC"} | {"s": "ABcD"} | true | true | false | false | false
4474 {"s": "ABC"} | {"s": "B"} | true | true | false | false | false
4475 {"s": "ABc"} | {"s": ""} | false | false | false | true | true
4476 {"s": "ABc"} | {"s": "a"} | true | true | false | false | false
4477 {"s": "ABc"} | {"s": "ab"} | true | true | false | false | false
4478 {"s": "ABc"} | {"s": "abc"} | true | true | false | false | false
4479 {"s": "ABc"} | {"s": "abcd"} | true | true | false | false | false
4480 {"s": "ABc"} | {"s": "b"} | true | true | false | false | false
4481 {"s": "ABc"} | {"s": "A"} | false | false | false | true | true
4482 {"s": "ABc"} | {"s": "AB"} | false | false | false | true | true
4483 {"s": "ABc"} | {"s": "ABC"} | false | false | false | true | true
4484 {"s": "ABc"} | {"s": "ABc"} | false | true | true | true | false
4485 {"s": "ABc"} | {"s": "ABcD"} | true | true | false | false | false
4486 {"s": "ABc"} | {"s": "B"} | true | true | false | false | false
4487 {"s": "ABcD"} | {"s": ""} | false | false | false | true | true
4488 {"s": "ABcD"} | {"s": "a"} | true | true | false | false | false
4489 {"s": "ABcD"} | {"s": "ab"} | true | true | false | false | false
4490 {"s": "ABcD"} | {"s": "abc"} | true | true | false | false | false
4491 {"s": "ABcD"} | {"s": "abcd"} | true | true | false | false | false
4492 {"s": "ABcD"} | {"s": "b"} | true | true | false | false | false
4493 {"s": "ABcD"} | {"s": "A"} | false | false | false | true | true
4494 {"s": "ABcD"} | {"s": "AB"} | false | false | false | true | true
4495 {"s": "ABcD"} | {"s": "ABC"} | false | false | false | true | true
4496 {"s": "ABcD"} | {"s": "ABc"} | false | false | false | true | true
4497 {"s": "ABcD"} | {"s": "ABcD"} | false | true | true | true | false
4498 {"s": "ABcD"} | {"s": "B"} | true | true | false | false | false
4499 {"s": "B"} | {"s": ""} | false | false | false | true | true
4500 {"s": "B"} | {"s": "a"} | true | true | false | false | false
4501 {"s": "B"} | {"s": "ab"} | true | true | false | false | false
4502 {"s": "B"} | {"s": "abc"} | true | true | false | false | false
4503 {"s": "B"} | {"s": "abcd"} | true | true | false | false | false
4504 {"s": "B"} | {"s": "b"} | true | true | false | false | false
4505 {"s": "B"} | {"s": "A"} | false | false | false | true | true
4506 {"s": "B"} | {"s": "AB"} | false | false | false | true | true
4507 {"s": "B"} | {"s": "ABC"} | false | false | false | true | true
4508 {"s": "B"} | {"s": "ABc"} | false | false | false | true | true
4509 {"s": "B"} | {"s": "ABcD"} | false | false | false | true | true
4510 {"s": "B"} | {"s": "B"} | false | true | true | true | false