From 79af7156928623d561fa7ef656caef2fc7b98194 Mon Sep 17 00:00:00 2001 From: gmantele <gmantele@ari.uni-heidelberg.de> Date: Wed, 8 Jul 2015 17:49:07 +0200 Subject: [PATCH] [TAP] Postgres does not support 0x00 value for a single character. Such value is replaced by NULL while ingesting it into a Postgres database. --- src/tap/db/JDBCConnection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java index 66d672e..06044ad 100644 --- a/src/tap/db/JDBCConnection.java +++ b/src/tap/db/JDBCConnection.java @@ -144,7 +144,7 @@ import adql.translator.TranslationException; * </i></p> * * @author Grégory Mantelet (CDS;ARI) - * @version 2.0 (06/2015) + * @version 2.1 (07/2015) * @since 2.0 */ public class JDBCConnection implements DBConnection { @@ -1805,6 +1805,9 @@ public class JDBCConnection implements DBConnection { /* BOOLEAN CASE (more generally, type incompatibility) */ else if (val != null && cols[c - 1].getDatatype().type == DBDatatype.SMALLINT && val instanceof Boolean) val = ((Boolean)val) ? (short)1 : (short)0; + /* NULL CHARACTER CASE (JUST FOR POSTGRESQL) */ + else if ((dbms == null || dbms.equalsIgnoreCase(DBMS_POSTGRES)) && val instanceof Character && (Character)val == 0x00) + val = null; } stmt.setObject(c++, val); } -- GitLab