Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sqlglot/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6348,6 +6348,10 @@ class CurrentRegion(Func):
arg_types = {}


class CurrentRole(Func):
arg_types = {}


class CurrentOrganizationUser(Func):
arg_types = {}

Expand Down
1 change: 1 addition & 0 deletions sqlglot/typing/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def _annotate_math_with_float_decfloat(
exp.Collation,
exp.CurrentOrganizationUser,
exp.CurrentRegion,
exp.CurrentRole,
exp.CurrentOrganizationName,
exp.DecompressString,
exp.HexDecodeString,
Expand Down
1 change: 1 addition & 0 deletions tests/dialects/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def test_snowflake(self):
self.validate_identity("SELECT OBJECT_CONSTRUCT()")
self.validate_identity("SELECT CURRENT_ORGANIZATION_USER()")
self.validate_identity("SELECT CURRENT_REGION()")
self.validate_identity("SELECT CURRENT_ROLE()")
self.validate_identity("SELECT YEAR(CURRENT_TIMESTAMP())")
self.validate_identity("SELECT YEAROFWEEK(CURRENT_TIMESTAMP())")
self.validate_identity("SELECT YEAROFWEEKISO(CURRENT_TIMESTAMP())")
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/optimizer/annotate_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2180,6 +2180,10 @@ VARCHAR;
CURRENT_REGION();
VARCHAR;

# dialect: snowflake
CURRENT_ROLE();
VARCHAR;

# dialect: snowflake
CURRENT_ORGANIZATION_NAME();
VARCHAR;
Expand Down