[bug fix] psql's \conninfo reports incorrect destination on Windows

From: "MauMau" <maumau307(at)gmail(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: [bug fix] psql's \conninfo reports incorrect destination on Windows
Date: 2013-12-04 12:21:19
Message-ID: 8913B51B3B534F878D54B89E1EB964C6@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
conninfo.patch application/octet-stream 881 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Metin Doslu 2013-12-04 13:19:29 Re: [PERFORM] Parallel Select query performance and shared buffers
Previous Message Metin Doslu 2013-12-04 12:19:03 Re: Parallel Select query performance and shared buffers