Hologres is compatible with PostgreSQL and allows you to use the standard PostgreSQL syntax to develop data.
The following table describes the session information functions supported by Hologres. The functions supported by Hologres are only a subset of the PostgreSQL functions. For more information about how to use these functions, see System Information Functions in the PostgreSQL documentation.
Function | Description |
Returns the name of the current catalog. | |
Returns the name of the current database. | |
Returns the query statement that is being executed. | |
Returns the ID of the account that is being used to perform operations on the database. | |
Returns the name of the current schema. | |
Returns an array of the names of all available schemas in the current search path. | |
Returns the ID of the current account. | |
Returns the remote connection address of the current user. | |
Returns the remote connection port of the current user. | |
Returns the IP address of the current server. | |
Returns the port number of the current server. | |
Returns the ID of the server process to which the current session belongs. | |
Returns the ID of the process that is blocking the specified server process ID from acquiring a lock. | |
Returns the account ID of the user for the current session. | |
Returns the account ID of the current logon user. | |
Returns the version of PostgreSQL. |
CURRENT_CATALOG
Description: Returns the name of the current catalog.
CURRENT_CATALOG
Return value:
The name of the current catalog is returned.
Example:
SELECT CURRENT_CATALOG;
The following result is returned:
current_catalog ----------------- hologrestest
CURRENT_DATABASE
Description: Returns the name of the current database.
CURRENT_DATABASE()
Return value:
The name of the current database is returned.
Example:
SELECT CURRENT_DATABASE();
The following result is returned:
current_database ------------------ hologrestest
CURRENT_QUERY
Description: Returns the query statement that is being executed.
CURRENT_QUERY()
Return value:
The query statement that is being executed is returned.
Example:
SELECT CURRENT_QUERY();
The following result is returned:
current_query ------------------------- SELECT CURRENT_QUERY();
CURRENT_ROLE
Description: Returns the ID of the account that is being used to perform operations on the database.
CURRENT_ROLE
Return value:
The ID of the account that is being used to perform operations on the database is returned.
Example:
SELECT CURRENT_ROLE;
The following result is returned:
current_role ------------------ 139699392458****
CURRENT_SCHEMA
Description: Returns the name of the current schema.
CURRENT_SCHEMA[()]
Return value:
The name of the current schema is returned.
Example:
SELECT CURRENT_SCHEMA();
The following result is returned:
current_schema ---------------- public
CURRENT_SCHEMAS
Description: Returns an array of the names of all available schemas in the current search path.
CURRENT_SCHEMAS(FLAG)
Parameters:
FLAG: specifies whether implicit schemas, such as pg_catalog, are included in the returned schemas. Valid values: TRUE and FALSE.
Return value:
An array of the names of all available schemas in the current search path is returned.
If the FLAG parameter is set to TRUE, implicit schemas, such as pg_catalog, are included in the returned schemas.
If the FLAG parameter is set to FALSE, implicit schemas, such as pg_catalog, are not included in the returned schemas.
Examples:
Example 1:
SELECT CURRENT_SCHEMAS(TRUE);
The following result is returned:
current_schemas --------------------- {pg_catalog,public}
Example 2:
SELECT CURRENT_SCHEMAS(FALSE);
The following result is returned:
current_schemas --------------------- {public}
CURRENT_USER
Description: Returns the ID of the current account.
CURRENT_USER
Return value:
The ID of the current account is returned.
Example:
SELECT CURRENT_USER;
The following result is returned:
current_user ------------------ 139699392458****
INET_CLIENT_ADDR
Description: Returns the remote connection address of the current user.
INET_CLIENT_ADDR()
Return value:
The remote connection address of the current user is returned.
Example:
SELECT INET_CLIENT_ADDR();
The following result is returned:
inet_client_addr ------------------ 124.8*.1**.1**
INET_CLIENT_PORT
Description: Returns the remote connection port of the current user.
INET_CLIENT_PORT()
Return value:
The remote connection port of the current user is returned.
Example:
SELECT INET_CLIENT_PORT();
The following result is returned:
inet_client_port ------------------ 5823
INET_SERVER_ADDR
Description: Returns the IP address of the current server.
INET_SERVER_ADDR()
Return value: The IP address of the current server is returned.
Example:
SELECT INET_SERVER_ADDR();
The following result is returned:
inet_server_addr ------------------ 10.**.4*.4*
INET_SERVER_PORT
Description: Returns the port number of the current server.
INET_SERVER_PORT()
Return value:
The port number of the current server is returned.
Example:
SELECT INET_SERVER_PORT();
The following result is returned:
inet_server_port ------------------ 42581
PG_BACKEND_PID
Description: Returns the ID of the server process to which the current session belongs.
PG_BACKEND_PID()
Return value:
The ID of the server process to which the current session belongs is returned.
Example:
SELECT PG_BACKEND_PID();
The following result is returned:
pg_backend_pid ---------------- 53674002
PG_BLOCKING_PIDS
Description: Returns the ID of the process that is blocking the specified server process ID from acquiring a lock.
PG_BLOCKING_PIDS(INT)
Return value: The ID of the process that is blocking the specified server process ID from acquiring a lock is returned.
Example:
SELECT PG_BLOCKING_PIDS(1);
The following result is returned:
pg_blocking_pids ------------------ {}
SESSION_USER
Description: Returns the account ID of the user for the current session.
SESSION_USER
Return value:
The account ID of the user for the current session is returned.
Example:
SELECT SESSION_USER;
The following result is returned:
session_user ------------------ 139699392458****
USER
Description: Returns the account ID of the current logon user.
USER
Return value: The account ID of the current logon user is returned.
Example:
SELECT USER;
The following result is returned:
user ------------------ 139699392458****
VERSION
Description: Returns the version of PostgreSQL.
VERSION()
Return value: The version of PostgreSQL is returned.
Example:
SELECT VERSION();
The following result is returned:
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)