Commit 519fa04
committed
Fix error reporting for SQL/JSON path type mismatches
transformJsonFuncExpr() used exprType()/exprLocation() on the
possibly coerced path expression, which could be NULL when
coercion to jsonpath failed, leading to "cache lookup failed
for type 0" errors.
Preserve the original expression node so that type and location
in the "must be of type jsonpath" error are reported correctly.
Add regression tests to cover these cases.
Reported-by: Jian He <jian.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CACJufxHunVg81JMuNo8Yvv_hJD0DicgaVN2Wteu8aJbVJPBjZA@mail.gmail.com
Backpatch-through: 171 parent 0ca3b16 commit 519fa04
File tree
3 files changed
+25
-8
lines changed- src
- backend/parser
- test/regress
- expected
- sql
3 files changed
+25
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4285 | 4285 | | |
4286 | 4286 | | |
4287 | 4287 | | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
4288 | 4291 | | |
4289 | 4292 | | |
4290 | 4293 | | |
| |||
4500 | 4503 | | |
4501 | 4504 | | |
4502 | 4505 | | |
4503 | | - | |
4504 | | - | |
4505 | | - | |
4506 | | - | |
4507 | | - | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
| 4514 | + | |
4508 | 4515 | | |
4509 | 4516 | | |
4510 | 4517 | | |
4511 | | - | |
4512 | | - | |
4513 | | - | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
4514 | 4521 | | |
4515 | 4522 | | |
4516 | 4523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1331 | 1331 | | |
1332 | 1332 | | |
1333 | 1333 | | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1334 | 1338 | | |
1335 | 1339 | | |
1336 | 1340 | | |
| |||
1355 | 1359 | | |
1356 | 1360 | | |
1357 | 1361 | | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1358 | 1366 | | |
1359 | 1367 | | |
1360 | 1368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
453 | 454 | | |
454 | 455 | | |
455 | 456 | | |
| |||
460 | 461 | | |
461 | 462 | | |
462 | 463 | | |
| 464 | + | |
463 | 465 | | |
464 | 466 | | |
465 | 467 | | |
| |||
0 commit comments