Open TCeason opened 2 months ago
Hey there, @TCeason! 👋 I'm here to help you with any bugs, questions, or contributions you have. I'm like a bot with a heart! 😄
The "show columns from clusters from system" SQL command returns a "Permission denied" error for the 'root' user because the user does not have the required privileges for the 'system' database. Even though the 'root' user is granted all available privileges on a global level, specific operations within the 'system' database may still require additional privileges [1].
To resolve this, you can explicitly grant the necessary privileges to the 'root' user for the 'system' database. Here is a code snippet to do that:
use databend_common_meta_app::principal::{GrantObject, UserPrivilegeType, UserGrantSet};
use enumflags2::make_bitflags;
let mut user = UserInfo::new_no_auth("root", "%");
let mut grants = UserGrantSet::empty();
grants.grant_privileges(
&GrantObject::Database("system".to_string()),
make_bitflags!(UserPrivilegeType::{Select | Insert | Update | Delete}).into(),
);
user.grants = grants;
session.set_authed_user(user, None).await.unwrap();
This code grants the 'root' user the necessary privileges to access the 'system' database [2][3].
To continue talking to Dosu, mention @dosu.
Summary