Merge pull request #60765 from Avogar/fix-crash-in-input-join

Fix crash when using input() in INSERT SELECT JOIN
This commit is contained in:
Alexey Milovidov 2024-03-05 04:32:50 +03:00 committed by GitHub
commit 8aeffa0356
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 1 deletions

View File

@ -1816,7 +1816,7 @@ StoragePtr Context::executeTableFunction(const ASTPtr & table_expression, const
} }
uint64_t use_structure_from_insertion_table_in_table_functions = getSettingsRef().use_structure_from_insertion_table_in_table_functions; uint64_t use_structure_from_insertion_table_in_table_functions = getSettingsRef().use_structure_from_insertion_table_in_table_functions;
if (use_structure_from_insertion_table_in_table_functions && table_function_ptr->needStructureHint() && hasInsertionTable()) if (select_query_hint && use_structure_from_insertion_table_in_table_functions && table_function_ptr->needStructureHint() && hasInsertionTable())
{ {
const auto & insert_columns = DatabaseCatalog::instance() const auto & insert_columns = DatabaseCatalog::instance()
.getTable(getInsertionTable(), shared_from_this()) .getTable(getInsertionTable(), shared_from_this())

View File

@ -0,0 +1,14 @@
drop table if exists test;
create table test (a Int8) engine = MergeTree order by tuple();
INSERT INTO test
SELECT x.number FROM (
SELECT number
FROM system.numbers
LIMIT 10
) AS x
INNER JOIN input('a UInt64') AS y ON x.number = y.a
Format CSV 2
;
select * from test;
drop table test;