From 17fe492dd48812f839eee1de813f2c7b906bc907 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 13 Oct 2016 00:29:39 +0000 Subject: [PATCH] namestore: postgres: use IF NOT EXISTS to avoid error messages --- src/namestore/plugin_namestore_postgres.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 8ea6b43ad..01dbf9e61 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c @@ -85,14 +85,14 @@ create_indices (PGconn * dbh) /* create indices */ if ( (GNUNET_OK != GNUNET_POSTGRES_exec (dbh, - "CREATE INDEX ir_pkey_reverse ON ns097records (zone_private_key,pkey)")) || + "CREATE INDEX IF NOT EXISTS ir_pkey_reverse ON ns097records (zone_private_key,pkey)")) || (GNUNET_OK != GNUNET_POSTGRES_exec (dbh, - "CREATE INDEX ir_pkey_iter ON ns097records (zone_private_key,rvalue)")) || + "CREATE INDEX IF NOT EXISTS ir_pkey_iter ON ns097records (zone_private_key,rvalue)")) || (GNUNET_OK != - GNUNET_POSTGRES_exec (dbh, "CREATE INDEX it_iter ON ns097records (rvalue)")) || + GNUNET_POSTGRES_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns097records (rvalue)")) || (GNUNET_OK != - GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_label ON ns097records (label)")) ) + GNUNET_POSTGRES_exec (dbh, "CREATE INDEX IF NOT EXISTS ir_label ON ns097records (label)")) ) LOG (GNUNET_ERROR_TYPE_ERROR, _("Failed to create indices\n")); } @@ -122,7 +122,7 @@ database_setup (struct Plugin *plugin) { res = PQexec (plugin->dbh, - "CREATE TEMPORARY TABLE ns097records (" + "CREATE TEMPORARY TABLE IF NOT EXISTS ns097records (" " zone_private_key BYTEA NOT NULL DEFAULT ''," " pkey BYTEA DEFAULT ''," " rvalue BYTEA NOT NULL DEFAULT ''," @@ -135,7 +135,7 @@ database_setup (struct Plugin *plugin) { res = PQexec (plugin->dbh, - "CREATE TABLE ns097records (" + "CREATE TABLE IF NOT EXISTS ns097records (" " zone_private_key BYTEA NOT NULL DEFAULT ''," " pkey BYTEA DEFAULT ''," " rvalue BYTEA NOT NULL DEFAULT ''," -- 2.25.1