mirror of https://github.com/apache/druid.git
fix a bug introduced in postgres support that breaks inserts for mysql
This commit is contained in:
parent
f09a43a8d9
commit
fc65648809
|
@ -60,13 +60,22 @@ public class DbSegmentPublisher implements SegmentPublisher
|
||||||
@Override
|
@Override
|
||||||
public Void withHandle(Handle handle) throws Exception
|
public Void withHandle(Handle handle) throws Exception
|
||||||
{
|
{
|
||||||
handle.createStatement(
|
String statement;
|
||||||
String.format(
|
if (!handle.getConnection().getMetaData().getDatabaseProductName().contains("PostgreSQL")) {
|
||||||
"INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) "
|
statement = String.format(
|
||||||
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
|
"INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) "
|
||||||
config.getSegmentTable()
|
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
|
||||||
)
|
config.getSegmentTable()
|
||||||
)
|
);
|
||||||
|
} else {
|
||||||
|
statement = String.format(
|
||||||
|
"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.getSegmentTable()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
handle.createStatement(statement)
|
||||||
.bind("id", segment.getIdentifier())
|
.bind("id", segment.getIdentifier())
|
||||||
.bind("dataSource", segment.getDataSource())
|
.bind("dataSource", segment.getDataSource())
|
||||||
.bind("created_date", new DateTime().toString())
|
.bind("created_date", new DateTime().toString())
|
||||||
|
|
Loading…
Reference in New Issue