From 6419951fde840379f9377ec53e01bdadc0d907ff Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Wed, 12 May 2021 17:44:19 +0200 Subject: [PATCH] [jOOQ/jOOQ#8937] Use metadata DEFAULT expressions, if available --- jOOQ/src/main/java/org/jooq/impl/InsertQueryImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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));