mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #66395 from ClickHouse/continue-66261
Ignore subquery for IN in DDLLoadingDependencyVisitor
This commit is contained in:
commit
27dc6a6e1f
@ -11,6 +11,7 @@
|
||||
#include <Parsers/ASTFunction.h>
|
||||
#include <Parsers/ASTIdentifier.h>
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
#include <Parsers/ASTSubquery.h>
|
||||
#include <Parsers/ASTSelectWithUnionQuery.h>
|
||||
#include <Parsers/ASTTTLElement.h>
|
||||
#include <Poco/String.h>
|
||||
@ -211,6 +212,13 @@ void DDLLoadingDependencyVisitor::extractTableNameFromArgument(const ASTFunction
|
||||
qualified_name.database = table_identifier->getDatabaseName();
|
||||
qualified_name.table = table_identifier->shortName();
|
||||
}
|
||||
else if (arg->as<ASTSubquery>())
|
||||
{
|
||||
/// Allow IN subquery.
|
||||
/// Do not add tables from the subquery into dependencies,
|
||||
/// because CREATE will succeed anyway.
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
|
@ -1 +1,2 @@
|
||||
42
|
||||
42
|
||||
|
@ -17,3 +17,27 @@ ENGINE = MergeTree ORDER BY conversation;
|
||||
INSERT INTO t2(conversation) VALUES (42);
|
||||
|
||||
select * from t2;
|
||||
|
||||
drop table t1;
|
||||
|
||||
INSERT INTO t2(conversation) VALUES (42); -- { serverError UNKNOWN_TABLE }
|
||||
|
||||
drop table t2;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
`conversation` UInt64,
|
||||
CONSTRAINT constraint_conversation CHECK conversation IN (SELECT id FROM t1)
|
||||
)
|
||||
ENGINE = MergeTree ORDER BY conversation;
|
||||
|
||||
INSERT INTO t2(conversation) VALUES (42); -- { serverError UNKNOWN_TABLE }
|
||||
|
||||
CREATE TABLE t1 (
|
||||
`id` UInt64
|
||||
)
|
||||
ENGINE = MergeTree ORDER BY id;
|
||||
|
||||
INSERT INTO t1(id) VALUES (42);
|
||||
|
||||
INSERT INTO t2(conversation) VALUES (42);
|
||||
select * from t2;
|
||||
|
Loading…
Reference in New Issue
Block a user