Updated on 2022-06-11 GMT+08:00

Constant and Macro

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

Table 1 Constants and macros

Parameter

Description

Examples

CURRENT_CATALOG

Specifies the current database.

1
2
3
4
5
SELECT CURRENT_CATALOG;
current_database
------------------
gaussdb
(1 row)

CURRENT_ROLE

Current role

1
2
3
4
SELECT CURRENT_ROLE;
current_user
--------------
(1 row)

CURRENT_SCHEMA

Current database model

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

CURRENT_USER

Current user

1
2
3
4
SELECT CURRENT_USER;
current_user
--------------
(1 row)

LOCALTIMESTAMP

Current session time (without time zone)

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

NULL

This parameter is left blank.

-

SESSION_USER

Current system user

1
2
3
4
SELECT SESSION_USER;
session_user
--------------
(1 row)

SYSDATE

Current system date

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

USER

Current user, also called CURRENT_USER

1
2
3
4
SELECT USER;
current_user
--------------
(1 row)