forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1f9bf05
committed
Use correct text domain for errcontext() appearing within ereport().
The mechanism added in commitdbdf967for associating the correct translation domain with errcontext stringspotentially fails in cases where errcontext() is used within an ereport()macro. Such usage was not originally envisioned for errcontext(), but wedo have a few places that do it. In this situation, the intended commaexpression becomes just a couple of arguments to errfinish(), which thecompiler might choose to evaluate right-to-left.Fortunately, in such cases the textdomain for the errcontext string mustbe the same as for the surrounding ereport. So we can fix this by lettingerrstart initialize context_domain along with domain; then it will havethe correct value no matter which order the calls occur in. (Note thaterror stack callback functions are not invoked until errfinish, so normalusage of errcontext won't affect what happens for errcontext calls withinthe ereport macro.)In passing, make sure that errcontext calls within the main backend setcontext_domain to something non-NULL. This isn't a live bug becauseNULL would select the current textdomain() setting which should be theright thing anyway --- but it seems better to handle this completelyconsistently with the regular domain field.Per report from Dmitry Voronin. Backpatch to 9.3; before that, therewasn't any attempt to ensure that errcontext strings were translatedin an appropriate domain.1 parent1bf4a84 commit1f9bf05
1 file changed
+15
-2
lines changedLines changed: 15 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
378 | 378 |
| |
379 | 379 |
| |
380 | 380 |
| |
| 381 | + | |
| 382 | + | |
381 | 383 |
| |
382 | 384 |
| |
383 | 385 |
| |
| |||
728 | 730 |
| |
729 | 731 |
| |
730 | 732 |
| |
731 |
| - | |
| 733 | + | |
732 | 734 |
| |
733 | 735 |
| |
734 | 736 |
| |
| |||
1048 | 1050 |
| |
1049 | 1051 |
| |
1050 | 1052 |
| |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1051 | 1063 |
| |
1052 | 1064 |
| |
1053 | 1065 |
| |
| |||
1057 | 1069 |
| |
1058 | 1070 |
| |
1059 | 1071 |
| |
1060 |
| - | |
| 1072 | + | |
| 1073 | + | |
1061 | 1074 |
| |
1062 | 1075 |
| |
1063 | 1076 |
| |
|
0 commit comments
Comments
(0)