forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit511ae62
committed
Make psql reject attempts to set special variables to invalid values.
Previously, if the user set a special variable such as ECHO to anunrecognized value, psql would bleat but store the new value anyway, andthen fall back to a default setting for the behavior controlled by thevariable. This was agreed to be a not particularly good idea. Withthis patch, invalid values result in an error message and no change instate.(But this applies only to variables that affect psql's behavior; purelyinformational variables such as ENCODING can still be set to randomvalues.)To do this, modify the API for psql's assign-hook functions so that theycan return an OK/not OK result, and give them the responsibility forprinting error messages when they reject a value. Adjust the APIs forParseVariableBool and ParseVariableNum to support the new behaviorconveniently.In passing, document the variable VERSION, which had somehow escaped that.And improve the quite-inadequate commenting in psql/variables.c.Daniel Vérité, reviewed by Rahila Syed, some further tweaking by meDiscussion:https://postgr.es/m/7356e741-fa59-4146-a8eb-cf95fd6b21fb@mm1 parent46aae59 commit511ae62
File tree
10 files changed
+356
-182
lines changed- doc/src/sgml/ref
- src
- bin/psql
- test/regress
- expected
- sql
10 files changed
+356
-182
lines changedLines changed: 21 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3078 | 3078 |
| |
3079 | 3079 |
| |
3080 | 3080 |
| |
3081 |
| - | |
3082 |
| - | |
3083 |
| - | |
3084 |
| - | |
| 3081 | + | |
| 3082 | + | |
3085 | 3083 |
| |
3086 | 3084 |
| |
3087 | 3085 |
| |
| |||
3170 | 3168 |
| |
3171 | 3169 |
| |
3172 | 3170 |
| |
3173 |
| - | |
| 3171 | + | |
3174 | 3172 |
| |
3175 | 3173 |
| |
3176 |
| - | |
3177 |
| - | |
3178 |
| - | |
| 3174 | + | |
| 3175 | + | |
3179 | 3176 |
| |
3180 | 3177 |
| |
3181 | 3178 |
| |
| |||
3201 | 3198 |
| |
3202 | 3199 |
| |
3203 | 3200 |
| |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
3204 | 3204 |
| |
3205 | 3205 |
| |
3206 | 3206 |
| |
| |||
3241 | 3241 |
| |
3242 | 3242 |
| |
3243 | 3243 |
| |
3244 |
| - | |
3245 |
| - | |
3246 |
| - | |
| 3244 | + | |
| 3245 | + | |
3247 | 3246 |
| |
3248 | 3247 |
| |
3249 | 3248 |
| |
| |||
3312 | 3311 |
| |
3313 | 3312 |
| |
3314 | 3313 |
| |
3315 |
| - | |
| 3314 | + | |
3316 | 3315 |
| |
3317 | 3316 |
| |
3318 | 3317 |
| |
| |||
3477 | 3476 |
| |
3478 | 3477 |
| |
3479 | 3478 |
| |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + | |
| 3488 | + | |
3480 | 3489 |
| |
3481 | 3490 |
| |
3482 | 3491 |
| |
|
Lines changed: 46 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
248 | 248 |
| |
249 | 249 |
| |
250 | 250 |
| |
251 |
| - | |
| 251 | + | |
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
256 |
| - | |
257 |
| - | |
258 |
| - | |
| 256 | + | |
259 | 257 |
| |
260 |
| - | |
261 |
| - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
262 | 267 |
| |
263 |
| - | |
264 |
| - | |
265 | 268 |
| |
266 |
| - | |
267 |
| - | |
268 |
| - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
269 | 274 |
| |
270 |
| - | |
| 275 | + | |
271 | 276 |
| |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
272 | 281 |
| |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 | 282 |
| |
277 | 283 |
| |
278 | 284 |
| |
| |||
1208 | 1214 |
| |
1209 | 1215 |
| |
1210 | 1216 |
| |
1211 |
| - | |
1212 |
| - | |
1213 | 1217 |
| |
1214 |
| - | |
1215 | 1218 |
| |
1216 | 1219 |
| |
1217 | 1220 |
| |
| |||
1325 | 1328 |
| |
1326 | 1329 |
| |
1327 | 1330 |
| |
1328 |
| - | |
1329 |
| - | |
1330 | 1331 |
| |
1331 |
| - | |
| 1332 | + | |
1332 | 1333 |
| |
1333 | 1334 |
| |
1334 | 1335 |
| |
| |||
1564 | 1565 |
| |
1565 | 1566 |
| |
1566 | 1567 |
| |
1567 |
| - | |
| 1568 | + | |
1568 | 1569 |
| |
1569 | 1570 |
| |
1570 | 1571 |
| |
| |||
1589 | 1590 |
| |
1590 | 1591 |
| |
1591 | 1592 |
| |
1592 |
| - | |
1593 |
| - | |
1594 | 1593 |
| |
1595 |
| - | |
| 1594 | + | |
1596 | 1595 |
| |
1597 | 1596 |
| |
1598 | 1597 |
| |
| |||
2593 | 2592 |
| |
2594 | 2593 |
| |
2595 | 2594 |
| |
2596 |
| - | |
2597 | 2595 |
| |
2598 | 2596 |
| |
2599 | 2597 |
| |
| |||
2612 | 2610 |
| |
2613 | 2611 |
| |
2614 | 2612 |
| |
2615 |
| - | |
2616 | 2613 |
| |
2617 | 2614 |
| |
2618 | 2615 |
| |
| |||
2665 | 2662 |
| |
2666 | 2663 |
| |
2667 | 2664 |
| |
2668 |
| - | |
2669 | 2665 |
| |
2670 | 2666 |
| |
2671 | 2667 |
| |
| |||
2676 | 2672 |
| |
2677 | 2673 |
| |
2678 | 2674 |
| |
2679 |
| - | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
2680 | 2686 |
| |
2681 | 2687 |
| |
2682 | 2688 |
| |
| |||
2685 | 2691 |
| |
2686 | 2692 |
| |
2687 | 2693 |
| |
2688 |
| - | |
| 2694 | + | |
2689 | 2695 |
| |
2690 | 2696 |
| |
2691 | 2697 |
| |
| |||
2740 | 2746 |
| |
2741 | 2747 |
| |
2742 | 2748 |
| |
2743 |
| - | |
| 2749 | + | |
2744 | 2750 |
| |
2745 | 2751 |
| |
2746 | 2752 |
| |
| |||
2772 | 2778 |
| |
2773 | 2779 |
| |
2774 | 2780 |
| |
2775 |
| - | |
2776 |
| - | |
2777 |
| - | |
2778 |
| - | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
2779 | 2789 |
| |
2780 | 2790 |
| |
2781 | 2791 |
| |
| |||
2794 | 2804 |
| |
2795 | 2805 |
| |
2796 | 2806 |
| |
2797 |
| - | |
| 2807 | + | |
2798 | 2808 |
| |
2799 | 2809 |
| |
2800 | 2810 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
841 | 841 |
| |
842 | 842 |
| |
843 | 843 |
| |
844 |
| - | |
845 | 844 |
| |
846 | 845 |
| |
847 | 846 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
541 | 541 |
| |
542 | 542 |
| |
543 | 543 |
| |
544 |
| - | |
| 544 | + | |
545 | 545 |
| |
546 | 546 |
| |
547 | 547 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
162 | 162 |
| |
163 | 163 |
| |
164 | 164 |
| |
165 |
| - | |
| 165 | + | |
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
|
0 commit comments
Comments
(0)