h2database / h2database/h2database

Add support `JSON_SET` and `JSON_CONTAINS_PATH` functions

Open
#4,001 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.6k
Forks
1.3k
Avg merge
1d 2h
Merged PRs (30d)
9

Description

As MySQL and PostgreSQL have native support to store and query json data, there is a need to support json related queries in h2.

Currently if I try to use them I get error with below error message:

Method threw 'javax.persistence.PersistenceException' exception.
cause: org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "JSON_CONTAINS_PATH" not found; SQL statement:
SELECT JSON_CONTAINS_PATH(metadata, 'one', CONCAT('$.', ?)) > 0 FROM user_metadata_v2 WHERE user_id = ? [90022-210]

I tried finding the code in the repository and couldn't find implementation. So my guess is this not implemented yet.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the SQL statement in the issue against H2 and investigate how JSON_SET and JSON_CONTAINS_PATH are represented or handled in the repository. Done means both functions are supported for the reported JSON query and the demonstrated error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.