Updated on 2024-09-02 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

Example SQL Statements

CURRENT_CATALOG

Specifies the current database.

1
SELECT CURRENT_CATALOG;

CURRENT_ROLE

Current role

1
SELECT CURRENT_ROLE;

CURRENT_SCHEMA

Current database model

1
SELECT CURRENT_SCHEMA;

CURRENT_USER

Current user

1
SELECT CURRENT_USER;

LOCALTIMESTAMP

Current session time (without time zone)

1
SELECT LOCALTIMESTAMP;

NULL

This parameter is left blank.

-

SESSION_USER

Current system user

1
SELECT SESSION_USER;

SYSDATE

Current system date

1
SELECT SYSDATE;

or

SELECT now()::DATE;

USER

Current user, which is the same as the value of CURRENT_USER.

1
SELECT USER;