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

Cannot use correlated column name in FROM clause of LATERAL join #10927

Closed
1 task done
soerenwolfers opened this issue Feb 29, 2024 · 2 comments
Closed
1 task done

Cannot use correlated column name in FROM clause of LATERAL join #10927

soerenwolfers opened this issue Feb 29, 2024 · 2 comments

Comments

@soerenwolfers
Copy link

soerenwolfers commented Feb 29, 2024

What happens?

Cannot use correlated column name in FROM clause of LATERAL join. This might not be a bug (although it does differ from POSTGRESQL), but I'd still be interested whether something like this is possible.

In practice, rather than a range, I'd be calling read_parquet.

To Reproduce

SELECT *
FROM (
    SELECT 1
) tb(i), 
LATERAL (
    SELECT * FROM range(tb.i)
)
BinderException: Binder Error: No function matches the given name and argument types 'range(VARCHAR)'.

(an attempted cast to integer reveals that tb.i is treated like a string literal)
In POSTGRESQL, the following works:

SELECT * FROM (VALUES (1), (2)) tb1(i)
LEFT JOIN LATERAL
(
  SELECT * FROM generate_series(1, tb1.i)
) tb2(j)
ON true;
i j
1 1
2 1
2 2

View on DB Fiddle

OS:

Linux

DuckDB Version:

0.10.1

DuckDB Client:

Python

Full Name:

Soeren Wolfers

Affiliation:

G-Research

Have you tried this on the latest nightly build?

I have tested with a nightly build

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • Yes, I have
@kryonix
Copy link
Contributor

kryonix commented Feb 29, 2024

This is related to #7522, #5762, and #6917. The issue here is that neither range nor generate_series are table in-out functions. Same is true for read_parquet, apparently. Therefore the functions cannot take the columns of the lateral join as input parameters.

@soerenwolfers
Copy link
Author

Clear error message added at #11436 -- prioritization of actual fix up to maintainers and doesn't require this ticket.

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

No branches or pull requests

4 participants