aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/datacache/plugin_datacache_postgres.c9
-rw-r--r--src/datastore/plugin_datastore_postgres.c14
-rw-r--r--src/namecache/plugin_namecache_postgres.c6
-rw-r--r--src/namestore/plugin_namestore_postgres.c6
5 files changed, 22 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 946b6f58a..581764b52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1335,7 +1335,7 @@ CPPFLAGS=$SAVE_CPPFLAGS
1335 1335
1336# test for postgres: 1336# test for postgres:
1337postgres=false 1337postgres=false
1338AX_LIB_POSTGRESQL([9.5], 1338AX_LIB_POSTGRESQL([12.0],
1339 [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" 1339 [CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
1340 AC_CHECK_HEADERS([libpq-fe.h], 1340 AC_CHECK_HEADERS([libpq-fe.h],
1341 postgres=true) 1341 postgres=true)
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index c21be9219..724324ca4 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -67,14 +67,19 @@ static int
67init_connection (struct Plugin *plugin) 67init_connection (struct Plugin *plugin)
68{ 68{
69 struct GNUNET_PQ_ExecuteStatement es[] = { 69 struct GNUNET_PQ_ExecuteStatement es[] = {
70 GNUNET_PQ_make_try_execute ("CREATE TEMPORARY SEQUENCE IF NOT EXISTS gn011dc_oid_seq"),
70 GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn011dc (" 71 GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn011dc ("
72 " oid OID NOT NULL DEFAULT nextval('gn011dc_oid_seq'),"
71 " type INTEGER NOT NULL," 73 " type INTEGER NOT NULL,"
72 " prox INTEGER NOT NULL," 74 " prox INTEGER NOT NULL,"
73 " discard_time BIGINT NOT NULL," 75 " discard_time BIGINT NOT NULL,"
74 " key BYTEA NOT NULL," 76 " key BYTEA NOT NULL,"
75 " value BYTEA NOT NULL," 77 " value BYTEA NOT NULL,"
76 " path BYTEA DEFAULT NULL)" 78 " path BYTEA DEFAULT NULL)"),
77 "WITH OIDS"), 79 GNUNET_PQ_make_try_execute (
80 "ALTER SEQUENCE gnu011dc_oid_seq OWNED BY gn011dc.oid"),
81 GNUNET_PQ_make_try_execute (
82 "CREATE INDEX IF NOT EXISTS idx_oid ON gn011dc (oid)"),
78 GNUNET_PQ_make_try_execute ( 83 GNUNET_PQ_make_try_execute (
79 "CREATE INDEX IF NOT EXISTS idx_key ON gn011dc (key)"), 84 "CREATE INDEX IF NOT EXISTS idx_key ON gn011dc (key)"),
80 GNUNET_PQ_make_try_execute ( 85 GNUNET_PQ_make_try_execute (
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 88ceb1b0a..6a5d45832 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -72,8 +72,10 @@ init_connection (struct Plugin *plugin)
72 * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel 72 * we only test equality on it and can cast it to/from uint32_t. For repl, prio, and anonLevel
73 * we do math or inequality tests, so we can't handle the entire range of uint32_t. 73 * we do math or inequality tests, so we can't handle the entire range of uint32_t.
74 * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC. 74 * This will also cause problems for expiration times after 294247-01-10-04:00:54 UTC.
75 * PostgreSQL also recommends against using WITH OIDS. 75 */
76 */GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 (" 76 GNUNET_PQ_make_try_execute (
77 "CREATE SEQUENCE IF NOT EXISTS gn090_oid_seq"),
78 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 ("
77 " repl INTEGER NOT NULL DEFAULT 0," 79 " repl INTEGER NOT NULL DEFAULT 0,"
78 " type INTEGER NOT NULL DEFAULT 0," 80 " type INTEGER NOT NULL DEFAULT 0,"
79 " prio INTEGER NOT NULL DEFAULT 0," 81 " prio INTEGER NOT NULL DEFAULT 0,"
@@ -82,8 +84,12 @@ init_connection (struct Plugin *plugin)
82 " rvalue BIGINT NOT NULL DEFAULT 0," 84 " rvalue BIGINT NOT NULL DEFAULT 0,"
83 " hash BYTEA NOT NULL DEFAULT ''," 85 " hash BYTEA NOT NULL DEFAULT '',"
84 " vhash BYTEA NOT NULL DEFAULT ''," 86 " vhash BYTEA NOT NULL DEFAULT '',"
85 " value BYTEA NOT NULL DEFAULT '')" 87 " value BYTEA NOT NULL DEFAULT '',"
86 "WITH OIDS"), 88 " oid OID NOT NULL DEFAULT nextval('gn090_oid_seq'))"),
89 GNUNET_PQ_make_try_execute (
90 "ALTER SEQUENCE gn090_oid_seq OWNED BY gn090.oid"),
91 GNUNET_PQ_make_try_execute (
92 "CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid)"),
87 GNUNET_PQ_make_try_execute ( 93 GNUNET_PQ_make_try_execute (
88 "CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"), 94 "CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"),
89 GNUNET_PQ_make_try_execute ( 95 GNUNET_PQ_make_try_execute (
diff --git a/src/namecache/plugin_namecache_postgres.c b/src/namecache/plugin_namecache_postgres.c
index 0e947e9c5..654a3ae81 100644
--- a/src/namecache/plugin_namecache_postgres.c
+++ b/src/namecache/plugin_namecache_postgres.c
@@ -64,15 +64,13 @@ database_setup (struct Plugin *plugin)
64 " query BYTEA NOT NULL DEFAULT ''," 64 " query BYTEA NOT NULL DEFAULT '',"
65 " block BYTEA NOT NULL DEFAULT ''," 65 " block BYTEA NOT NULL DEFAULT '',"
66 " expiration_time BIGINT NOT NULL DEFAULT 0" 66 " expiration_time BIGINT NOT NULL DEFAULT 0"
67 ")" 67 ")");
68 "WITH OIDS");
69 struct GNUNET_PQ_ExecuteStatement es_default = 68 struct GNUNET_PQ_ExecuteStatement es_default =
70 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns096blocks (" 69 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns096blocks ("
71 " query BYTEA NOT NULL DEFAULT ''," 70 " query BYTEA NOT NULL DEFAULT '',"
72 " block BYTEA NOT NULL DEFAULT ''," 71 " block BYTEA NOT NULL DEFAULT '',"
73 " expiration_time BIGINT NOT NULL DEFAULT 0" 72 " expiration_time BIGINT NOT NULL DEFAULT 0"
74 ")" 73 ")");
75 "WITH OIDS");
76 const struct GNUNET_PQ_ExecuteStatement *cr; 74 const struct GNUNET_PQ_ExecuteStatement *cr;
77 75
78 if (GNUNET_YES == 76 if (GNUNET_YES ==
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 01dddde9e..04100567c 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -73,8 +73,7 @@ database_setup (struct Plugin *plugin)
73 " record_data BYTEA NOT NULL DEFAULT ''," 73 " record_data BYTEA NOT NULL DEFAULT '',"
74 " label TEXT NOT NULL DEFAULT ''," 74 " label TEXT NOT NULL DEFAULT '',"
75 " CONSTRAINT zl UNIQUE (zone_private_key,label)" 75 " CONSTRAINT zl UNIQUE (zone_private_key,label)"
76 ")" 76 ")");
77 "WITH OIDS");
78 struct GNUNET_PQ_ExecuteStatement es_default = 77 struct GNUNET_PQ_ExecuteStatement es_default =
79 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records (" 78 GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records ("
80 " seq BIGSERIAL PRIMARY KEY," 79 " seq BIGSERIAL PRIMARY KEY,"
@@ -85,8 +84,7 @@ database_setup (struct Plugin *plugin)
85 " record_data BYTEA NOT NULL DEFAULT ''," 84 " record_data BYTEA NOT NULL DEFAULT '',"
86 " label TEXT NOT NULL DEFAULT ''," 85 " label TEXT NOT NULL DEFAULT '',"
87 " CONSTRAINT zl UNIQUE (zone_private_key,label)" 86 " CONSTRAINT zl UNIQUE (zone_private_key,label)"
88 ")" 87 ")");
89 "WITH OIDS");
90 const struct GNUNET_PQ_ExecuteStatement *cr; 88 const struct GNUNET_PQ_ExecuteStatement *cr;
91 struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END; 89 struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END;
92 90