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

Implement json_error_position #564

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

petersooley
Copy link
Contributor

Furthering work for JSON compatibility as described in #127, this change adds support for the json_error_position function used to find the error in invalid JSON values.

image

)),
},
OwnedValue::Null => Ok(OwnedValue::Null),
_ => Ok(OwnedValue::Integer(0)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will this handle OwnedValue::Agg and OwnedValue:Record here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my testing, sqlite just returns 0 for anything not text (or blob that could be interpreted as text). I stuck to the same plan, but perhaps using unreachable! would be better for these other, unsupported types. That's how json_array handles it.

sqlite> SELECT json_error_position(avg(price)) FROM products;
0

Copy link
Contributor

@sonhmai sonhmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the clear PR. I left some minors.

core/json/mod.rs Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants