ClickHouse/tests/queries/0_stateless/02175_distributed_join_current_database.sql
Azat Khuzhin c341b3b237 Add current database to table names in JOIN section for distributed queries
This should fix JOIN w/o explicit database.

v2: rewrite only JOIN section, since there is old behavior that relies
on default_database for IN section, see [1]:
- 01487_distributed_in_not_default_db
- 01152_cross_replication

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/33611/d0ea3c76fa51131171b1825939680867eb1c04da/fast_test__actions_.html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-14 11:23:38 +03:00

20 lines
714 B
SQL

-- Tags: shard
drop table if exists local_02175;
drop table if exists dist_02175;
create table local_02175 engine=Memory() as select * from system.one;
create table dist_02175 as local_02175 engine=Distributed(test_cluster_two_shards, currentDatabase(), local_02175);
-- { echoOn }
select * from dist_02175 l join local_02175 r using dummy;
select * from dist_02175 l global join local_02175 r using dummy;
-- explicit database for distributed table
select * from remote('127.1', currentDatabase(), dist_02175) l join local_02175 r using dummy;
select * from remote('127.1', currentDatabase(), dist_02175) l global join local_02175 r using dummy;
-- { echoOff }
drop table local_02175;
drop table dist_02175;