diff options
author | Tom Lane | 2025-07-17 16:46:38 +0000 |
---|---|---|
committer | Tom Lane | 2025-07-17 16:46:57 +0000 |
commit | daf9bdc47d11822da8a1269bd73fb23258b24f80 (patch) | |
tree | deaf235e1d7fad56d14e3a443f5fdf152359710b /src/include/optimizer | |
parent | b8926a5b4bb82e3c56855185da4106d24d26154c (diff) |
This is the documented behavior, and it worked that way before
v10. However, addition of the connhost[] array created cases
where conn->connhost[conn->whichhost].port is NULL. The rest
of libpq is careful to substitute DEF_PGPORT[_STR] for a null
or empty port string, but we failed to do so here, leading to
possibly returning NULL. As of v18 that causes psql's \conninfo
command to segfault. Older psql versions avoid that, but it's
pretty 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 of
returning an empty string when there was no user-given port
specification. However, it seems substantially more useful and
indeed 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.com
Backpatch-through: 13
Diffstat (limited to 'src/include/optimizer')
0 files changed, 0 insertions, 0 deletions