Skip to content

Commit be37ac2

Browse files
committed
psql: Report full protocol version in \conninfo output.
Commit bba2fbc modified \conninfo to display the protocol version used by the current connection, but it only showed the major version (e.g., 3). This commit updates \conninfo to display the full protocol version (e.g., 3.2). Since support for new version 3.2 was added in v18, and the server supports both 3.0 and 3.2, showing the complete version helps users understand exactly which protocol version the current session is using. Although this is a minor behavior change, it's considered a fix for an oversight in the original patch and is included in v18. Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: David G. Johnston <david.g.johnston@gmail.com> Discussion: https://postgr.es/m/685961b8-b6ce-40bb-b2d5-c2ff135d3388@oss.nttdata.com
1 parent eb124c3 commit be37ac2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bin/psql/command.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ exec_command_conninfo(PsqlScanState scan_state, bool active_branch)
778778
int ssl_in_use,
779779
password_used,
780780
gssapi_used;
781+
int version_num;
781782
char *paramval;
782783

783784
if (!active_branch)
@@ -793,7 +794,9 @@ exec_command_conninfo(PsqlScanState scan_state, bool active_branch)
793794
/* Get values for the parameters */
794795
host = PQhost(pset.db);
795796
hostaddr = PQhostaddr(pset.db);
796-
protocol_version = psprintf("%d", PQprotocolVersion(pset.db));
797+
version_num = PQfullProtocolVersion(pset.db);
798+
protocol_version = psprintf("%d.%d", version_num / 10000,
799+
version_num % 10000);
797800
ssl_in_use = PQsslInUse(pset.db);
798801
password_used = PQconnectionUsedPassword(pset.db);
799802
gssapi_used = PQconnectionUsedGSSAPI(pset.db);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy