[bug fix] psql's \conninfo reports incorrect destination on Windows - Mailing list pgsql-hackers

From MauMau
Subject [bug fix] psql's \conninfo reports incorrect destination on Windows
Date
Msg-id 8913B51B3B534F878D54B89E1EB964C6@maumau
Whole thread Raw
Responses Re: [bug fix] psql's \conninfo reports incorrect destination on Windows
List pgsql-hackers
Hello,

I've found a bug that psql's \conninfo displays incorrect information on
Windows.  Please find attached the patch and commit this.

[Problem]
When I run "psql postgres" on Windows and execute \conninfo, it outputs the
text below.  It reports that psql connected to the server via UNIX domain
socket, but the actual connection is of course via TCP/IP socket to
localhost.

You are connected to database "postgres" as user "Administrator" via socket
in "/tmp" at port "5432".

It should output:

You are connected to database "postgres" as user "Administrator" on host
"localhost" at port "5432".


[Cause]
\conninfo calls PQhost(conn) to get the destination info.  PQhost() in this
case returns NULL because conn->pghost and conn->pghostaddr are NULL.  When
\conninfo receives NULL from PQhost(), it assumes /tmp.


[Fix]
PQhost() should return the actual destination.


Regards
MauMau

Attachment

pgsql-hackers by date:

Previous
From: Metin Doslu
Date:
Subject: Re: Parallel Select query performance and shared buffers
Next
From: Metin Doslu
Date:
Subject: Re: [PERFORM] Parallel Select query performance and shared buffers