Don't check dependencies during CREATE OR REPLACE VIEW during DROP of old table

This commit is contained in:
avogar 2024-09-24 14:38:35 +00:00
parent a6a707dae9
commit a8d39bd973
3 changed files with 22 additions and 0 deletions

View File

@ -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();
}

View File

@ -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;