@@ -1018,10 +1018,10 @@ SELECT jsonb_path_query('[1, 2, 3, 4, 5]', '$[-1]');
10181018statement error pgcode 22033 pq: jsonpath array subscript is out of bounds
10191019SELECT jsonb_path_query('[1, 2, 3, 4, 5]', 'strict $[-1]');
10201020
1021- statement error pgcode 22038 pq: operand of unary jsonpath operator - is not a numeric value
1021+ statement error pgcode 2203B pq: operand of unary jsonpath operator - is not a numeric value
10221022SELECT jsonb_path_query('[1, 2, 3, 4, "hello"]', '-$[*]');
10231023
1024- statement error pgcode 22038 pq: operand of unary jsonpath operator \+ is not a numeric value
1024+ statement error pgcode 2203B pq: operand of unary jsonpath operator \+ is not a numeric value
10251025SELECT jsonb_path_query('null', '+$');
10261026
10271027query T
@@ -1191,3 +1191,187 @@ query T
11911191SELECT jsonb_path_query('[1,2,0,3]', '$[*] ? ((2 / @ > 0) is unknown)');
11921192----
119311930
1194+
1195+ statement error pgcode 2203A pq: JSON object does not contain key "a"
1196+ SELECT jsonb_path_query('{}', 'strict $.a', '{}', false);
1197+
1198+ query empty
1199+ SELECT jsonb_path_query('{}', 'strict $.a', '{}', true);
1200+
1201+ query empty
1202+ SELECT jsonb_path_query('{}', '$.a', '{}', false);
1203+
1204+ query empty
1205+ SELECT jsonb_path_query('{}', '$.a', '{}', true);
1206+
1207+ query empty
1208+ SELECT jsonb_path_query('{}', 'strict 0 / 0', '{}', true);
1209+
1210+ statement error pgcode 22012 pq: division by zero
1211+ SELECT jsonb_path_query('{}', 'strict 0 / 0', '{}', false);
1212+
1213+ query empty
1214+ SELECT jsonb_path_query('{}', '0 / 0', '{}', true);
1215+
1216+ statement error pgcode 22012 pq: division by zero
1217+ SELECT jsonb_path_query('{}', '0 / 0', '{}', false);
1218+
1219+ query T
1220+ SELECT jsonb_path_query('{}', 'strict (0 / 0) < (0 / 0)', '{}', true);
1221+ ----
1222+ null
1223+
1224+ query T
1225+ SELECT jsonb_path_query('{}', 'strict (0 / 0) < (0 / 0)', '{}', false);
1226+ ----
1227+ null
1228+
1229+ query T
1230+ SELECT jsonb_path_query('{}', '(0 / 0) < (0 / 0)', '{}', true);
1231+ ----
1232+ null
1233+
1234+ query T
1235+ SELECT jsonb_path_query('{}', '(0 / 0) < (0 / 0)', '{}', false);
1236+ ----
1237+ null
1238+
1239+ query empty
1240+ SELECT jsonb_path_query('{}', 'strict $[*]', '{}', true);
1241+
1242+ statement error pgcode 22039 pq: jsonpath wildcard array accessor can only be applied to an array
1243+ SELECT jsonb_path_query('{}', 'strict $[*]', '{}', false);
1244+
1245+ query T
1246+ SELECT jsonb_path_query('{}', '$[*]', '{}', true);
1247+ ----
1248+ {}
1249+
1250+ query T
1251+ SELECT jsonb_path_query('{}', '$[*]', '{}', false);
1252+ ----
1253+ {}
1254+
1255+ query empty
1256+ SELECT jsonb_path_query('{"a": 1}', 'strict $[0]', '{}', true);
1257+
1258+ statement error pgcode 22039 pq: jsonpath array accessor can only be applied to an array
1259+ SELECT jsonb_path_query('{"a": 1}', 'strict $[0]', '{}', false);
1260+
1261+ query T
1262+ SELECT jsonb_path_query('{"a": 1}', '$[0]', '{}', true);
1263+ ----
1264+ {"a": 1}
1265+
1266+ query T
1267+ SELECT jsonb_path_query('{"a": 1}', '$[0]', '{}', false);
1268+ ----
1269+ {"a": 1}
1270+
1271+ query empty
1272+ SELECT jsonb_path_query('[1, 2, 3]', 'strict $[3]', '{}', true);
1273+
1274+ statement error pgcode 22033 pq: jsonpath array subscript is out of bounds
1275+ SELECT jsonb_path_query('[1, 2, 3]', 'strict $[3]', '{}', false);
1276+
1277+ query empty
1278+ SELECT jsonb_path_query('[1, 2, 3]', '$[3]', '{}', true);
1279+
1280+ query empty
1281+ SELECT jsonb_path_query('[1, 2, 3]', '$[3]', '{}', false);
1282+
1283+ query empty
1284+ SELECT jsonb_path_query('[1, 2, 3]', 'strict $["a"]', '{}', true);
1285+
1286+ statement error pgcode 22033 pq: jsonpath array subscript is not a single numeric value
1287+ SELECT jsonb_path_query('[1, 2, 3]', 'strict $["a"]', '{}', false);
1288+
1289+ query empty
1290+ SELECT jsonb_path_query('[1, 2, 3]', '$["a"]', '{}', true);
1291+
1292+ statement error pgcode 22033 pq: jsonpath array subscript is not a single numeric value
1293+ SELECT jsonb_path_query('[1, 2, 3]', '$["a"]', '{}', false);
1294+
1295+ query empty
1296+ SELECT jsonb_path_query('{"a": "hello"}', 'strict $.a[1 to 3]', '{}', true);
1297+
1298+ statement error pgcode 22039 pq: jsonpath array accessor can only be applied to an array
1299+ SELECT jsonb_path_query('{"a": "hello"}', 'strict $.a[1 to 3]', '{}', false);
1300+
1301+ query empty
1302+ SELECT jsonb_path_query('{"a": "hello"}', '$.a[1 to 3]', '{}', true);
1303+
1304+ query empty
1305+ SELECT jsonb_path_query('{"a": "hello"}', '$.a[1 to 3]', '{}', false);
1306+
1307+ query empty
1308+ SELECT jsonb_path_query('"abc"', 'strict $.a', '{}', true);
1309+
1310+ statement error pgcode 2203A pq: jsonpath member accessor can only be applied to an object
1311+ SELECT jsonb_path_query('"abc"', 'strict $.a', '{}', false);
1312+
1313+ query empty
1314+ SELECT jsonb_path_query('"abc"', '$.a', '{}', true);
1315+
1316+ query empty
1317+ SELECT jsonb_path_query('"abc"', '$.a', '{}', false);
1318+
1319+ query empty
1320+ SELECT jsonb_path_query('"abc"', 'strict $.*', '{}', true);
1321+
1322+ statement error pgcode 2203C pq: jsonpath wildcard member accessor can only be applied to an object
1323+ SELECT jsonb_path_query('"abc"', 'strict $.*', '{}', false);
1324+
1325+ query empty
1326+ SELECT jsonb_path_query('"abc"', '$.*', '{}', true);
1327+
1328+ query empty
1329+ SELECT jsonb_path_query('"abc"', '$.*', '{}', false);
1330+
1331+ query empty
1332+ SELECT jsonb_path_query('{}', 'strict -$', '{}', true);
1333+
1334+ statement error pgcode 2203B pq: operand of unary jsonpath operator - is not a numeric value
1335+ SELECT jsonb_path_query('{}', 'strict -$', '{}', false);
1336+
1337+ query empty
1338+ SELECT jsonb_path_query('{}', '-$', '{}', true);
1339+
1340+ statement error pgcode 2203B pq: operand of unary jsonpath operator - is not a numeric value
1341+ SELECT jsonb_path_query('{}', '-$', '{}', false);
1342+
1343+ query empty
1344+ SELECT jsonb_path_query('{}', 'strict $ - 1', '{}', true);
1345+
1346+ statement error pgcode 22038 pq: left operand of jsonpath operator - is not a single numeric value
1347+ SELECT jsonb_path_query('{}', 'strict $ - 1', '{}', false);
1348+
1349+ query empty
1350+ SELECT jsonb_path_query('{}', '$ - 1', '{}', true);
1351+
1352+ statement error pgcode 22038 pq: left operand of jsonpath operator - is not a single numeric value
1353+ SELECT jsonb_path_query('{}', '$ - 1', '{}', false);
1354+
1355+ query empty
1356+ SELECT jsonb_path_query('{}', 'strict 1 - $', '{}', true);
1357+
1358+ statement error pgcode 22038 pq: right operand of jsonpath operator - is not a single numeric value
1359+ SELECT jsonb_path_query('{}', 'strict 1 - $', '{}', false);
1360+
1361+ query empty
1362+ SELECT jsonb_path_query('{}', '1 - $', '{}', true);
1363+
1364+ statement error pgcode 22038 pq: right operand of jsonpath operator - is not a single numeric value
1365+ SELECT jsonb_path_query('{}', '1 - $', '{}', false);
1366+
1367+ statement error pgcode 42704 pq: could not find jsonpath variable "var"
1368+ SELECT jsonb_path_query('{}', 'strict $var', '{}', true);
1369+
1370+ statement error pgcode 42704 pq: could not find jsonpath variable "var"
1371+ SELECT jsonb_path_query('{}', 'strict $var', '{}', false);
1372+
1373+ statement error pgcode 42704 pq: could not find jsonpath variable "var"
1374+ SELECT jsonb_path_query('{}', '$var', '{}', true);
1375+
1376+ statement error pgcode 42704 pq: could not find jsonpath variable "var"
1377+ SELECT jsonb_path_query('{}', '$var', '{}', false);
0 commit comments