diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index 497e3d8834b..7033134a75d 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -1661,6 +1661,7 @@ bool InterpreterCreateQuery::doCreateTable(ASTCreateQuery & create, drop_ast->no_ddl_lock = true; auto drop_context = Context::createCopy(context); + drop_context->setSetting("check_table_dependencies", false); InterpreterDropQuery interpreter(drop_ast, drop_context); interpreter.execute(); } diff --git a/tests/queries/0_stateless/03243_create_or_replace_view_dependency_check.reference b/tests/queries/0_stateless/03243_create_or_replace_view_dependency_check.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03243_create_or_replace_view_dependency_check.sql b/tests/queries/0_stateless/03243_create_or_replace_view_dependency_check.sql new file mode 100644 index 00000000000..9432ef9b50c --- /dev/null +++ b/tests/queries/0_stateless/03243_create_or_replace_view_dependency_check.sql @@ -0,0 +1,21 @@ +drop table if exists test; +drop view if exists v; +drop dictionary if exists dict; +create table test (x UInt32, v String) engine=Memory; +create view v (x UInt32, v String) as select x, v from test; +CREATE DICTIONARY dict +( + x UInt64, + v String +) +PRIMARY KEY x +SOURCE(CLICKHOUSE(TABLE 'v')) +LAYOUT(FLAT()) +LIFETIME(MIN 0 MAX 1000); + +drop view v; -- {serverError HAVE_DEPENDENT_OBJECTS} +create or replace view v (x UInt32, v String, y UInt32) as select x, v, 42 as y from test; +drop dictionary dict; +drop view v; +drop table test; +