mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Add more columns to pg_stat_ssl
Add columns client_serial and issuer_dn to pg_stat_ssl. These allow uniquely identifying the client certificate. Rename the existing column clientdn to client_dn, to make the naming more consistent and easier to read. Discussion: https://www.postgresql.org/message-id/flat/398754d8-6bb5-c5cf-e7b8-22e5f0983caf@2ndquadrant.com/
This commit is contained in:
@ -541,7 +541,7 @@ pg_stat_get_progress_info(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
pg_stat_get_activity(PG_FUNCTION_ARGS)
|
||||
{
|
||||
#define PG_STAT_GET_ACTIVITY_COLS 24
|
||||
#define PG_STAT_GET_ACTIVITY_COLS 26
|
||||
int num_backends = pgstat_fetch_stat_numbackends();
|
||||
int curr_backend;
|
||||
int pid = PG_ARGISNULL(0) ? -1 : PG_GETARG_INT32(0);
|
||||
@ -652,15 +652,29 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
|
||||
values[20] = CStringGetTextDatum(beentry->st_sslstatus->ssl_cipher);
|
||||
values[21] = Int32GetDatum(beentry->st_sslstatus->ssl_bits);
|
||||
values[22] = BoolGetDatum(beentry->st_sslstatus->ssl_compression);
|
||||
if (beentry->st_sslstatus->ssl_clientdn[0])
|
||||
values[23] = CStringGetTextDatum(beentry->st_sslstatus->ssl_clientdn);
|
||||
|
||||
if (beentry->st_sslstatus->ssl_client_dn[0])
|
||||
values[23] = CStringGetTextDatum(beentry->st_sslstatus->ssl_client_dn);
|
||||
else
|
||||
nulls[23] = true;
|
||||
|
||||
if (beentry->st_sslstatus->ssl_client_serial[0])
|
||||
values[24] = DirectFunctionCall3(numeric_in,
|
||||
CStringGetDatum(beentry->st_sslstatus->ssl_client_serial),
|
||||
ObjectIdGetDatum(InvalidOid),
|
||||
Int32GetDatum(-1));
|
||||
else
|
||||
nulls[24] = true;
|
||||
|
||||
if (beentry->st_sslstatus->ssl_issuer_dn[0])
|
||||
values[25] = CStringGetTextDatum(beentry->st_sslstatus->ssl_issuer_dn);
|
||||
else
|
||||
nulls[25] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
values[18] = BoolGetDatum(false); /* ssl */
|
||||
nulls[19] = nulls[20] = nulls[21] = nulls[22] = nulls[23] = true;
|
||||
nulls[19] = nulls[20] = nulls[21] = nulls[22] = nulls[23] = nulls[24] = nulls[25] = true;
|
||||
}
|
||||
|
||||
/* Values only available to role member or pg_read_all_stats */
|
||||
|
Reference in New Issue
Block a user