aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2020-09-27 19:55:09 +0100
committerDaniel Golle <daniel@makrotopia.org>2020-10-05 15:39:05 +0100
commitdaa0f22b63c1442ad51122e5ba140c1ae5890267 (patch)
treef732b1eb5f78482ff0a7a367a6bce2eff9608437 /src/datastore
parent400f527fbd5cb6d9523374f6f8d1320339c5b71a (diff)
downloadgnunet-daa0f22b63c1442ad51122e5ba140c1ae5890267.tar.gz
gnunet-daa0f22b63c1442ad51122e5ba140c1ae5890267.zip
postgres: drop use of 'WITH OIDS'
PostgreSQL since version 12 no longer supports 'WITH OIDS': Previously, a normally-invisible oid column could be specified during table creation using WITH OIDS; that ability has been removed. Columns can still be explicitly declared as type oid. Operations on tables that have columns created using WITH OIDS will need adjustment. The system catalogs that previously had hidden oid columns now have ordinary oid columns. Hence, SELECT * will now output those columns, whereas previously they would be displayed only if selected explicitly. Drop 'WITH OIDS' as it was stated even on tables for plugins which didn't make any use of the then exposed 'oid' column. In the case of datacache and datastore the 'oid' column is used, so replace the 'WITH OIDS' statement with an explicit 'oid' column having 'OID' type and a corresponding sequence. No measures are taken to still work with PostgreSQL before version 12. Users should update PostgreSQL to version 12 or newer. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/plugin_datastore_postgres.c14
1 files changed, 10 insertions, 4 deletions
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 (