From 4ae64efbf38a40bc9f1dd2b4b2520ab50d520b33 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 24 Jun 2022 16:05:29 +0200 Subject: [PATCH] [jOOQ/jOOQ#13723] Regression: Zero-length delimited identifier is generated for enum columns when using --- jOOQ/src/main/java/org/jooq/SchemaMapping.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/SchemaMapping.java b/jOOQ/src/main/java/org/jooq/SchemaMapping.java index 2bbd750269..659759df4b 100644 --- a/jOOQ/src/main/java/org/jooq/SchemaMapping.java +++ b/jOOQ/src/main/java/org/jooq/SchemaMapping.java @@ -322,6 +322,11 @@ public class SchemaMapping implements Serializable { result = getCatalogs().get(catalogName); } + // [#4642] [#13723] There can still be a default name (e.g. from + // code generation, even when there's no runtime schema mapping + else if ("".equals(result.getName())) + result = null; + return result; } @@ -341,6 +346,9 @@ public class SchemaMapping implements Serializable { else if (schema instanceof RenamedSchema) return schema; Schema result = schema; + if (result == null) + result = schema(name("")); + RenderMapping m = mapping(); // [#4642] Don't initialise schema mapping if not necessary @@ -349,9 +357,6 @@ public class SchemaMapping implements Serializable { !isEmpty(m.getDefaultSchema()) || !isEmpty(m.getDefaultCatalog())) { - if (result == null) - result = schema(name("")); - Catalog catalog = result.getCatalog(); if (catalog == null) catalog = DSL.catalog(name("")); @@ -433,6 +438,11 @@ public class SchemaMapping implements Serializable { result = getSchemata().get(key); } + // [#4642] [#13723] There can still be a default name (e.g. from + // code generation, even when there's no runtime schema mapping + else if ("".equals(result.getName())) + result = null; + return result; }