Syntax
Return Types
TEXT
Examples
The following code example shows the effective privileges of the roles directly assigned to the user running the query: Example Dynamic security through a view which usessession_user().
| user_name | … |
|---|---|
| alice | … |
Reference material for SESSION_USER function
SESSION_USER()
TEXT
session_user().
-- user bob created view:
create view my_employee_data as select * from employees where user_name = session_user();
-- user alice queries it:
select * from my_employee_data; -- session_user() will be evaluated to 'alice' for this query
| user_name | … |
|---|---|
| alice | … |
Was this page helpful?