pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16628: Hostame and string connection functions
5+ messages / 3 participants
[nested] [flat]

* BUG #16628: Hostame and string connection functions
@ 2020-09-22 18:57 PG Bug reporting form <noreply@postgresql.org>
  2020-09-24 21:07 ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 5+ messages in thread

From: PG Bug reporting form @ 2020-09-22 18:57 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: anderson.ant.oli@gmail.com

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 ();
select get_string_connection ();



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #16628: Hostame and string connection functions
  2020-09-22 18:57 BUG #16628: Hostame and string connection functions PG Bug reporting form <noreply@postgresql.org>
@ 2020-09-24 21:07 ` Bruce Momjian <bruce@momjian.us>
  2023-04-22 14:57   ` Re: BUG #16628: Hostame and string connection functions Anderson Antunes <anderson.ant.oli@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2020-09-24 21:07 UTC (permalink / raw)
  To: anderson.ant.oli@gmail.com; pgsql-bugs@lists.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






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #16628: Hostame and string connection functions
  2020-09-22 18:57 BUG #16628: Hostame and string connection functions PG Bug reporting form <noreply@postgresql.org>
  2020-09-24 21:07 ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
@ 2023-04-22 14:57   ` Anderson Antunes <anderson.ant.oli@gmail.com>
  2023-04-28 18:47     ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Anderson Antunes @ 2023-04-22 14:57 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-bugs@lists.postgresql.org

I'm sorry for not responding earlier. She ended up falling into spam. I
solved it by creating a specific variable in the postgresql configuration
file.

If it's not too much trouble, I have another question: my name is Anderson
Antunes. I live in Brazil. I'm doing research for a master's project
about pseudo
random numbers and would like to know more information about the random()
function used to randomly order a set of records. I tried to search through
the site that offers the source code but I couldn't identify the exact
implementation of this function.

[image: image.png]
https://doxygen.postgresql.org/
[image: image.png]

Can you help me?




Em qui., 24 de set. de 2020 às 18:07, Bruce Momjian <bruce@momjian.us>
escreveu:

> 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
>
>

-- 
Atenciosamente,
Anderson Antunes
Bento Gonçalves
(53) 9142-2910

Attachments:

image.png (image/png, 55.8K) download view image
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: BUG #16628: Hostame and string connection functions
  2020-09-22 18:57 BUG #16628: Hostame and string connection functions PG Bug reporting form <noreply@postgresql.org>
  2020-09-24 21:07 ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
  2023-04-22 14:57   ` Re: BUG #16628: Hostame and string connection functions Anderson Antunes <anderson.ant.oli@gmail.com>
@ 2023-04-28 18:47     ` Bruce Momjian <bruce@momjian.us>
  2023-04-28 19:59       ` Re: BUG #16628: Hostame and string connection functions Anderson Antunes <anderson.ant.oli@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2023-04-28 18:47 UTC (permalink / raw)
  To: Anderson Antunes <anderson.ant.oli@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

On Sat, Apr 22, 2023 at 11:57:06AM -0300, Anderson Antunes wrote:
> I'm sorry for not responding earlier. She ended up falling into spam. I solved
> it by creating a specific variable in the postgresql configuration file.
> 
> If it's not too much trouble, I have another question: my name is Anderson
> Antunes. I live in Brazil. I'm doing research for a master's project about
> pseudo random numbers and would like to know more information about the random
> () function used to randomly order a set of records. I tried to search through
> the site that offers the source code but I couldn't identify the exact
> implementation of this function. 

Looks like random() internally is called drandom():

	\x
	\df+ random
	List of functions
	-[ RECORD 1 ]-------+-----------------
	Schema              | pg_catalog
	Name                | random
	Result data type    | double precision
	Argument data types |
	Type                | func
	Volatility          | volatile
	Parallel            | restricted
	Owner               | postgres
	Security            | invoker
	Access privileges   |
	Language            | internal
-->	Internal name       | drandom
	Description         | random value

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Embrace your flaws.  They make you human, rather than perfect,
  which you will never be.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #16628: Hostame and string connection functions
  2020-09-22 18:57 BUG #16628: Hostame and string connection functions PG Bug reporting form <noreply@postgresql.org>
  2020-09-24 21:07 ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
  2023-04-22 14:57   ` Re: BUG #16628: Hostame and string connection functions Anderson Antunes <anderson.ant.oli@gmail.com>
  2023-04-28 18:47     ` Re: BUG #16628: Hostame and string connection functions Bruce Momjian <bruce@momjian.us>
@ 2023-04-28 19:59       ` Anderson Antunes <anderson.ant.oli@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Anderson Antunes @ 2023-04-28 19:59 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-bugs@lists.postgresql.org

I'll look. Thanks.

Em sex., 28 de abr. de 2023 às 15:47, Bruce Momjian <bruce@momjian.us>
escreveu:

> On Sat, Apr 22, 2023 at 11:57:06AM -0300, Anderson Antunes wrote:
> > I'm sorry for not responding earlier. She ended up falling into spam. I
> solved
> > it by creating a specific variable in the postgresql configuration file.
> >
> > If it's not too much trouble, I have another question: my name is
> Anderson
> > Antunes. I live in Brazil. I'm doing research for a master's project
> about
> > pseudo random numbers and would like to know more information about the
> random
> > () function used to randomly order a set of records. I tried to search
> through
> > the site that offers the source code but I couldn't identify the exact
> > implementation of this function.
>
> Looks like random() internally is called drandom():
>
>         \x
>         \df+ random
>         List of functions
>         -[ RECORD 1 ]-------+-----------------
>         Schema              | pg_catalog
>         Name                | random
>         Result data type    | double precision
>         Argument data types |
>         Type                | func
>         Volatility          | volatile
>         Parallel            | restricted
>         Owner               | postgres
>         Security            | invoker
>         Access privileges   |
>         Language            | internal
> -->     Internal name       | drandom
>         Description         | random value
>
> --
>   Bruce Momjian  <bruce@momjian.us>        https://momjian.us
>   EDB                                      https://enterprisedb.com
>
>   Embrace your flaws.  They make you human, rather than perfect,
>   which you will never be.
>


-- 
Atenciosamente,
Anderson Antunes
Bento Gonçalves
(53) 9142-2910

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-04-28 19:59 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 18:57 BUG #16628: Hostame and string connection functions PG Bug reporting form <noreply@postgresql.org>
2020-09-24 21:07 ` Bruce Momjian <bruce@momjian.us>
2023-04-22 14:57   ` Anderson Antunes <anderson.ant.oli@gmail.com>
2023-04-28 18:47     ` Bruce Momjian <bruce@momjian.us>
2023-04-28 19:59       ` Anderson Antunes <anderson.ant.oli@gmail.com>

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