mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Partially fix idiotic code in JOINs
This commit is contained in:
parent
1e9fbdb02c
commit
b20c0e2674
@ -48,7 +48,7 @@ void replaceJoinedTable(const ASTSelectQuery & select_query)
|
||||
if (table_expr.database_and_table_name)
|
||||
{
|
||||
const auto & table_id = table_expr.database_and_table_name->as<ASTTableIdentifier &>();
|
||||
String expr = "(select * from " + table_id.name() + ") as " + table_id.shortName();
|
||||
String expr = "(SELECT * FROM " + backQuote(table_id.name()) + ") AS " + backQuote(table_id.shortName());
|
||||
|
||||
// FIXME: since the expression "a as b" exposes both "a" and "b" names, which is not equivalent to "(select * from a) as b",
|
||||
// we can't replace aliased tables.
|
||||
|
@ -0,0 +1 @@
|
||||
0 0 1
|
13
tests/queries/0_stateless/01938_joins_identifiers.sql
Normal file
13
tests/queries/0_stateless/01938_joins_identifiers.sql
Normal file
@ -0,0 +1,13 @@
|
||||
DROP TABLE IF EXISTS "/t0";
|
||||
DROP TABLE IF EXISTS "/t1";
|
||||
|
||||
create table "/t0" (a Int64, b Int64) engine = MergeTree() partition by a order by a;
|
||||
create table "/t1" (a Int64, b Int64) engine = MergeTree() partition by a order by a;
|
||||
|
||||
insert into "/t0" values (0, 0);
|
||||
insert into "/t1" values (0, 1);
|
||||
|
||||
select * from "/t0" join "/t1" using a;
|
||||
|
||||
DROP TABLE "/t0";
|
||||
DROP TABLE "/t1";
|
Loading…
Reference in New Issue
Block a user