You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected Error of alias which redefines column name in join #10276
SELECT
sum(x.n) as n1,
sum(z.n) as n2
FROM
(
SELECT 1000 AS n,1 as id
) AS x
join (select 10000 as n,1 as id) as y
on x.id = y.id
left join (select 100000 as n,1 as id) as z
on x.id = z.id
Result
n1
n2
1000
100000
Unexpected Case
SELECT
sum(x.n) as n,
sum(z.n) as n2
FROM
(
SELECT 1000 AS n,1 as id
) AS x
join (select 10000 as n,1 as id) as y
on x.id = y.id
left join (select 100000 as n,1 as id) as z
on x.id = z.id
Result Code: 10, e.displayText() = DB::Exception: Not found column n in block. There are only columns: --x.n, --x.id (version 19.17.6.36 (official build))
I also met another Error in the SQL with the same struct
Similar problem with simple join. Redefinition of x:
CREATE TABLE t (`x` UInt32, `lc` LowCardinality(String)) ENGINE = Memory;
CREATE TABLE nr (`x` Nullable(UInt32), `lc` Nullable(String)) ENGINE = Memory;
INSERT INTO t VALUES (0, 'str');
INSERT INTO nr VALUES (0, 'str');
SELECT r.lc, length(r.lc) x FROM t AS l LEFT JOIN nr AS r USING (x);
changed the title [-]Unexpected Error of alias which redefines column name in multi join[/-][+]Unexpected Error of alias which redefines column name in join[/+]on Jun 3, 2020
Activity
4ertus2 commentedon Jun 3, 2020
Similar problem with simple join. Redefinition of
x:[-]Unexpected Error of alias which redefines column name in multi join[/-][+]Unexpected Error of alias which redefines column name in join[/+]alexey-milovidov commentedon Mar 20, 2023
Works perfectly with Analyzer. We will close it after enabling Analyzer by default.
Close: #10276