forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaef3623
committed
Handle corner cases correctly in psql's reconnection logic.
After an unexpected connection loss and successful reconnection,psql neglected to resynchronize its internal state about the server,such as server version. Ordinarily we'd be reconnecting to the sameserver and so this isn't really necessary, but there are scenarioswhere we do need to update --- one example is where we have a listof possible connection targets and they're not all alike.Define "resynchronize" as including connection_warnings(), so thatthis case acts the same as \connect. This seems useful; for example,if the server version did change, the user might wish to know that.An attuned user might also notice that the new connection isn'tSSL-encrypted, for example, though this approach isn't especiallyin-your-face about such changes. Although this part is a behavioralchange, it only affects interactive sessions, so it should not breakany applications.Also, in do_connect, make sure that we desynchronize correctly whenabandoning an old connection in non-interactive mode.These problems evidently are the result of people patching only oneof the two places where psql deals with connection changes, so insertsome cross-referencing comments in hopes of forestalling future bugsof the same ilk.Lastly, in Windows builds, issue codepage mismatch warnings only atstartup, not during reconnections. psql's codepage can't changeduring a reconnect, so complaining about it again seems like uselessnoise.Peter Billen and Tom Lane. Back-patch to all supported branches.Discussion:https://postgr.es/m/CAMTXbE8e6U=EBQfNSe01Ej17CBStGiudMAGSOPaw-ALxM-5jXg@mail.gmail.com1 parent6fcc40b commitaef3623
2 files changed
+24
-2
lines changedLines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3120 | 3120 |
| |
3121 | 3121 |
| |
3122 | 3122 |
| |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
3123 | 3127 |
| |
3124 | 3128 |
| |
| 3129 | + | |
| 3130 | + | |
3125 | 3131 |
| |
3126 | 3132 |
| |
3127 | 3133 |
| |
| |||
3135 | 3141 |
| |
3136 | 3142 |
| |
3137 | 3143 |
| |
3138 |
| - | |
| 3144 | + | |
| 3145 | + | |
3139 | 3146 |
| |
3140 | 3147 |
| |
3141 | 3148 |
| |
| |||
3226 | 3233 |
| |
3227 | 3234 |
| |
3228 | 3235 |
| |
3229 |
| - | |
| 3236 | + | |
| 3237 | + | |
3230 | 3238 |
| |
3231 | 3239 |
| |
3232 | 3240 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
402 | 402 |
| |
403 | 403 |
| |
404 | 404 |
| |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
405 | 410 |
| |
406 | 411 |
| |
407 | 412 |
| |
408 | 413 |
| |
409 | 414 |
| |
410 | 415 |
| |
| 416 | + | |
411 | 417 |
| |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
412 | 426 |
| |
413 | 427 |
| |
414 | 428 |
| |
|
0 commit comments
Comments
(0)