SCOPE_USER information available in UDF metadata
Details
| Detail name | Value |
|---|---|
| Changelog Number | 5998 |
| Type | Improvement |
| Status | Resolved |
| Fix Versions | EXASOL 6.0.9 |
| Resolution Date | 2018-04-27 |
Starting with EXASOL 6.0.9, UDF meta data contains the field SCOPE_USER which makes available the owner of the innermost virtual table or view the script is called in.
The field can be accessed in different UDF languages using the following syntax:
For instance, given the following Lua UDF and view owned by the SYS user:
create lua scalar script get_scope_user_lua() returns varchar(200) as function run(ctx) return exa.meta.scope_user end / create or replace view scope_user_view as select get_scope_user_lua() as my_scope_user; grant select on scope_user_view to u1; grant execute on get_scope_user_lua to u1;
Now as user U1:
select get_scope_user_lua(); -- => returns U1
while
select * from scope_user_view; -- => returns SYS