PostgreSQL Session Functions

This page organizes commonly used PostgreSQL session information functions that can extract session and system information.

  1. current_catalog

    The PostgreSQL current_catalog returns the name of the current database.
  2. current_database

    The PostgreSQL current_database() function returns the name of the current database.
  3. current_query

    The PostgreSQL current_query() function returns one or more executing statements submitted by the current client.
  4. current_role

    The PostgreSQL current_role returns the name of the current user (the user of the current execution context).
  5. current_schema

    The PostgreSQL current_schema() function returns the name of the current schema.
  6. current_schemas

    The PostgreSQL function returns all schema names on the currently valid search path in order of priority.
  7. current_user

    The PostgreSQL current_user returns the name of the current user (the user of the current execution context).
  8. inet_client_port

    The PostgreSQL inet_client_port() function returns the current client’s IP port number.
  9. inet_server_addr

    The PostgreSQL inet_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 socket NULL.
  10. inet_server_port

    The PostgreSQL inet_server_port() function returns the IP port of the server that accepts the current connection.
  11. pg_backend_pid

    The PostgreSQL pg_backend_pid() function returns the process ID of the server process to which the current session is connected.
  12. pg_blocking_pids

    The PostgreSQL pg_blocking_pids() function returns a list of process IDs of sessions that prevent the specified session from acquiring locks.
  13. pg_conf_load_time

    The PostgreSQL pg_conf_load_time() function returns the last time the server configuration file was loaded (with timezone information).
  14. pg_current_logfile

    The PostgreSQL pg_current_logfile() function returns the currently used log file path.
  15. pg_is_other_temp_schema

    The PostgreSQL pg_is_other_temp_schema() function checks whether the specified OID is the OID of another session’s temporary schema.
  16. pg_jit_available

    The PostgreSQL pg_jit_available() function checks if the JIT compiler extension is available.
  17. pg_listening_channels

    The PostgreSQL pg_listening_channels() function returns the name of the asynchronous notification channel the current session is listening on.
  18. pg_my_temp_schema

    The PostgreSQL pg_my_temp_schema() function returns the OID of the temporary schema for the current session.
  19. pg_notification_queue_usage

    The PostgreSQL pg_notification_queue_usage() function returns the maximum size portion of the asynchronous notification queue currently occupied by unprocessed notifications.
  20. pg_postmaster_start_time

    The PostgreSQL pg_postmaster_start_time() function returns the time the server was started.
  21. pg_trigger_depth

    The PostgreSQL pg_trigger_depth() function returns the current nesting level of triggers.
  22. user

    The PostgreSQL user returns the name of the current user (the user of the current execution context).
  23. version

    The PostgreSQL version() function returns the version of the current PostgreSQL server.