-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
What happens?
I want to call the range
function on an integer that is produced by an expensive computation. This integer will also be used in other places as well, so I don't want to run the expensive computation multiple times. A CTE seemed like the right choice here, but I cannot reference the column from the CTE in FROM
.
To Reproduce
Just try to run this very minimal example (no setup is required):
WITH t1(a) AS (SELECT 7) SELECT * FROM t1, generate_series(1, a)
This works fine on postgres & sqlite. But on duckdb, I get this error:
Binder Error: No function matches the given name and argument types 'generate_series(INTEGER, VARCHAR)'. You might need to add explicit type casts.
Candidate functions:
generate_series(BIGINT)
generate_series(BIGINT, BIGINT)
generate_series(BIGINT, BIGINT, BIGINT)
generate_series(TIMESTAMP, TIMESTAMP, INTERVAL)
generate_series(TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH TIME ZONE, INTERVAL)
LINE 1: ... t1(a) AS (SELECT 7) SELECT * FROM t1, generate_series(1, a);
^
OS:
Linux
DuckDB Version:
v0.10.1 4a89d97 & nightly v0.10.2-dev263 9247dee
DuckDB Client:
duckdb shell
Full Name:
John Doe
Affiliation:
Oracle
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