[jOOQ/jOOQ#9928] Added support for PostgreSQL
This commit is contained in:
parent
6e95ffce50
commit
36f0a4a56a
@ -38,6 +38,7 @@
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
@ -53,12 +54,12 @@ public interface JSONObjectNullStep<T> extends Field<T> {
|
||||
/**
|
||||
* Include <code>NULL</code> values in output JSON.
|
||||
*/
|
||||
@Support({ H2 })
|
||||
@Support({ H2, POSTGRES })
|
||||
Field<T> nullOnNull();
|
||||
|
||||
/**
|
||||
* Exclude <code>NULL</code> values in output JSON.
|
||||
*/
|
||||
@Support({ H2 })
|
||||
@Support({ H2, POSTGRES })
|
||||
Field<T> absentOnNull();
|
||||
}
|
||||
|
||||
@ -119,7 +119,14 @@ final class JSONObject<J> extends AbstractField<J> implements JSONObjectNullStep
|
||||
|
||||
|
||||
case POSTGRES:
|
||||
if (nullClause == NullClause.ABSENT_ON_NULL)
|
||||
ctx.visit(unquotedName("json_strip_nulls")).sql('(');
|
||||
|
||||
ctx.visit(unquotedName("json_build_object")).sql('(').visit(args).sql(')');
|
||||
|
||||
if (nullClause == NullClause.ABSENT_ON_NULL)
|
||||
ctx.sql(')');
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user