forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit94929f1
committed
Clean up some unpleasant behaviors in psql's \connect command.
The check for whether to complain about not having an old connectionto get parameters from was seriously out of date: it had not beenrethought when we invented connstrings, nor when we invented the-reuse-previous option. Replace it with a check that throws anerror if reuse-previous is active and we lack an old connection toreuse. While that doesn't move the goalposts very far in terms ofeasing reconnection after a server crash, at least it's consistent.If the user specifies a connstring plus additional parameters(which is invalid per the documentation), the extra parameters weresilently ignored. That seems like it could be really confusing,so let's throw a syntax error instead.Teach the connstring code path to re-use the old connection's passwordin the same cases as the old-style-syntax code path would, ie if weare reusing parameters and the values of username, host/hostaddr, andport are not being changed. Document this behavior, too, since it wasunmentioned before. Also simplify the implementation a bit, givingrise to two new and useful properties: if there's a "password=xxx" inthe connstring, we'll use it not ignore it, and by default (i.e.,except with --no-password) we will prompt for a password if there-used password or connstring password doesn't work. The previouscode just failed if the re-used password didn't work.Given the paucity of field complaints about these issues, I don'tthink that they rise to the level of back-patchable bug fixes,and in any case they might represent undesirable behavior changesin minor releases. So no back-patch.Discussion:https://postgr.es/m/235210.1603321144@sss.pgh.pa.us1 parent866e24d commit94929f1
2 files changed
+54
-39
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
920 | 920 |
| |
921 | 921 |
| |
922 | 922 |
| |
| 923 | + | |
| 924 | + | |
923 | 925 |
| |
924 | 926 |
| |
925 | 927 |
| |
|
Lines changed: 52 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3014 | 3014 |
| |
3015 | 3015 |
| |
3016 | 3016 |
| |
3017 |
| - | |
3018 |
| - | |
3019 |
| - | |
3020 |
| - | |
3021 |
| - | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
3022 | 3021 |
| |
3023 | 3022 |
| |
3024 | 3023 |
| |
| |||
3038 | 3037 |
| |
3039 | 3038 |
| |
3040 | 3039 |
| |
3041 |
| - | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
3042 | 3045 |
| |
3043 |
| - | |
3044 |
| - | |
3045 |
| - | |
3046 |
| - | |
3047 |
| - | |
3048 |
| - | |
3049 |
| - | |
| 3046 | + | |
3050 | 3047 |
| |
3051 | 3048 |
| |
3052 | 3049 |
| |
3053 |
| - | |
3054 |
| - | |
3055 | 3050 |
| |
3056 | 3051 |
| |
3057 | 3052 |
| |
| |||
3065 | 3060 |
| |
3066 | 3061 |
| |
3067 | 3062 |
| |
3068 |
| - | |
3069 |
| - | |
3070 |
| - | |
3071 |
| - | |
3072 |
| - | |
3073 |
| - | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
3074 | 3068 |
| |
3075 |
| - | |
3076 |
| - | |
3077 |
| - | |
| 3069 | + | |
| 3070 | + | |
3078 | 3071 |
| |
3079 | 3072 |
| |
3080 | 3073 |
| |
| |||
3103 | 3096 |
| |
3104 | 3097 |
| |
3105 | 3098 |
| |
| 3099 | + | |
3106 | 3100 |
| |
3107 | 3101 |
| |
3108 | 3102 |
| |
| |||
3121 | 3115 |
| |
3122 | 3116 |
| |
3123 | 3117 |
| |
| 3118 | + | |
| 3119 | + | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
3124 | 3138 |
| |
3125 | 3139 |
| |
3126 | 3140 |
| |
| |||
3130 | 3144 |
| |
3131 | 3145 |
| |
3132 | 3146 |
| |
3133 |
| - | |
3134 |
| - | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
3135 | 3154 |
| |
3136 | 3155 |
| |
3137 | 3156 |
| |
| |||
3219 | 3238 |
| |
3220 | 3239 |
| |
3221 | 3240 |
| |
3222 |
| - | |
3223 |
| - | |
3224 |
| - | |
3225 |
| - | |
3226 |
| - | |
3227 |
| - | |
3228 |
| - | |
3229 |
| - | |
3230 | 3241 |
| |
3231 | 3242 |
| |
3232 | 3243 |
| |
| |||
3238 | 3249 |
| |
3239 | 3250 |
| |
3240 | 3251 |
| |
3241 |
| - | |
3242 |
| - | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
3243 | 3255 |
| |
3244 | 3256 |
| |
3245 |
| - | |
3246 |
| - | |
| 3257 | + | |
3247 | 3258 |
| |
3248 | 3259 |
| |
3249 | 3260 |
| |
| |||
3262 | 3273 |
| |
3263 | 3274 |
| |
3264 | 3275 |
| |
3265 |
| - | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
3266 | 3279 |
| |
3267 | 3280 |
| |
3268 | 3281 |
| |
|
0 commit comments
Comments
(0)