Skip to content

bug: JSON not evaluating null #17433

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
1 of 2 tasks
rad-pat opened this issue Feb 10, 2025 · 0 comments · Fixed by #17466
Closed
1 of 2 tasks

bug: JSON not evaluating null #17433

rad-pat opened this issue Feb 10, 2025 · 0 comments · Fixed by #17466
Assignees
Labels
C-bug Category: something isn't working

Comments

@rad-pat
Copy link

rad-pat commented Feb 10, 2025

Search before asking

  • I had searched in the issues and found no similar issues.

Version

v1.2.695

What's Wrong?

When trying to query JSON values by key, null values seem to cause issue, leading to error such as

invalid digit found in string while evaluating function `to_int32('null')` in expr `to_int32()`, during run expr: `CAST(get_string(data_table.data (#2), 'key1') AS Int32 NULL)`

How to Reproduce?

CREATE TABLE data_table (
	id INTEGER, 
	name VARCHAR(30) NOT NULL, 
	"data" JSON NOT NULL, 
	nulldata JSON
)

INSERT INTO data_table (name, "data", nulldata) VALUES ('row1', '{"key1": null}', '{"key1": null}')

SELECT CAST(data_table."data" ->> 'key1' AS INTEGER) AS anon_1 
FROM data_table 
WHERE CAST((data_table."data" ->> 'key1') AS INTEGER) IS NULL;

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants