[jOOQ/jOOQ#14046] Better emulation for PostgreSQL 12+ and YugabyteDB
This commit is contained in:
parent
8e360a8b78
commit
8046610b2f
@ -72,6 +72,8 @@ implements
|
||||
QOM.JSONBKeys
|
||||
{
|
||||
|
||||
static final Set<SQLDialect> NO_SUPPORT_PATH_QUERY = SQLDialect.supportedUntil();
|
||||
|
||||
final Field<JSONB> field;
|
||||
|
||||
JSONBKeys(
|
||||
@ -101,9 +103,13 @@ implements
|
||||
|
||||
|
||||
case POSTGRES:
|
||||
case YUGABYTEDB:
|
||||
ctx.visit(DSL.field(select(DSL.coalesce(jsonbArrayAgg(DSL.field(unquotedName("j"))), jsonbArray())).from("jsonb_object_keys({0}) as j(j)", field)));
|
||||
case YUGABYTEDB: {
|
||||
if (NO_SUPPORT_PATH_QUERY.contains(ctx.dialect()))
|
||||
ctx.visit(DSL.field(select(DSL.coalesce(jsonArrayAgg(DSL.field(unquotedName("j"))), jsonArray())).from("json_object_keys({0}) as j(j)", field)));
|
||||
else
|
||||
ctx.visit(function(N_JSONB_PATH_QUERY_ARRAY, getDataType(), field, inline("$.keyvalue().key")));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@ final class Names {
|
||||
static final Name N_JSONB_BUILD_ARRAY = systemName("jsonb_build_array");
|
||||
static final Name N_JSONB_OBJECT_AGG = systemName("jsonb_object_agg");
|
||||
static final Name N_JSONB_PATH_EXISTS = systemName("jsonb_path_exists");
|
||||
static final Name N_JSONB_PATH_QUERY_ARRAY = systemName("jsonb_path_query_array");
|
||||
static final Name N_JSONB_PATH_QUERY_FIRST = systemName("jsonb_path_query_first");
|
||||
static final Name N_JSONPATH = systemName("jsonpath");
|
||||
static final Name N_JSON_AGG = systemName("json_agg");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user