[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: postgres: drop use of 'WITH OIDS'
From: |
gnunet |
Subject: |
[gnunet] branch master updated: postgres: drop use of 'WITH OIDS' |
Date: |
Mon, 05 Oct 2020 16:46:04 +0200 |
This is an automated email from the git hooks/post-receive script.
daniel-golle pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new daa0f22b6 postgres: drop use of 'WITH OIDS'
daa0f22b6 is described below
commit daa0f22b63c1442ad51122e5ba140c1ae5890267
Author: Daniel Golle <daniel@makrotopia.org>
AuthorDate: Sun Sep 27 19:55:09 2020 +0100
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>
---
configure.ac | 2 +-
src/datacache/plugin_datacache_postgres.c | 9 +++++++--
src/datastore/plugin_datastore_postgres.c | 14 ++++++++++----
src/namecache/plugin_namecache_postgres.c | 6 ++----
src/namestore/plugin_namestore_postgres.c | 6 ++----
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
# test for postgres:
postgres=false
-AX_LIB_POSTGRESQL([9.5],
+AX_LIB_POSTGRESQL([12.0],
[CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
AC_CHECK_HEADERS([libpq-fe.h],
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
init_connection (struct Plugin *plugin)
{
struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_try_execute ("CREATE TEMPORARY SEQUENCE IF NOT EXISTS
gn011dc_oid_seq"),
GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn011dc ("
+ " oid OID NOT NULL DEFAULT
nextval('gn011dc_oid_seq'),"
" type INTEGER NOT NULL,"
" prox INTEGER NOT NULL,"
" discard_time BIGINT NOT NULL,"
" key BYTEA NOT NULL,"
" value BYTEA NOT NULL,"
- " path BYTEA DEFAULT NULL)"
- "WITH OIDS"),
+ " path BYTEA DEFAULT NULL)"),
+ GNUNET_PQ_make_try_execute (
+ "ALTER SEQUENCE gnu011dc_oid_seq OWNED BY gn011dc.oid"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX IF NOT EXISTS idx_oid ON gn011dc (oid)"),
GNUNET_PQ_make_try_execute (
"CREATE INDEX IF NOT EXISTS idx_key ON gn011dc (key)"),
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)
* we only test equality on it and can cast it to/from uint32_t. For repl,
prio, and anonLevel
* we do math or inequality tests, so we can't handle the entire range of
uint32_t.
* This will also cause problems for expiration times after
294247-01-10-04:00:54 UTC.
- * PostgreSQL also recommends against using WITH OIDS.
- */GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 ("
+ */
+ GNUNET_PQ_make_try_execute (
+ "CREATE SEQUENCE IF NOT EXISTS gn090_oid_seq"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS gn090 ("
" repl INTEGER NOT NULL DEFAULT 0,"
" type INTEGER NOT NULL DEFAULT 0,"
" prio INTEGER NOT NULL DEFAULT 0,"
@@ -82,8 +84,12 @@ init_connection (struct Plugin *plugin)
" rvalue BIGINT NOT NULL DEFAULT 0,"
" hash BYTEA NOT NULL DEFAULT '',"
" vhash BYTEA NOT NULL DEFAULT '',"
- " value BYTEA NOT NULL DEFAULT '')"
- "WITH OIDS"),
+ " value BYTEA NOT NULL DEFAULT '',"
+ " oid OID NOT NULL DEFAULT
nextval('gn090_oid_seq'))"),
+ GNUNET_PQ_make_try_execute (
+ "ALTER SEQUENCE gn090_oid_seq OWNED BY gn090.oid"),
+ GNUNET_PQ_make_try_execute (
+ "CREATE INDEX IF NOT EXISTS oid_hash ON gn090 (oid)"),
GNUNET_PQ_make_try_execute (
"CREATE INDEX IF NOT EXISTS idx_hash ON gn090 (hash)"),
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)
" query BYTEA NOT NULL DEFAULT '',"
" block BYTEA NOT NULL DEFAULT '',"
" expiration_time BIGINT NOT NULL DEFAULT 0"
- ")"
- "WITH OIDS");
+ ")");
struct GNUNET_PQ_ExecuteStatement es_default =
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns096blocks ("
" query BYTEA NOT NULL DEFAULT '',"
" block BYTEA NOT NULL DEFAULT '',"
" expiration_time BIGINT NOT NULL DEFAULT 0"
- ")"
- "WITH OIDS");
+ ")");
const struct GNUNET_PQ_ExecuteStatement *cr;
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)
" record_data BYTEA NOT NULL DEFAULT '',"
" label TEXT NOT NULL DEFAULT '',"
" CONSTRAINT zl UNIQUE (zone_private_key,label)"
- ")"
- "WITH OIDS");
+ ")");
struct GNUNET_PQ_ExecuteStatement es_default =
GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS ns098records ("
" seq BIGSERIAL PRIMARY KEY,"
@@ -85,8 +84,7 @@ database_setup (struct Plugin *plugin)
" record_data BYTEA NOT NULL DEFAULT '',"
" label TEXT NOT NULL DEFAULT '',"
" CONSTRAINT zl UNIQUE (zone_private_key,label)"
- ")"
- "WITH OIDS");
+ ")");
const struct GNUNET_PQ_ExecuteStatement *cr;
struct GNUNET_PQ_ExecuteStatement sc = GNUNET_PQ_EXECUTE_STATEMENT_END;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: postgres: drop use of 'WITH OIDS',
gnunet <=