From: Daniel Golle Date: Thu, 13 Oct 2016 00:29:43 +0000 (+0000) Subject: datacache: postgres: use IF NOT EXISTS to avoid error messages X-Git-Tag: initial-import-from-subversion-38251~102 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=505c2e0638d66e48a44bb52bfd5127f59b8d6353;p=oweals%2Fgnunet.git datacache: postgres: use IF NOT EXISTS to avoid error messages --- diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index 147bb4223..13c2c26a2 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c @@ -74,7 +74,7 @@ init_connection (struct Plugin *plugin) return GNUNET_SYSERR; ret = PQexec (plugin->dbh, - "CREATE TEMPORARY TABLE gn090dc (" + "CREATE TEMPORARY TABLE IF NOT EXISTS gn090dc (" " type INTEGER NOT NULL DEFAULT 0," " discard_time BIGINT NOT NULL DEFAULT 0," " key BYTEA NOT NULL DEFAULT ''," @@ -100,10 +100,10 @@ init_connection (struct Plugin *plugin) { if ((GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, - "CREATE INDEX idx_key ON gn090dc (key)")) || + "CREATE INDEX IF NOT EXISTS idx_key ON gn090dc (key)")) || (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, - "CREATE INDEX idx_dt ON gn090dc (discard_time)"))) + "CREATE INDEX IF NOT EXISTS idx_dt ON gn090dc (discard_time)"))) { PQclear (ret); PQfinish (plugin->dbh);