Exception initializing lookups in druid with metadata store-postgres

My metadata storage is postgres.

When i post an empty json --> {} to initialise my lookup ,the following error message appears and it fails to update druid_config metadata table.

java.util.concurrent.ExecutionException: org.skife.jdbi.v2.exceptions.CallbackFailedException: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: org.postgresql.util.PSQLException: ERROR: syntax error at or near “UPDATE”

Position: 18 [statement:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", located:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", rewritten:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=? WHERE name=? RETURNING *)

INSERT INTO new_config (name, payload) SELECT ?, ? WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", arguments:{ positional:{}, named:{value:[123, 125],key:‘lookupsConfig’}, finder:}]

at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]

at io.druid.common.config.ConfigManager.set(ConfigManager.java:194) [druid-common-0.12.0.jar:0.12.0]

at io.druid.common.config.JacksonConfigManager.set(JacksonConfigManager.java:82) [druid-common-0.12.0.jar:0.12.0]

at io.druid.server.lookup.cache.LookupCoordinatorManager.updateLookups(LookupCoordinatorManager.java:245) [druid-server-0.12.0.jar:0.12.0]

at io.druid.server.http.LookupCoordinatorResource.updateAllLookups(LookupCoordinatorResource.java:139) [druid-server-0.12.0.jar:0.12.0]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]

at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) [jersey-server-1.19.3.jar:1.19.3] …

Caused by: org.skife.jdbi.v2.exceptions.CallbackFailedException: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: org.postgresql.util.PSQLException: ERROR: syntax error at or near “UPDATE”

Position: 18 [statement:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", located:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", rewritten:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=? WHERE name=? RETURNING *)

INSERT INTO new_config (name, payload) SELECT ?, ? WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", arguments:{ positional:{}, named:{value:[123, 125],key:‘lookupsConfig’}, finder:}]

at org.skife.jdbi.v2.DBI.withHandle(DBI.java:284) ~[jdbi-2.63.1.jar:2.63.1]

at io.druid.metadata.storage.postgresql.PostgreSQLConnector.insertOrUpdate(PostgreSQLConnector.java:122) ~[?:?]

at io.druid.common.config.ConfigManager$2.call(ConfigManager.java:184) ~[druid-common-0.12.0.jar:0.12.0]

at io.druid.common.config.ConfigManager$2.call(ConfigManager.java:180) ~[druid-common-0.12.0.jar:0.12.0]

at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_25]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_25]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_25]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_25]

… 1 more

Caused by: org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: org.postgresql.util.PSQLException: ERROR: syntax error at or near “UPDATE”

Position: 18 [statement:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", located:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=:value WHERE name=:key RETURNING *)

INSERT INTO new_config (name, payload) SELECT :key, :value WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", rewritten:"BEGIN;

LOCK TABLE new_config IN SHARE ROW EXCLUSIVE MODE;

WITH upsert AS (UPDATE new_config SET payload=? WHERE name=? RETURNING *)

INSERT INTO new_config (name, payload) SELECT ?, ? WHERE NOT EXISTS (SELECT * FROM upsert)

;COMMIT;", arguments:{ positional:{}, named:{value:[123, 125],key:‘lookupsConfig’}, finder:}]

at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1334) ~[jdbi-2.63.1.jar:2.63.1]

at org.skife.jdbi.v2.Update.execute(Update.java:56) ~[jdbi-2.63.1.jar:2.63.1]

at io.druid.metadata.storage.postgresql.PostgreSQLConnector$1.withHandle(PostgreSQLConnector.java:155) ~[?:?]

at io.druid.metadata.storage.postgresql.PostgreSQLConnector$1.withHandle(PostgreSQLConnector.java:124) ~[?:?]

It might be a PostgreSQL version thing; are you using a recent version?