- Notifications
You must be signed in to change notification settings - Fork5k
Commitdaf9bdc
committed
Fix PQport to never return NULL unless the connection is NULL.
This is the documented behavior, and it worked that way beforev10. However, addition of the connhost[] array created caseswhere conn->connhost[conn->whichhost].port is NULL. The restof libpq is careful to substitute DEF_PGPORT[_STR] for a nullor empty port string, but we failed to do so here, leading topossibly returning NULL. As of v18 that causes psql's \conninfocommand to segfault. Older psql versions avoid that, but it'spretty likely that other clients have trouble with this,so we'd better back-patch the fix.In stable branches, just revert to our historical behavior ofreturning an empty string when there was no user-given portspecification. However, it seems substantially more useful andindeed more correct to hand back DEF_PGPORT_STR in such cases,so let's make v18 and master do that.Author: Daniele Varrazzo <daniele.varrazzo@gmail.com>Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CA+mi_8YTS8WPZPO0PAb2aaGLwHuQ0DEQRF0ZMnvWss4y9FwDYQ@mail.gmail.comBackpatch-through: 131 parentb8926a5 commitdaf9bdc
2 files changed
+6
-3
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7574 | 7574 |
| |
7575 | 7575 |
| |
7576 | 7576 |
| |
7577 |
| - | |
| 7577 | + | |
| 7578 | + | |
| 7579 | + | |
7578 | 7580 |
| |
7579 | 7581 |
| |
7580 |
| - | |
| 7582 | + | |
7581 | 7583 |
| |
7582 | 7584 |
| |
7583 | 7585 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
357 | 357 |
| |
358 | 358 |
| |
359 | 359 |
| |
360 |
| - | |
| 360 | + | |
| 361 | + | |
361 | 362 |
| |
362 | 363 |
| |
363 | 364 |
| |
|
0 commit comments
Comments
(0)