Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL query alias matched with column name leads to data substitution in unpredictable way. #4110

Closed
kkrakovych opened this issue Jan 21, 2019 · 2 comments
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release

Comments

@kkrakovych
Copy link

Hi Team,

Could you please check SQL below and clarify why ClickHouse returns 11 for A and 13 for B though 12 for B is expected? It does not matter wether we work with subquery or table. And it does not matter either alias B goes before or after A.

In the SQL query we obviously specify - we want to get data from table/subquery S and add +1 and +2 in different aliases. Yes, alias A is the same with column name, but it looks like you substitute table/subquery data on the fly.

select s.a + 1 as a
     , s.a + 2 as b
  from (
         select 10 as a
         ) s

If we talk about Oracle, PostgreSQL or any other DBMS - the mentioned behavior of DBMS is a bug.

Best regards,
Kostyantyn

@KochetovNicolai KochetovNicolai added the bug Confirmed user-visible misbehaviour in official release label Jan 22, 2019
@4ertus2
Copy link
Contributor

4ertus2 commented Feb 11, 2019

#4351

@4ertus2
Copy link
Contributor

4ertus2 commented Feb 12, 2019

fixed in master

@4ertus2 4ertus2 closed this as completed Feb 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release
Projects
None yet
Development

No branches or pull requests

3 participants