aboutsummaryrefslogtreecommitdiff
path: root/src/datacache
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/datacache
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/datacache')
-rw-r--r--src/datacache/plugin_datacache_postgres.c9
1 files changed, 7 insertions, 2 deletions
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 (