dolthub / dolthub/dolt

json_value parser support for options

Open
#6,850 0 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
analyzer bug json sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 9h
Merged PRs (30d)
121

Description

The mysql syntax for `json_value` is:
```
JSON_VALUE(json_doc, path [RETURNING type] [on_empty] [on_error])

on_empty:
{NULL | ERROR | DEFAULT value} ON EMPTY

on_error:
{NULL | ERROR | DEFAULT value} ON ERROR
```

The arguments consider of 1) the input json string or document, 2) the path that we want to search into the document, and 3 post-processing options depending on the value or error returned by the path lookup.

[Reference here](https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-value)

We currently support type as a third comma-separated argument as a shortcut, and do not support `on_empty` and `on_error`. It would be nice to add parser support to be mysql compatible here. Some of the function evaluation code would change for `on_empty` and `on_error`, but the lift is mostly at the parser/AST layer.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.