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

Misleading binder error #10412

Closed
1 task done
eaubin opened this issue Jan 31, 2024 · 1 comment
Closed
1 task done

Misleading binder error #10412

eaubin opened this issue Jan 31, 2024 · 1 comment

Comments

@eaubin
Copy link

eaubin commented Jan 31, 2024

What happens?

A query like

SELECT '[{"x":1}]'::json as xs, list_transform(xs, x -> x)

fails with an error BinderException: Binder Error: Referenced column "x" not found in FROM clause!, but the error doesn't involve the x as correcting the cast (to json[]rather than just json) removes the exception.

To Reproduce

SELECT '[{"x":1}]'::json as xs, list_transform(xs, x -> x)

OS:

windows x64

DuckDB Version:

duckdb-0.9.2-cp37-cp37m-win_amd64

DuckDB Client:

Python

Full Name:

eaubin

Affiliation:

n/a

Have you tried this on the latest main branch?

I have tested with a release build (and could not test with a main 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
@taniabogatsch
Copy link
Contributor

This should be fixed as a side result of #10150. I get the following output on the current main branch.

Error: Binder Error: failed to bind function, either: Invalid LIST argument during lambda function binding!
 or: Referenced column "x" not found in FROM clause!

Basically, we try to bind this query twice, and both attempts fail. The error message now includes the failure-reason of the first attempt, which is Invalid LIST argument during lambda function binding!. This is the expected error message, as ::JSON AS xs is not a LIST.

tania@motorbook duckdb % build/release/duckdb        
v0.9.3-dev3936 b92cb1ae39
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D SELECT '[{"x":1}]'::JSON AS xs, list_transform(xs, x -> x);
Error: Binder Error: failed to bind function, either: Invalid LIST argument during lambda function binding!
 or: Referenced column "x" not found in FROM clause!
D SELECT '[{"x":1}]'::JSON;
┌─────────────────────────────┐
│ CAST('[{"x":1}]' AS "JSON") │
│            json             │
├─────────────────────────────┤
│ [{"x":1}]                   │
└─────────────────────────────┘
D SELECT '[{"x":1}]'::JSON AS xs, list_transform(xs::JSON[], x -> x);
┌───────────┬────────────────────────────────────────────────┐
│    xs     │ list_transform(CAST(xs AS "JSON"[]), (x -> x)) │
│   json    │                     json[]                     │
├───────────┼────────────────────────────────────────────────┤
│ [{"x":1}] │ [{"x":1}]                                      │
└───────────┴────────────────────────────────────────────────┘
D SELECT '[{"x":1}]'::JSON[] AS xs, list_transform(xs, x -> x);
┌───────────┬──────────────────────────────┐
│    xs     │ list_transform(xs, (x -> x)) │
│  json[]   │            json[]            │
├───────────┼──────────────────────────────┤
│ [{"x":1}] │ [{"x":1}]                    │
└───────────┴──────────────────────────────┘

I am closing this, as it has already been fixed.

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