mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
init
This commit is contained in:
parent
6e118c60da
commit
daa231c391
@ -1,3 +1,4 @@
|
|||||||
|
#include <algorithm>
|
||||||
#include <Interpreters/JoinedTables.h>
|
#include <Interpreters/JoinedTables.h>
|
||||||
|
|
||||||
#include <Core/SettingsEnums.h>
|
#include <Core/SettingsEnums.h>
|
||||||
@ -258,6 +259,20 @@ bool JoinedTables::resolveTables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (tables_with_columns.size() > 1)
|
||||||
|
{
|
||||||
|
Names column_names = {};
|
||||||
|
for (const auto & t : tables_with_columns)
|
||||||
|
for (auto & name : t.columns.getNames())
|
||||||
|
column_names.push_back(name);
|
||||||
|
|
||||||
|
std::sort(column_names.begin(), column_names.end());
|
||||||
|
for (size_t i = 0; i < column_names.size() - 1; i++) // Check if there is not any duplicates because it will lead to broken result
|
||||||
|
if (column_names[i] == column_names[i+1])
|
||||||
|
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||||
|
"Name of columns and aliases should be unique for this query (you can add alias that will be different)"
|
||||||
|
"While processing '{}'", table_expressions[i]->formatForErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
return !tables_with_columns.empty();
|
return !tables_with_columns.empty();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
select * from (SELECT number as a FROM numbers(10)) t1 PASTE JOIN (select number as a from numbers(10)) t2;
|
select * from (SELECT number as a FROM numbers(10)) t1 PASTE JOIN (select number as a from numbers(10)) t2;
|
||||||
select * from (SELECT number as a FROM numbers(10)) t1 PASTE JOIN (select number as a from numbers(10) order by a desc) t2;
|
select * from (SELECT number as a FROM numbers(10)) t1 PASTE JOIN (select number as a from numbers(10) order by a desc) t2;
|
||||||
create table if not exists test (num UInt64) engine=Memory;
|
create table if not exists test (number UInt64) engine=Memory;
|
||||||
insert into test select number from numbers(6);
|
insert into test select number from numbers(6);
|
||||||
insert into test select number from numbers(5);
|
insert into test select number from numbers(5);
|
||||||
SELECT * FROM (SELECT 1) t1 PASTE JOIN (SELECT 2) SETTINGS joined_subquery_requires_alias=0;
|
SELECT * FROM (SELECT 1) t1 PASTE JOIN (SELECT 2) SETTINGS joined_subquery_requires_alias=0;
|
||||||
@ -35,3 +35,7 @@ SET max_threads = 2;
|
|||||||
select * from (SELECT number as a FROM numbers(10)) t1 ANY PASTE JOIN (select number as a from numbers(10)) t2; -- { clientError SYNTAX_ERROR }
|
select * from (SELECT number as a FROM numbers(10)) t1 ANY PASTE JOIN (select number as a from numbers(10)) t2; -- { clientError SYNTAX_ERROR }
|
||||||
select * from (SELECT number as a FROM numbers(10)) t1 ALL PASTE JOIN (select number as a from numbers(10)) t2; -- { clientError SYNTAX_ERROR }
|
select * from (SELECT number as a FROM numbers(10)) t1 ALL PASTE JOIN (select number as a from numbers(10)) t2; -- { clientError SYNTAX_ERROR }
|
||||||
select * from (SELECT number as a FROM numbers_mt(10)) t1 PASTE JOIN (select number as a from numbers(10) ORDER BY a DESC) t2 SETTINGS max_block_size=3; -- { serverError BAD_ARGUMENTS }
|
select * from (SELECT number as a FROM numbers_mt(10)) t1 PASTE JOIN (select number as a from numbers(10) ORDER BY a DESC) t2 SETTINGS max_block_size=3; -- { serverError BAD_ARGUMENTS }
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO test SELECT * FROM numbers(10);
|
||||||
|
SELECT * FROM (SELECT number FROM test) AS t1 PASTE JOIN (SELECT number FROM numbers(10) ORDER BY number DESC ) AS t2 SETTINGS joined_subquery_requires_alias = 0; -- { serverError BAD_ARGUMENTS }
|
||||||
|
Loading…
Reference in New Issue
Block a user