Commit 4984784
committed
Fix crash in json{b}_populate_recordset() and json{b}_to_recordset().
As of commit 37a795a, populate_recordset_worker() tried to pass back
(as rsi.setDesc) a tupdesc that it also had cached in its fn_extra.
But the core executor would free the passed-back tupdesc, risking a
crash if the function were called again in the same query. The safest
and least invasive way to fix that is to make an extra tupdesc copy
to pass back.
While at it, I failed to resist the temptation to get rid of unnecessary
get_fn_expr_argtype() calls here and in populate_record_worker().
Per report from Dmitry Dolgov; thanks to Michael Paquier and
Andrew Gierth for investigation and discussion.
Discussion: https://postgr.es/m/CA+q6zcWzN9ztCfR47ZwgTr1KLnuO6BAY6FurxXhovP4hxr+yOQ@mail.gmail.com1 parent 93ad00c commit 4984784
File tree
5 files changed
+59
-23
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
5 files changed
+59
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
424 | | - | |
| 424 | + | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
2296 | 2296 | | |
2297 | 2297 | | |
2298 | 2298 | | |
2299 | | - | |
| 2299 | + | |
| 2300 | + | |
2300 | 2301 | | |
2301 | 2302 | | |
2302 | 2303 | | |
2303 | 2304 | | |
2304 | 2305 | | |
2305 | | - | |
| 2306 | + | |
| 2307 | + | |
2306 | 2308 | | |
2307 | 2309 | | |
2308 | 2310 | | |
2309 | 2311 | | |
2310 | 2312 | | |
2311 | | - | |
| 2313 | + | |
| 2314 | + | |
2312 | 2315 | | |
2313 | 2316 | | |
2314 | 2317 | | |
2315 | 2318 | | |
2316 | 2319 | | |
2317 | | - | |
| 2320 | + | |
| 2321 | + | |
2318 | 2322 | | |
2319 | 2323 | | |
2320 | 2324 | | |
| |||
3203 | 3207 | | |
3204 | 3208 | | |
3205 | 3209 | | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
3206 | 3214 | | |
3207 | 3215 | | |
3208 | | - | |
| 3216 | + | |
3209 | 3217 | | |
3210 | 3218 | | |
3211 | | - | |
3212 | 3219 | | |
3213 | 3220 | | |
3214 | 3221 | | |
3215 | 3222 | | |
3216 | 3223 | | |
3217 | 3224 | | |
3218 | 3225 | | |
3219 | | - | |
3220 | | - | |
3221 | 3226 | | |
3222 | 3227 | | |
3223 | 3228 | | |
| |||
3303 | 3308 | | |
3304 | 3309 | | |
3305 | 3310 | | |
3306 | | - | |
| 3311 | + | |
3307 | 3312 | | |
3308 | | - | |
| 3313 | + | |
3309 | 3314 | | |
3310 | 3315 | | |
3311 | 3316 | | |
| |||
3489 | 3494 | | |
3490 | 3495 | | |
3491 | 3496 | | |
3492 | | - | |
| 3497 | + | |
| 3498 | + | |
3493 | 3499 | | |
3494 | 3500 | | |
3495 | 3501 | | |
3496 | 3502 | | |
3497 | 3503 | | |
3498 | | - | |
| 3504 | + | |
| 3505 | + | |
3499 | 3506 | | |
3500 | 3507 | | |
3501 | 3508 | | |
3502 | 3509 | | |
3503 | 3510 | | |
3504 | | - | |
| 3511 | + | |
| 3512 | + | |
3505 | 3513 | | |
3506 | 3514 | | |
3507 | 3515 | | |
3508 | 3516 | | |
3509 | 3517 | | |
3510 | | - | |
| 3518 | + | |
| 3519 | + | |
3511 | 3520 | | |
3512 | 3521 | | |
3513 | 3522 | | |
| |||
3544 | 3553 | | |
3545 | 3554 | | |
3546 | 3555 | | |
3547 | | - | |
| 3556 | + | |
| 3557 | + | |
3548 | 3558 | | |
3549 | 3559 | | |
3550 | 3560 | | |
3551 | | - | |
| 3561 | + | |
3552 | 3562 | | |
3553 | 3563 | | |
3554 | | - | |
3555 | 3564 | | |
3556 | 3565 | | |
3557 | 3566 | | |
| |||
3662 | 3671 | | |
3663 | 3672 | | |
3664 | 3673 | | |
3665 | | - | |
| 3674 | + | |
3666 | 3675 | | |
3667 | 3676 | | |
3668 | 3677 | | |
| |||
3693 | 3702 | | |
3694 | 3703 | | |
3695 | 3704 | | |
3696 | | - | |
3697 | | - | |
3698 | 3705 | | |
3699 | 3706 | | |
3700 | 3707 | | |
| |||
3726 | 3733 | | |
3727 | 3734 | | |
3728 | 3735 | | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
3729 | 3741 | | |
3730 | | - | |
| 3742 | + | |
3731 | 3743 | | |
3732 | 3744 | | |
3733 | 3745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1841 | 1841 | | |
1842 | 1842 | | |
1843 | 1843 | | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
1844 | 1854 | | |
1845 | 1855 | | |
1846 | 1856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2523 | 2523 | | |
2524 | 2524 | | |
2525 | 2525 | | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
2526 | 2536 | | |
2527 | 2537 | | |
2528 | 2538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| 550 | + | |
| 551 | + | |
550 | 552 | | |
551 | 553 | | |
552 | 554 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| 666 | + | |
| 667 | + | |
666 | 668 | | |
667 | 669 | | |
668 | 670 | | |
| |||
0 commit comments