Updated on 2023-10-23 GMT+08:00

Constant and Macro

Table 1 lists the constants and macros that can be used in GaussDB.

Table 1 Constant and macro

Parameter

Description

Example

CURRENT_CATALOG

Specifies the current database.

1
2
3
4
5
openGauss=# SELECT CURRENT_CATALOG;
current_database
------------------
openGauss
(1 row)

CURRENT_ROLE

Specifies the current user.

1
2
3
4
5
openGauss=# SELECT CURRENT_ROLE;
current_user
--------------
omm
(1 row)

CURRENT_SCHEMA

Specifies the current database schema.

1
2
3
4
5
openGauss=# SELECT CURRENT_SCHEMA;
current_schema
----------------
public
(1 row)

CURRENT_USER

Specifies the current user.

1
2
3
4
5
openGauss=# SELECT CURRENT_USER;
current_user
--------------
omm
(1 row)

LOCALTIMESTAMP

Specifies the current session time (without time zone).

1
2
3
4
5
openGauss=# SELECT LOCALTIMESTAMP;
         timestamp
----------------------------
2015-10-10 15:37:30.968538
(1 row)

NULL

This parameter is left blank.

N/A

SESSION_USER

Specifies the current system user.

1
2
3
4
5
openGauss=# SELECT SESSION_USER;
session_user
--------------
omm
(1 row)

SYSDATE

Specifies the current system date.

1
2
3
4
5
openGauss=# SELECT SYSDATE;
sysdate
---------------------
2015-10-10 15:48:53
(1 row)

USER

Specifies the current user, also called CURRENT_USER.

1
2
3
4
5
openGauss=# SELECT USER;
current_user
--------------
omm
(1 row)