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

Unable to use CTE scalar as numbers() argument #8259

Closed
pablote opened this issue Dec 18, 2019 · 4 comments · Fixed by #62185
Closed

Unable to use CTE scalar as numbers() argument #8259

pablote opened this issue Dec 18, 2019 · 4 comments · Fixed by #62185
Labels
feature st-hold We've paused the work on issue for some reason

Comments

@pablote
Copy link

pablote commented Dec 18, 2019

This is a simplification of what I'm trying to achieve:

with
    (select 25) as something
select *, something
from numbers(toUInt64(something));

It fails with error: Code: 47, e.displayText() = DB::Exception: Missing columns: 'something' while processing query: 'toUInt64(something)', required columns: 'something', source columns: '_dummy' (version 19.17.5.18 (official build))

Replace last line with a fixed value, and the query works fine. Is it not possible to use a CTE value as input to numbers()? Any workaround?

thanks!

@pablote pablote added the bug Confirmed user-visible misbehaviour in official release label Dec 18, 2019
@lopn
Copy link

lopn commented Mar 15, 2020

  with
    (select 25) as something
select toUInt64(something)

@amosbird
Copy link
Collaborator

It's because table functions are evaluated earlier than scalar subqueries, and in fact they don't take subqueries into account at all. However it's still a valid use case. You can switch it to a feature request and it might work in near future.

@filimonov filimonov added feature and removed bug Confirmed user-visible misbehaviour in official release labels Sep 13, 2020
@andrewzolotukhin
Copy link
Contributor

Would be great to have that...

@azat
Copy link
Collaborator

azat commented Jan 23, 2024

This had been fixed in analyzer - #56337 (comment)

@Algunenano Algunenano added the st-hold We've paused the work on issue for some reason label Jan 23, 2024
fm4v added a commit that referenced this issue Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature st-hold We've paused the work on issue for some reason
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants