Hologres is compatible with PostgreSQL and supports standard PostgreSQL syntax for session information functions. The functions listed here are a subset of the PostgreSQL system information functions.
Supported functions
| Function | Syntax | Return type | Description |
|---|---|---|---|
| CURRENT_CATALOG | CURRENT_CATALOG | name | Returns the name of the current catalog. |
| CURRENT_DATABASE | CURRENT_DATABASE() | name | Returns the name of the current database. |
| CURRENT_QUERY | CURRENT_QUERY() | text | Returns the query statement being executed. |
| CURRENT_ROLE | CURRENT_ROLE | name | Returns the account ID used for database operations. |
| CURRENT_SCHEMA | CURRENT_SCHEMA[()] | name | Returns the name of the current schema. Parentheses are optional. |
| CURRENT_SCHEMAS | CURRENT_SCHEMAS(boolean) | name[] | Returns an array of schema names in the current search path. |
| CURRENT_USER | CURRENT_USER | name | Returns the ID of the current account. |
| INET_CLIENT_ADDR | INET_CLIENT_ADDR() | inet | Returns the IP address of the current client connection. |
| INET_CLIENT_PORT | INET_CLIENT_PORT() | integer | Returns the port of the current client connection. |
| INET_SERVER_ADDR | INET_SERVER_ADDR() | inet | Returns the IP address of the current server. |
| INET_SERVER_PORT | INET_SERVER_PORT() | integer | Returns the port of the current server. |
| PG_BACKEND_PID | PG_BACKEND_PID() | integer | Returns the process ID (PID) of the server process for the current session. |
| PG_BLOCKING_PIDS | PG_BLOCKING_PIDS(integer) | integer[] | Returns the PIDs of processes blocking the specified backend process from acquiring a lock. |
| SESSION_USER | SESSION_USER | name | Returns the account ID of the user for the current session. |
| USER | USER | name | Returns the account ID of the current logon user. |
| VERSION | VERSION() | text | Returns the PostgreSQL version string. |
CURRENT_CATALOG
Returns the name of the current catalog.
Syntax
CURRENT_CATALOGReturn type: name
Example
SELECT CURRENT_CATALOG;Result:
current_catalog
-----------------
hologrestestCURRENT_DATABASE
Returns the name of the current database.
Syntax
CURRENT_DATABASE()Return type: name
Example
SELECT CURRENT_DATABASE();Result:
current_database
------------------
hologrestestCURRENT_QUERY
Returns the query statement being executed.
Syntax
CURRENT_QUERY()Return type: text
Example
SELECT CURRENT_QUERY();Result:
current_query
-------------------------
SELECT CURRENT_QUERY();CURRENT_ROLE
Returns the account ID used for database operations.
Syntax
CURRENT_ROLEReturn type: name
Example
SELECT CURRENT_ROLE;Result:
current_role
------------------
139699392458****CURRENT_SCHEMA
Returns the name of the current schema. The parentheses are optional.
Syntax
CURRENT_SCHEMA[()]Return type: name
Example
SELECT CURRENT_SCHEMA();Result:
current_schema
----------------
publicCURRENT_SCHEMAS
Returns an array of schema names visible in the current search path.
Syntax
CURRENT_SCHEMAS(boolean)Parameters
| Parameter | Type | Description |
|---|---|---|
boolean | boolean | When TRUE, implicit schemas such as pg_catalog are included. When FALSE, they are excluded. |
Return type: name[]
Examples
Include implicit schemas:
SELECT CURRENT_SCHEMAS(TRUE);Result:
current_schemas
---------------------
{pg_catalog,public}Exclude implicit schemas:
SELECT CURRENT_SCHEMAS(FALSE);Result:
current_schemas
---------------------
{public}CURRENT_USER
Returns the ID of the current account.
Syntax
CURRENT_USERReturn type: name
Example
SELECT CURRENT_USER;Result:
current_user
------------------
139699392458****INET_CLIENT_ADDR
Returns the IP address of the current client connection.
Syntax
INET_CLIENT_ADDR()Return type: inet
Example
SELECT INET_CLIENT_ADDR();Result:
inet_client_addr
------------------
124.8*.1**.1**INET_CLIENT_PORT
Returns the port of the current client connection.
Syntax
INET_CLIENT_PORT()Return type: integer
Example
SELECT INET_CLIENT_PORT();Result:
inet_client_port
------------------
5823INET_SERVER_ADDR
Returns the IP address of the current server.
Syntax
INET_SERVER_ADDR()Return type: inet
Example
SELECT INET_SERVER_ADDR();Result:
inet_server_addr
------------------
10.**.4*.4*INET_SERVER_PORT
Returns the port of the current server.
Syntax
INET_SERVER_PORT()Return type: integer
Example
SELECT INET_SERVER_PORT();Result:
inet_server_port
------------------
42581PG_BACKEND_PID
Returns the process ID (PID) of the server process attached to the current session.
Syntax
PG_BACKEND_PID()Return type: integer
Example
SELECT PG_BACKEND_PID();Result:
pg_backend_pid
----------------
53674002PG_BLOCKING_PIDS
Returns an array of backend process IDs that are blocking the specified backend process from acquiring a lock. Returns an empty array ({}) if no blocking processes exist.
Syntax
PG_BLOCKING_PIDS(integer)Parameters
| Parameter | Type | Description |
|---|---|---|
integer | integer | The backend process ID to check for blockers. Use PG_BACKEND_PID() to get the current session's PID. |
Return type: integer[]
Example
SELECT PG_BLOCKING_PIDS(1);Result:
pg_blocking_pids
------------------
{}SESSION_USER
Returns the account ID of the user for the current session.
Syntax
SESSION_USERReturn type: name
Example
SELECT SESSION_USER;Result:
session_user
------------------
139699392458****USER
Returns the account ID of the current logon user.
Syntax
USERReturn type: name
Example
SELECT USER;Result:
user
------------------
139699392458****VERSION
Returns the PostgreSQL version string, including build details.
Syntax
VERSION()Return type: text
Example
SELECT VERSION();Result:
version
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11.3 (Release-build@6feee25dff7 on release-3.0.x) on x86_64-linux, compiled by clang version 13.0.1 (Alibaba 13.0.1-2.fix20240305102602.alios7 193811f571966bccce929b0f457df345c4fca5ed)