diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java index f67a36f..c7e6361 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java @@ -458,6 +458,9 @@ public class PgConnection implements BaseConnection { batchInsert = false; } + /* set dolphin.b_compatibility_mode to the value of PGProperty.B_CMPT_MODE */ + this.setDolphinCmpt(PGProperty.B_CMPT_MODE.getBoolean(info)); + initClientLogic(info); } diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java index 57b4aa6..a74d813 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java @@ -2098,7 +2098,16 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS Encoding encoding = connection.getEncoding(); try { - return trimString(columnIndex, encoding.decode(this_row[columnIndex - 1])); + String typeName = getPGType(columnIndex); + String result = trimString(columnIndex, encoding.decode(this_row[columnIndex - 1])); + if (("blob".equals(typeName))) { + if (connection.unwrap(PgConnection.class).isDolphinCmpt()) { + return new String(toBytes(result)); + } + } else if (blobSet.contains(typeName)) { + return new String(toBytes(result)); + } + return result; } catch (IOException ioe) { throw new PSQLException( GT.tr(