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.

SELECT CURRENT_CATALOG;

CURRENT_ROLE

Current role

SELECT CURRENT_ROLE;

CURRENT_SCHEMA

Current database model

SELECT CURRENT_SCHEMA;

CURRENT_USER

Current user

SELECT CURRENT_USER;

LOCALTIMESTAMP

Current session time (without time zone)

SELECT LOCALTIMESTAMP;

NULL

This parameter is left blank.

-

SESSION_USER

Current system user

SELECT SESSION_USER;

SYSDATE

Current system date

SELECT SYSDATE;

or

SELECT now()::DATE;

USER

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

SELECT USER;