[#10089] Emulate JSON_OBJECTAGG in CockroachDB
This commit is contained in:
parent
a444521fba
commit
e1d6fdeb00
@ -53,6 +53,7 @@ import static org.jooq.impl.SQLDataType.JSON;
|
||||
import org.jooq.Context;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.JSON;
|
||||
import org.jooq.JSONEntry;
|
||||
import org.jooq.JSONObjectAggNullStep;
|
||||
|
||||
@ -132,7 +133,19 @@ implements JSONObjectAggNullStep<J> {
|
||||
value = entry.value();
|
||||
}
|
||||
else {
|
||||
value = jsonValue(jsonObject(inline("x"), entry.value()), inline("$.x"));
|
||||
Field<JSON> x = jsonObject(inline("x"), entry.value());
|
||||
|
||||
switch (ctx.family()) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
value = jsonValue(x, inline("$.x"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (nullClause == ABSENT_ON_NULL)
|
||||
value = when(entry.value().isNull(), inline((String) null)).else_((Field) value);
|
||||
|
||||
@ -182,6 +182,9 @@ implements
|
||||
ctx.visit(N_JSON_EXTRACT).sql('(').visit(json).sql(", ").visit(path).sql(')');
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case POSTGRES:
|
||||
ctx.visit(N_JSONB_PATH_QUERY_FIRST).sql('(').visit(castIfNeeded(json, JSONB)).sql(", ").visit(path).sql("::jsonpath)");
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user