Skip to content

Multiple USING statements are not supported #80540

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

Closed
RWiggers opened this issue May 19, 2025 · 4 comments
Closed

Multiple USING statements are not supported #80540

RWiggers opened this issue May 19, 2025 · 4 comments
Labels

Comments

@RWiggers
Copy link

RWiggers commented May 19, 2025

Hey guys, I'm trying to execute a query that looks like this:

WITH filtered_accounts AS (
    SELECT *
    FROM accounts
    WHERE name ILIKE 'prefix%'
)
SELECT created_at,
       name,
       account_number,
       account_type,
       account_class,
       note,
       credit,
       debit,
       amount
FROM filtered_accounts
JOIN transaction_details_table AS details USING (account_id)
JOIN transactions_table        AS transactions USING (transaction_id)
ORDER BY 1

But I'm getting the following error:

Code: 48. DB::Exception: Multiple USING statements are not supported: While processing <my query>. (NOT_IMPLEMENTED) (version 24.12.1.1614 (official build))

So, is this something that’s planned for a future release, or should I just try updating to a newer version?

I also came across this issue — but I’m not sure if it’s the same case. If it is, it seems like something that should have already been fixed, right?

Use case

Trying to execute a query that uses multiple USING clauses along with JOIN

Describe the solution you'd like

Be able to execute the query

Describe alternatives you've considered

No response

Additional context

No response

@RWiggers
Copy link
Author

RWiggers commented May 20, 2025

@alexey-milovidov @GrigoryPervakov any idea?

@GrigoryPervakov
Copy link
Contributor

GrigoryPervakov commented May 20, 2025

Hi @RWiggers, It should work, but I can't reproduce this behaviour with the same version. Could you add any details that could break it? Maybe some custom settings are set for table/user profile/session?
https://fiddle.clickhouse.com/6be4001f-3410-45b4-816e-87b01703104b

It would be cool if you could reproduce this error in https://fiddle.clickhouse.com, especially on the latest version.

@RWiggers
Copy link
Author

Thank you @GrigoryPervakov for your reply. It's weird, idk why in this fiddle is working and why on the cloud is not.
Here is the profile settings:

CREATE SETTINGS PROFILE profile_test SETTINGS
allow_experimental_analyzer = 0,
max_partitions_per_insert_block = 10000,
join_algorithm = 'auto',
join_use_nulls = 1
to default;

In my case, any second JOIN with the USING will break.
Even a simple query like this results in the error:

SELECT *
FROM a
JOIN b USING (id_a)
JOIN c USING (id_b)

@nikitamikhaylov
Copy link
Member

The problem is here: allow_experimental_analyzer = 0. The Analyzer is GA, but we haven't yet updated the whole fleet in Cloud. You can manually set enable_analyzer = 1 for your queries or for your settings profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy