From 8aa087e5fb8aa31dc4d78b92b07594fcf648cf86 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Fri, 1 Mar 2019 16:21:49 +0100 Subject: [PATCH] [#8342] Array of enums whose literals contain special characters cannot be bound in PostgreSQL --- .../org/jooq/util/postgres/PostgresUtils.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/util/postgres/PostgresUtils.java b/jOOQ/src/main/java/org/jooq/util/postgres/PostgresUtils.java index c22c54ce29..d3ba81fb69 100644 --- a/jOOQ/src/main/java/org/jooq/util/postgres/PostgresUtils.java +++ b/jOOQ/src/main/java/org/jooq/util/postgres/PostgresUtils.java @@ -51,6 +51,7 @@ import java.util.Collections; import java.util.List; import org.jooq.Converter; +import org.jooq.EnumType; import org.jooq.Record; import org.jooq.exception.DataTypeException; import org.jooq.tools.StringUtils; @@ -482,18 +483,16 @@ public class PostgresUtils { * Create a PostgreSQL string representation of any object. */ public static String toPGString(Object o) { - if (o instanceof byte[]) { + if (o instanceof byte[]) return toPGString((byte[]) o); - } - else if (o instanceof Object[]) { + else if (o instanceof Object[]) return toPGArrayString((Object[]) o); - } - else if (o instanceof Record) { + else if (o instanceof Record) return toPGString((Record) o); - } - else { + else if (o instanceof EnumType) + return ((EnumType) o).getLiteral(); + else return "" + o; - } } /**