[postgres@localhost bin]$ ./psql -h localhost
psql (9.4.5)
Type "help" for help.
postgres=# select version();
version
-----------------------------------------------------------------------------------
PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.9.3, 64-bit
(1 row)
name of current database
LB308B=# select current_catalog;
current_database
------------------
LB308B
(1 row)
LB308B=# select current_database();
current_database
------------------
LB308B
(1 row)
postgres=# select current_catalog;
current_database
------------------
postgres
(1 row)
text of the currently executing query
postgres=# select current_query();
current_query
-------------------------
select current_query();
(1 row)
name of current schema
postgres=# select current_schema();
current_schema
----------------
public
(1 row)
user name of current execution context
postgres=# select current_user;
current_user
--------------
postgres
(1 row)
port of the local connection
postgres=# select inet_server_port();
inet_server_port
------------------
5432
(1 row)
address of the remote connection and
address of the local connection
postgres=# select inet_client_addr();
inet_client_addr
------------------
::1
(1 row)
postgres=# select inet_server_addr();
inet_server_addr
------------------
::1
(1 row)
server start time
postgres=# select pg_postmaster_start_time();
pg_postmaster_start_time
------------------------------
2016-01-28 14:36:03.32585+08
(1 row)