Categories:

Context Functions (Session)

CURRENT_USER

Returns the name of the user currently logged into the system.

Syntax

CURRENT_USER()

CURRENT_USER

Usage Notes

  • To comply with ANSI standards, this function can be called without parentheses.

  • Granting access on a secure UDF or secure view that contains this function to a share is allowed. When the secure UDF or secure view is accessed from the data sharing consumer account, this function always returns a NULL value.

  • Snowflake returns a NULL value if this function is used in a masking policy or row access policy that is assigned to a shared table or view.

Examples

This shows how to call the CURRENT_USER function:

SELECT CURRENT_USER();

Output:

+----------------+
| CURRENT_USER() |
|----------------|
| TSMITH         |
+----------------+
Back to top