Commit 309857f
committed
Fix handling of R/W expanded datums that are passed to SQL functions.
fmgr_sql must make expanded-datum arguments read-only, because
it's possible that the function body will pass the argument to
more than one callee function. If one of those functions takes
the datum's R/W property as license to scribble on it, then later
callees will see an unexpected value, leading to wrong answers.
From a performance standpoint, it'd be nice to skip this in the
common case that the argument value is passed to only one callee.
However, detecting that seems fairly hard, and certainly not
something that I care to attempt in a back-patched bug fix.
Per report from Adam Mackler. This has been broken since we
invented expanded datums, so back-patch to all supported branches.
Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email
Discussion: https://postgr.es/m/187436.1660143060@sss.pgh.pa.us1 parent 92dc33a commit 309857f
File tree
3 files changed
+48
-3
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+48
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
939 | 939 | | |
940 | 940 | | |
941 | 941 | | |
| 942 | + | |
942 | 943 | | |
943 | 944 | | |
944 | 945 | | |
| |||
955 | 956 | | |
956 | 957 | | |
957 | 958 | | |
958 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
959 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
960 | 975 | | |
961 | | - | |
| 976 | + | |
962 | 977 | | |
963 | 978 | | |
964 | 979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
669 | 685 | | |
670 | 686 | | |
671 | 687 | | |
| |||
692 | 708 | | |
693 | 709 | | |
694 | 710 | | |
695 | | - | |
| 711 | + | |
696 | 712 | | |
697 | 713 | | |
698 | 714 | | |
| |||
722 | 738 | | |
723 | 739 | | |
724 | 740 | | |
| 741 | + | |
725 | 742 | | |
726 | 743 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
388 | 401 | | |
389 | 402 | | |
390 | 403 | | |
| |||
0 commit comments