forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb44669b
committed
Simplify error handing of jsonapi.c for the frontend
This commit removes a dependency to the central logging facilities inthe JSON parsing routines of src/common/, which existed to log errorswhen seeing error codes that do not match any existing values inJsonParseErrorType, which is not something that should never happen.The routine providing a detailed error message based on the error codeis made backend-only, the existing code being unsafe to use in thefrontend as the error message may finish by being palloc'd or point to astatic string, so there is no way to know if the memory of the messageshould be pfree'd or not. The only user of this routine in the frontendwas pg_verifybackup, that is changed to use a more generic error messageon parsing failure.Note that making this code more resilient to OOM failures if used inshared libraries would require much more work as a lot of code pathsstill rely on palloc() & friends, but we are not sure yet if we need togo down to that. Still, removing the dependency to logging is a steptoward more portability.This cleans up the handling of check_stack_depth() while on it, as itexists only in the backend.Per discussion with Jacob Champion and Tom Lane.Discussion:https://postgr.es/m/YNwL7kXwn3Cckbd6@paquier.xyz1 parent1708f6b commitb44669b
File tree
3 files changed
+32
-33
lines changed- src
- bin/pg_verifybackup
- t
- common
3 files changed
+32
-33
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
147 | 147 |
| |
148 | 148 |
| |
149 | 149 |
| |
150 |
| - | |
| 150 | + | |
151 | 151 |
| |
152 | 152 |
| |
153 | 153 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 |
| - | |
| 19 | + | |
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
|
Lines changed: 30 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 |
| - | |
25 |
| - | |
| 23 | + | |
26 | 24 |
| |
27 | 25 |
| |
28 | 26 |
| |
29 |
| - | |
30 |
| - | |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 | 27 |
| |
38 | 28 |
| |
39 | 29 |
| |
| |||
61 | 51 |
| |
62 | 52 |
| |
63 | 53 |
| |
64 |
| - | |
65 | 54 |
| |
66 | 55 |
| |
67 | 56 |
| |
| |||
378 | 367 |
| |
379 | 368 |
| |
380 | 369 |
| |
| 370 | + | |
381 | 371 |
| |
| 372 | + | |
382 | 373 |
| |
383 | 374 |
| |
384 | 375 |
| |
| |||
478 | 469 |
| |
479 | 470 |
| |
480 | 471 |
| |
| 472 | + | |
481 | 473 |
| |
| 474 | + | |
482 | 475 |
| |
483 | 476 |
| |
484 | 477 |
| |
| |||
1044 | 1037 |
| |
1045 | 1038 |
| |
1046 | 1039 |
| |
1047 |
| - | |
1048 |
| - | |
| 1040 | + | |
1049 | 1041 |
| |
1050 |
| - | |
| 1042 | + | |
1051 | 1043 |
| |
1052 | 1044 |
| |
1053 | 1045 |
| |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
1054 | 1062 |
| |
1055 | 1063 |
| |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1056 | 1068 |
| |
1057 | 1069 |
| |
1058 | 1070 |
| |
| |||
1115 | 1127 |
| |
1116 | 1128 |
| |
1117 | 1129 |
| |
1118 |
| - | |
1119 |
| - | |
1120 |
| - | |
1121 |
| - | |
1122 |
| - | |
1123 |
| - | |
1124 |
| - | |
1125 |
| - | |
1126 |
| - | |
1127 |
| - | |
1128 |
| - | |
1129 |
| - | |
1130 |
| - | |
1131 |
| - | |
1132 |
| - | |
1133 |
| - | |
| 1130 | + | |
| 1131 | + | |
1134 | 1132 |
| |
| 1133 | + |
0 commit comments
Comments
(0)