mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix bugs in manipulation of PgBackendStatus.st_clienthostname.
Initialization of this field was not being done according to the
st_changecount protocol (it has to be done within the changecount increment
range, not outside). And the test to see if the value should be reported
as null was wrong. Noted while perusing uses of Port.remote_hostname.
This was wrong from the introduction of this code (commit 4a25bc145
),
so back-patch to 9.1.
This commit is contained in:
@ -760,7 +760,8 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
||||
clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host);
|
||||
values[11] = DirectFunctionCall1(inet_in,
|
||||
CStringGetDatum(remote_host));
|
||||
if (beentry->st_clienthostname)
|
||||
if (beentry->st_clienthostname &&
|
||||
beentry->st_clienthostname[0])
|
||||
values[12] = CStringGetTextDatum(beentry->st_clienthostname);
|
||||
else
|
||||
nulls[12] = true;
|
||||
|
Reference in New Issue
Block a user