Help Center > > Developer Guide> SQL Reference> Constant and Macro

Constant and Macro

Updated at:Aug 27, 2020 GMT+08:00

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
------------------
postgres
(1 row)

CURRENT_ROLE

Current user

1
2
3
4
5
SELECT CURRENT_ROLE;
current_user
--------------
dbadmin
(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
5
SELECT CURRENT_USER;
current_user
--------------
dbadmin
(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
5
SELECT SESSION_USER;
session_user
--------------
dbadmin
(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
5
SELECT USER;
current_user
--------------
dbadmin
(1 row)

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel