Commit 0f271e8
committed
SQL/JSON: Correct jsonpath variable name matching
Previously, GetJsonPathVar() allowed a jsonpath expression to
reference any prefix of a PASSING variable's name. For example, the
following query would incorrectly work:
SELECT JSON_QUERY(context_item, jsonpath '$xy' PASSING val AS xyz);
The fix ensures that the length of the variable name mentioned in a
jsonpath expression matches exactly with the name of the PASSING
variable before comparing the strings using strncmp().
Reported-by: Alvaro Herrera (off-list)
Discussion: https://postgr.es/m/CA+HiwqFGkLWMvELBH6E4SQ45qUHthgcRH6gCJL20OsYDRtFx_w@mail.gmail.com1 parent 5e05a0e commit 0f271e8
File tree
5 files changed
+21
-1
lines changed- src
- backend
- executor
- utils/adt
- include/utils
- test/regress
- expected
- sql
5 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4278 | 4278 | | |
4279 | 4279 | | |
4280 | 4280 | | |
| 4281 | + | |
4281 | 4282 | | |
4282 | 4283 | | |
4283 | 4284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2994 | 2994 | | |
2995 | 2995 | | |
2996 | 2996 | | |
2997 | | - | |
| 2997 | + | |
| 2998 | + | |
2998 | 2999 | | |
2999 | 3000 | | |
3000 | 3001 | | |
| |||
4118 | 4119 | | |
4119 | 4120 | | |
4120 | 4121 | | |
| 4122 | + | |
4121 | 4123 | | |
4122 | 4124 | | |
4123 | 4125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1334 | 1334 | | |
1335 | 1335 | | |
1336 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
0 commit comments