The system information functions provided by the database can retrieve session and system information. See the table below for details.
Function name | Returned values | Description |
current_database() | name | Name of current database |
current_schema() | name | Current schema name |
current_schemas(boolean) | name[] | All schemas set by search_path |
current_user | name | User |
inet_client_addr() | inet | Current client address (valid in remote connection mode) |
inet_client_port() | int | Current client port (valid in remote connection mode) |
inet_server_addr() | inet | IP address of the server that accepts connections (valid in remote connection mode) |
inet_server_port() | int | Port of the server that accepts connections (valid in remote connection mode) |
pg_postmaster_start_time() | timestamp with time zone | Server start time |
session_user | name | Session username |
user | name | Equivalent to current_user |
version() | text | PostgreSQL version |