mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix distributed IN without database on initiator (#15538)
This commit is contained in:
parent
ced9812054
commit
bad8171f24
@ -27,7 +27,9 @@ namespace
|
||||
|
||||
StoragePtr tryGetTable(const ASTPtr & database_and_table, const Context & context)
|
||||
{
|
||||
auto table_id = context.resolveStorageID(database_and_table);
|
||||
auto table_id = context.tryResolveStorageID(database_and_table);
|
||||
if (!table_id)
|
||||
return {};
|
||||
return DatabaseCatalog::instance().tryGetTable(table_id, context);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,2 @@
|
||||
0
|
||||
1
|
@ -0,0 +1,36 @@
|
||||
CREATE DATABASE IF NOT EXISTS shard_0;
|
||||
CREATE DATABASE IF NOT EXISTS shard_1;
|
||||
CREATE DATABASE IF NOT EXISTS main_01487;
|
||||
CREATE DATABASE IF NOT EXISTS test_01487;
|
||||
|
||||
USE main_01487;
|
||||
|
||||
DROP TABLE IF EXISTS shard_0.l;
|
||||
DROP TABLE IF EXISTS shard_1.l;
|
||||
DROP TABLE IF EXISTS d;
|
||||
DROP TABLE IF EXISTS t;
|
||||
|
||||
CREATE TABLE shard_0.l (value UInt8) ENGINE = MergeTree ORDER BY value;
|
||||
CREATE TABLE shard_1.l (value UInt8) ENGINE = MergeTree ORDER BY value;
|
||||
CREATE TABLE t (value UInt8) ENGINE = Memory;
|
||||
|
||||
INSERT INTO shard_0.l VALUES (0);
|
||||
INSERT INTO shard_1.l VALUES (1);
|
||||
INSERT INTO t VALUES (0), (1), (2);
|
||||
|
||||
CREATE TABLE d AS t ENGINE = Distributed(test_cluster_two_shards_different_databases, currentDatabase(), t);
|
||||
|
||||
USE test_01487;
|
||||
DROP DATABASE test_01487;
|
||||
|
||||
SELECT * FROM main_01487.d WHERE value IN (SELECT l.value FROM l) ORDER BY value;
|
||||
|
||||
USE main_01487;
|
||||
|
||||
DROP TABLE IF EXISTS shard_0.l;
|
||||
DROP TABLE IF EXISTS shard_1.l;
|
||||
DROP TABLE IF EXISTS d;
|
||||
DROP TABLE IF EXISTS t;
|
||||
|
||||
DROP DATABASE shard_0;
|
||||
DROP DATABASE shard_1;
|
Loading…
Reference in New Issue
Block a user