jOOQ icon indicating copy to clipboard operation
jOOQ copied to clipboard

Create separate QOM types for JSON / JSONB functions

Open lukaseder opened this issue 3 years ago • 0 comments

Most JSON and JSONB functions are identical in API and functionality. They differ only in terms of data type. In most RDBMS, people will just use JSON (in text format, not binary), not JSONB. So, this is mostly a PostgreSQL specific thing, where JSONB is more popular than JSON.

For historic reasons, the implementation and API shared types. This is a challenge in the QOM model, which was introduced in jOOQ 3.16, after JSON (3.14). The newly added -> and ->> operators (see https://github.com/jOOQ/jOOQ/issues/10018) use separate QOM types and API for the JSON and JSONB variants, for now.

We'll need to decide, strategically, which way is the preferred way:

  • [ ] Keep everything separate if there are separate DSL APIs (no shared types, no shared DSL, possibly shared internal base implementation)
  • [ ] Share types and DSL where it makes "sense"

The difficulty is to find a specification where sharing makes "sense." This discussion also applies to temporal functions, e.g. when the same function can work with DATE, TIMESTAMP, TIMESTAMPTZ

No matter the decision, if things are changed, the QOM API must be changed incompatibly, which is fine, because it's experimental.

lukaseder avatar Sep 02 '22 08:09 lukaseder