[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r38151 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r38151 - gnunet/src/datastore |
Date: |
Thu, 13 Oct 2016 02:29:45 +0200 |
Author: daniel
Date: 2016-10-13 02:29:45 +0200 (Thu, 13 Oct 2016)
New Revision: 38151
Modified:
gnunet/src/datastore/plugin_datastore_postgres.c
Log:
datastore: postgres: use IF NOT EXISTS to avoid error messages
Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c 2016-10-13 00:29:43 UTC
(rev 38150)
+++ gnunet/src/datastore/plugin_datastore_postgres.c 2016-10-13 00:29:45 UTC
(rev 38151)
@@ -78,8 +78,8 @@
ret =
PQexec (plugin->dbh,
- "CREATE TABLE gn090 ("
- " repl INTEGER NOT NULL DEFAULT 0,"
+ "CREATE TABLE IF NOT EXISTS gn090 ("
+ " repl INTEGER NOT NULL DEFAULT 0,"
" type INTEGER NOT NULL DEFAULT 0,"
" prio INTEGER NOT NULL DEFAULT 0,"
" anonLevel INTEGER NOT NULL DEFAULT 0,"
@@ -88,7 +88,7 @@
" hash BYTEA NOT NULL DEFAULT '',"
" vhash BYTEA NOT NULL DEFAULT '',"
" value BYTEA NOT NULL DEFAULT '')"
- "WITH OIDS");
+ "WITH OIDS");
if ( (NULL == ret) ||
((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
(0 != strcmp ("42P07", /* duplicate table */
@@ -109,23 +109,23 @@
if (PQresultStatus (ret) == PGRES_COMMAND_OK)
{
if ((GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_hash ON gn090
(hash)")) ||
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_hash ON gn090 (hash)")) ||
(GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_hash_vhash ON
gn090 (hash,vhash)")) ||
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_hash_vhash ON gn090 (hash,vhash)")) ||
(GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_prio ON gn090
(prio)")) ||
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_prio ON gn090 (prio)")) ||
(GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_expire ON gn090
(expire)")) ||
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_expire ON gn090 (expire)")) ||
(GNUNET_OK !=
GNUNET_POSTGRES_exec (plugin->dbh,
- "CREATE INDEX idx_prio_anon ON gn090
(prio,anonLevel)")) ||
+ "CREATE INDEX IF NOT EXISTS idx_prio_anon ON
gn090 (prio,anonLevel)")) ||
(GNUNET_OK !=
GNUNET_POSTGRES_exec (plugin->dbh,
- "CREATE INDEX idx_prio_hash_anon ON gn090
(prio,hash,anonLevel)")) ||
+ "CREATE INDEX IF NOT EXISTS idx_prio_hash_anon
ON gn090 (prio,hash,anonLevel)")) ||
(GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_repl_rvalue ON
gn090 (repl,rvalue)")) ||
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_repl_rvalue ON gn090 (repl,rvalue)")) ||
(GNUNET_OK !=
- GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX idx_expire_hash ON
gn090 (expire,hash)")))
+ GNUNET_POSTGRES_exec (plugin->dbh, "CREATE INDEX IF NOT EXISTS
idx_expire_hash ON gn090 (expire,hash)")))
{
PQclear (ret);
PQfinish (plugin->dbh);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r38151 - gnunet/src/datastore,
gnunet <=