From: Bruce Momjian <bruce@momjian.us>
To: anderson.ant.oli@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16628: Hostame and string connection functions
Date: Thu, 24 Sep 2020 17:07:03 -0400
Message-ID: <20200924210703.GF22807@momjian.us> (raw)
In-Reply-To: <16628-30860059aed1dd59@postgresql.org>
References: <16628-30860059aed1dd59@postgresql.org>
On Tue, Sep 22, 2020 at 06:57:13PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16628
> Logged by: Anderson Antunes
> Email address: anderson.ant.oli@gmail.com
> PostgreSQL version: 9.5.0
> Operating system: Linux
> Description:
>
> Hi,
>
> Is there any possibility of developing a function to retrieve hostname and
> the connection string?
>
> Example:
>
> select get_host_name ();
You can get the server IP address, but not the host name:
test=> SELECT inet_server_addr();
inet_server_addr
------------------
127.0.0.1
> select get_string_connection ();
Uh, the connection information is parsed by libpq, and visible in psql:
test=> \conninfo You are connected to database "test" as user
"postgres" on host "localhost" (address "127.0.0.1")
at port "5432".
but the server only sees the result. You can see the server port
number:
test=> SELECT inet_server_port();
inet_server_port
------------------
5432
I can't figure out how to query the SSL mode via SQL. Does this help?
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, anderson.ant.oli@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16628: Hostame and string connection functions
In-Reply-To: <20200924210703.GF22807@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox