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.

SELECT CURRENT_CATALOG;
current_database
------------------
gaussdb
(1 row)

CURRENT_ROLE

Current role

SELECT CURRENT_ROLE;
current_user
--------------
(1 row)

CURRENT_SCHEMA

Current database model

SELECT CURRENT_SCHEMA;
current_schema
----------------
public
(1 row)

CURRENT_USER

Current user

SELECT CURRENT_USER;
current_user
--------------
(1 row)

LOCALTIMESTAMP

Current session time (without time zone)

SELECT LOCALTIMESTAMP;
         timestamp
----------------------------
2015-10-10 15:37:30.968538
(1 row)

NULL

This parameter is left blank.

-

SESSION_USER

Current system user

SELECT SESSION_USER;
session_user
--------------
(1 row)

SYSDATE

Current system date

SELECT SYSDATE;
sysdate
---------------------
2015-10-10 15:48:53
(1 row)

USER

Current user, also called CURRENT_USER

SELECT USER;
current_user
--------------
(1 row)