• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. SQL Reference
  5. Constant and Macro

Constant and Macro

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

Table 1 Constants and macros

Parameter

Description

Examples

CURRENT_CATALOG

Specifies the current database.

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

CURRENT_ROLE

Current user

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

CURRENT_SCHEMA

Current database model

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

CURRENT_USER

Current user

SELECT CURRENT_USER;
current_user
--------------
dbadmin
(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
--------------
dbadmin
(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
--------------
dbadmin
(1 row)