PostgreSQL Session Functions
This page organizes commonly used PostgreSQL session information functions that can extract session and system information.
-
current_catalog
The PostgreSQLcurrent_catalogreturns the name of the current database. -
current_database
The PostgreSQLcurrent_database()function returns the name of the current database. -
current_query
The PostgreSQLcurrent_query()function returns one or more executing statements submitted by the current client. -
current_role
The PostgreSQLcurrent_rolereturns the name of the current user (the user of the current execution context). -
current_schema
The PostgreSQLcurrent_schema()function returns the name of the current schema. -
current_schemas
The PostgreSQL function returns all schema names on the currently valid search path in order of priority. -
current_user
The PostgreSQLcurrent_userreturns the name of the current user (the user of the current execution context). -
inet_client_port
The PostgreSQLinet_client_port()function returns the current client’s IP port number. -
inet_server_addr
The PostgreSQLinet_server_addr()function returns the IP address of the server that accepts the current connection, or if the current connection is connected through a Unix socketNULL. -
inet_server_port
The PostgreSQLinet_server_port()function returns the IP port of the server that accepts the current connection. -
pg_backend_pid
The PostgreSQLpg_backend_pid()function returns the process ID of the server process to which the current session is connected. -
pg_blocking_pids
The PostgreSQLpg_blocking_pids()function returns a list of process IDs of sessions that prevent the specified session from acquiring locks. -
pg_conf_load_time
The PostgreSQLpg_conf_load_time()function returns the last time the server configuration file was loaded (with timezone information). -
pg_current_logfile
The PostgreSQLpg_current_logfile()function returns the currently used log file path. -
pg_is_other_temp_schema
The PostgreSQLpg_is_other_temp_schema()function checks whether the specified OID is the OID of another session’s temporary schema. -
pg_jit_available
The PostgreSQLpg_jit_available()function checks if the JIT compiler extension is available. -
pg_listening_channels
The PostgreSQLpg_listening_channels()function returns the name of the asynchronous notification channel the current session is listening on. -
pg_my_temp_schema
The PostgreSQLpg_my_temp_schema()function returns the OID of the temporary schema for the current session. -
pg_notification_queue_usage
The PostgreSQLpg_notification_queue_usage()function returns the maximum size portion of the asynchronous notification queue currently occupied by unprocessed notifications. -
pg_postmaster_start_time
The PostgreSQLpg_postmaster_start_time()function returns the time the server was started. -
pg_trigger_depth
The PostgreSQLpg_trigger_depth()function returns the current nesting level of triggers. -
user
The PostgreSQLuserreturns the name of the current user (the user of the current execution context). -
version
The PostgreSQLversion()function returns the version of the current PostgreSQL server.