Merge pull request #71332 from ClickHouse/pufit/fix-inconsistent-ast-wildcard-grants

Fix inconsistent AST formatting when granting wrong wildcard grants
This commit is contained in:
pufit 2024-11-01 18:48:34 +00:00 committed by GitHub
commit e2c372f8b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View File

@ -117,6 +117,7 @@ GRANT SELECT ON db*.* TO john -- correct
GRANT SELECT ON *.my_table TO john -- wrong
GRANT SELECT ON foo*bar TO john -- wrong
GRANT SELECT ON *suffix TO john -- wrong
GRANT SELECT(foo) ON db.table* TO john -- wrong
```
## Privileges

View File

@ -155,6 +155,9 @@ namespace
for (auto & [access_flags, columns] : access_and_columns)
{
if (wildcard && !columns.empty())
return false;
AccessRightsElement element;
element.access_flags = access_flags;
element.columns = std::move(columns);

View File

@ -19,4 +19,6 @@ REVOKE SELECT ON team*.* FROM user_03141;
SHOW GRANTS FOR user_03141;
SELECT '---';
GRANT SELECT(bar) ON foo.test* TO user_03141; -- { clientError SYNTAX_ERROR }
DROP USER user_03141;