From 4dce0075774fcb1430a5e3dfb5a942d936c3e968 Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Wed, 12 Feb 2014 12:30:32 +0000 Subject: [PATCH] Use DbConnector.isPostgreSQL everywhere we used getDatabaseProductName before --- .../java/io/druid/segment/realtime/DbSegmentPublisher.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/io/druid/segment/realtime/DbSegmentPublisher.java b/server/src/main/java/io/druid/segment/realtime/DbSegmentPublisher.java index 8ef9dfd193d..272c507cfd2 100644 --- a/server/src/main/java/io/druid/segment/realtime/DbSegmentPublisher.java +++ b/server/src/main/java/io/druid/segment/realtime/DbSegmentPublisher.java @@ -22,6 +22,7 @@ package io.druid.segment.realtime; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.inject.Inject; import com.metamx.common.logger.Logger; +import io.druid.db.DbConnector; import io.druid.db.DbTablesConfig; import io.druid.timeline.DataSegment; import org.joda.time.DateTime; @@ -83,15 +84,15 @@ public class DbSegmentPublisher implements SegmentPublisher public Void withHandle(Handle handle) throws Exception { String statement; - if (!handle.getConnection().getMetaData().getDatabaseProductName().contains("PostgreSQL")) { + if (DbConnector.isPostgreSQL(dbi)) { statement = String.format( - "INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) " + "INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) " + "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)", config.getSegmentsTable() ); } else { statement = String.format( - "INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) " + "INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) " + "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)", config.getSegmentsTable() );