Make function return initial user

This commit is contained in:
Alexandr Krasheninnikov 2019-08-14 15:18:11 +03:00
parent bc4177f64c
commit d9234a64c4
4 changed files with 5 additions and 3 deletions

View File

@ -15,7 +15,7 @@ public:
static constexpr auto name = "currentUser";
static FunctionPtr create(const Context & context)
{
return std::make_shared<FunctionCurrentUser>(context.getClientInfo().current_user);
return std::make_shared<FunctionCurrentUser>(context.getClientInfo().initial_user);
}
explicit FunctionCurrentUser(const String & user_name_) : user_name{user_name_}

View File

@ -1,4 +1,5 @@
-- since actual user name is unknown, have to perform just smoke tests
select currentUser() IS NOT NULL;
select length(currentUser()) > 0;
select currentUser() = user();
select currentUser() = user(), currentUser() = USER();
select currentUser() = initial_user from system.processes where query like '%$!@#%';

View File

@ -103,7 +103,7 @@ Returns the name of the current database.
You can use this function in table engine parameters in a CREATE TABLE query where you need to specify the database.
## currentUser()
Returns the login of authorized user.
Returns the login of authorized user (initiator of query execution).
## isFinite(x)