From f26da04cdfe53fb5238baaab2a54bf5698e6936c Mon Sep 17 00:00:00 2001 From: kssenii Date: Thu, 9 Sep 2021 09:53:01 +0300 Subject: [PATCH] Fix checks --- src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp | 5 ++--- src/Interpreters/InterpreterAlterQuery.cpp | 2 +- src/Storages/AlterCommands.h | 2 -- tests/integration/test_grant_and_revoke/test.py | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp index 0e441efc428..42720fa4eb1 100644 --- a/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp +++ b/src/Databases/PostgreSQL/DatabaseMaterializedPostgreSQL.cpp @@ -30,7 +30,6 @@ namespace DB namespace ErrorCodes { - extern const int NOT_IMPLEMENTED; extern const int LOGICAL_ERROR; extern const int QUERY_NOT_ALLOWED; extern const int UNKNOWN_TABLE; @@ -313,8 +312,8 @@ void DatabaseMaterializedPostgreSQL::attachTable(const String & table_name, cons StoragePtr DatabaseMaterializedPostgreSQL::detachTable(const String & table_name) { - /// If there is query context then we need to dettach materialized storage. - /// If there is no query context then we need to dettach internal storage from atomic database. + /// If there is query context then we need to detach materialized storage. + /// If there is no query context then we need to detach internal storage from atomic database. if (CurrentThread::isInitialized() && CurrentThread::get().getQueryContext()) { auto & table_to_delete = materialized_tables[table_name]; diff --git a/src/Interpreters/InterpreterAlterQuery.cpp b/src/Interpreters/InterpreterAlterQuery.cpp index 8a23acdefc4..fc519124a47 100644 --- a/src/Interpreters/InterpreterAlterQuery.cpp +++ b/src/Interpreters/InterpreterAlterQuery.cpp @@ -199,7 +199,7 @@ BlockIO InterpreterAlterQuery::executeToDatabase(const ASTAlterQuery & alter) if (command.type == AlterCommand::MODIFY_DATABASE_SETTING) database->applyNewSettings(command.settings_changes, getContext()); else - throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unsupported alter command"); + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported alter command"); } } } diff --git a/src/Storages/AlterCommands.h b/src/Storages/AlterCommands.h index ae1db10fb47..ad2647c321f 100644 --- a/src/Storages/AlterCommands.h +++ b/src/Storages/AlterCommands.h @@ -197,8 +197,6 @@ public: /// Commands have to be prepared before apply. void apply(StorageInMemoryMetadata & metadata, ContextPtr context) const; - - /// At least one command modify settings. bool hasSettingsAlterCommand() const; diff --git a/tests/integration/test_grant_and_revoke/test.py b/tests/integration/test_grant_and_revoke/test.py index 79fe4bf9f41..b905e4df219 100644 --- a/tests/integration/test_grant_and_revoke/test.py +++ b/tests/integration/test_grant_and_revoke/test.py @@ -151,7 +151,7 @@ def test_grant_all_on_table(): instance.query("GRANT ALL ON test.table TO A WITH GRANT OPTION") instance.query("GRANT ALL ON test.table TO B", user='A') assert instance.query( - "SHOW GRANTS FOR B") == "GRANT SHOW TABLES, SHOW COLUMNS, SHOW DICTIONARIES, SELECT, INSERT, ALTER, CREATE TABLE, CREATE VIEW, CREATE DICTIONARY, DROP TABLE, DROP VIEW, DROP DICTIONARY, TRUNCATE, OPTIMIZE, SYSTEM MERGES, SYSTEM TTL MERGES, SYSTEM FETCHES, SYSTEM MOVES, SYSTEM SENDS, SYSTEM REPLICATION QUEUES, SYSTEM DROP REPLICA, SYSTEM SYNC REPLICA, SYSTEM RESTART REPLICA, SYSTEM RESTORE REPLICA, SYSTEM FLUSH DISTRIBUTED, dictGet ON test.table TO B\n" + "SHOW GRANTS FOR B") == "GRANT SHOW TABLES, SHOW COLUMNS, SHOW DICTIONARIES, SELECT, INSERT, ALTER TABLE, ALTER VIEW, CREATE TABLE, CREATE VIEW, CREATE DICTIONARY, DROP TABLE, DROP VIEW, DROP DICTIONARY, TRUNCATE, OPTIMIZE, SYSTEM MERGES, SYSTEM TTL MERGES, SYSTEM FETCHES, SYSTEM MOVES, SYSTEM SENDS, SYSTEM REPLICATION QUEUES, SYSTEM DROP REPLICA, SYSTEM SYNC REPLICA, SYSTEM RESTART REPLICA, SYSTEM RESTORE REPLICA, SYSTEM FLUSH DISTRIBUTED, dictGet ON test.table TO B\n" instance.query("REVOKE ALL ON test.table FROM B", user='A') assert instance.query("SHOW GRANTS FOR B") == ""