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

Inconsistent table names Error where having left join both inside & outside a view function #32743

Open
kilik52 opened this issue Dec 14, 2021 · 1 comment
Labels
bug Confirmed user-visible misbehaviour in official release

Comments

@kilik52
Copy link

kilik52 commented Dec 14, 2021

You have to provide the following information whenever possible.

When having left join both inside & outside a view function, it will raise Inconsistent table names Error

A clear and concise description of what works not as it is supposed to.

How to reproduce

  • Which ClickHouse server version to use

ClickHouse server version 21.11.6 revision 54450

  • Which interface to use, if matters
  • Non-default settings, if any
  • CREATE TABLE statements for all tables involved
create table distributor (id String, name String) Engine=MergeTree() Order By id;
create table product (id String, name String) Engine=MergeTree() Order By id;

create table sales (id String, distributor String, product String, amount Float32) Engine=MergeTree() Order By id;
  • Queries to run that lead to unexpected result
SELECT *
FROM view(
    SELECT *
    FROM sales
    LEFT JOIN distributor ON distributor.id = sales.distributor
) AS newSales
LEFT JOIN product ON product.id = newSales.product

Expected behavior

query successfully executed

Error message and/or stacktrace

Received exception from server (version 21.11.6):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Inconsistent table names: While processing SELECT * FROM sales LEFT JOIN distributor ON distributor.id = sales.distributor.

Additional context

the query will successfully executed If i put both left join clause inside the view function. Same as both outside the view function.
but for some reason, i cannot do that.

@kilik52 kilik52 added the potential bug To be reviewed by developers and confirmed/rejected. label Dec 14, 2021
@Algunenano Algunenano added bug Confirmed user-visible misbehaviour in official release and removed potential bug To be reviewed by developers and confirmed/rejected. labels Jan 18, 2024
@Algunenano
Copy link
Member

Still happening in master

Code: 49. DB::Exception: Inconsistent table names: While processing SELECT * FROM sales LEFT JOIN distributor ON distributor.id = sales.distributor. (LOGICAL_ERROR)

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

2 participants