diff --git a/src/Functions/IFunction.cpp b/src/Functions/IFunction.cpp index e3dc4e6e081..e3802b98abf 100644 --- a/src/Functions/IFunction.cpp +++ b/src/Functions/IFunction.cpp @@ -184,7 +184,7 @@ ColumnPtr IExecutableFunction::defaultImplementationForNulls( if (!result_type->isNullable()) throw Exception(ErrorCodes::LOGICAL_ERROR, "Function {} with Null argument and default implementation for Nulls " - "expect to return Nullable result, got {}", result_type->getName()); + "is expected to return Nullable result, got {}", result_type->getName()); return result_type->createColumnConstWithDefaultValue(input_rows_count); } diff --git a/tests/queries/0_stateless/00205_emptyscalar_subquery_type_mismatch_bug.reference b/tests/queries/0_stateless/00205_emptyscalar_subquery_type_mismatch_bug.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/00205_emptyscalar_subquery_type_mismatch_bug.sql b/tests/queries/0_stateless/00205_emptyscalar_subquery_type_mismatch_bug.sql new file mode 100644 index 00000000000..aeac6be7d8f --- /dev/null +++ b/tests/queries/0_stateless/00205_emptyscalar_subquery_type_mismatch_bug.sql @@ -0,0 +1,38 @@ + +-- Bug reproduction form #25411 +WITH a AS (select (select 1 WHERE 0) as b) +select 1 +from system.one +cross join a +where a.b = 0; + +-- Reported query +drop table if exists t_q1ht4gq_5; +create table t_q1ht4gq_5 (c_zeij INTEGER NOT NULL, c_fehk75l TEXT, c_jz TEXT, c_wynzuek TEXT, c_nkt INTEGER NOT NULL, c_g TEXT, c_mc2 TEXT, primary key(c_nkt)) engine = MergeTree(); +WITH +cte_0 AS (select + subq_0.c6 as c2, + case when 0<>0 then ((select c_zeij from t_q1ht4gq_5 order by c_zeij limit 1 offset 1) + + subq_0.c4) else ((select c_zeij from t_q1ht4gq_5 order by c_zeij limit 1 offset 1) + + subq_0.c4) end as c4 + from + (select + ref_0.c_nkt as c4, + ref_0.c_nkt as c6 + from + t_q1ht4gq_5 as ref_0 + ) as subq_0 + ) +select + ref_12.c_zeij as c3 + from + t_q1ht4gq_5 as ref_12 + where (ref_12.c_jz not in ( + select + ref_14.c_mc2 as c0 + from + t_q1ht4gq_5 as ref_14 + cross join cte_0 as ref_15 + where ref_15.c4 > ref_15.c2)); + +drop table if exists t_q1ht4gq_5; diff --git a/tests/queries/0_stateless/00205_scalar_subqueries.sql b/tests/queries/0_stateless/00205_scalar_subqueries.sql index 6a16d3a15a8..c6cece66244 100644 --- a/tests/queries/0_stateless/00205_scalar_subqueries.sql +++ b/tests/queries/0_stateless/00205_scalar_subqueries.sql @@ -19,41 +19,3 @@ SELECT (SELECT 1, 2); SELECT (SELECT [1]); -- Several rows SELECT (SELECT number FROM numbers(2)); -- { serverError 125 } - --- Bug reproduction form #25411 -WITH a AS (select (select 1 WHERE 0) as b) -select 1 -from system.one -cross join a -where a.b = 0; - --- Reported query -drop table if exists t_q1ht4gq_5; -create table t_q1ht4gq_5 (c_zeij INTEGER NOT NULL, c_fehk75l TEXT, c_jz TEXT, c_wynzuek TEXT, c_nkt INTEGER NOT NULL, c_g TEXT, c_mc2 TEXT, primary key(c_nkt)) engine = MergeTree(); -WITH -cte_0 AS (select - subq_0.c6 as c2, - case when 0<>0 then ((select c_zeij from t_q1ht4gq_5 order by c_zeij limit 1 offset 1) - + subq_0.c4) else ((select c_zeij from t_q1ht4gq_5 order by c_zeij limit 1 offset 1) - + subq_0.c4) end as c4 - from - (select - ref_0.c_nkt as c4, - ref_0.c_nkt as c6 - from - t_q1ht4gq_5 as ref_0 - ) as subq_0 - ) -select - ref_12.c_zeij as c3 - from - t_q1ht4gq_5 as ref_12 - where (ref_12.c_jz not in ( - select - ref_14.c_mc2 as c0 - from - t_q1ht4gq_5 as ref_14 - cross join cte_0 as ref_15 - where ref_15.c4 > ref_15.c2)); - -drop table if exists t_q1ht4gq_5;