diff --git a/jOOQ/src/main/java/org/jooq/impl/InsertQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/InsertQueryImpl.java index 6e48949be7..3d0eb7426b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/InsertQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/InsertQueryImpl.java @@ -815,10 +815,10 @@ final class InsertQueryImpl extends AbstractStoreQuery impl ? select : insertMaps.insertSelect(); - // [#8937] With DEFAULT VALUES, there is no SELECT. We don't support - // this yet, but we also mustn't produce invalid SQL + // [#8937] With DEFAULT VALUES, there is no SELECT. Create one from + // known DEFAULT expressions, or use NULL. if (s == null) - s = select(map(f, DSL::NULL)); + s = select(map(f, x -> x.getDataType().defaulted() ? x.getDataType().default_() : DSL.NULL(x))); // [#6375] INSERT .. VALUES and INSERT .. SELECT distinction also in MERGE Table t = s.asTable("t", map(f, Field::getName, String[]::new));