From bc26650e9e625362a768eb6f0327cf8a13743b8e Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Mon, 27 May 2019 19:06:51 +0200 Subject: [PATCH 1/3] Remove unmaintained drop script --- doc/postgres-HOWTO | 87 ---------------------------------------------- 1 file changed, 87 deletions(-) diff --git a/doc/postgres-HOWTO b/doc/postgres-HOWTO index 0e73e0bd1..e1d442b58 100644 --- a/doc/postgres-HOWTO +++ b/doc/postgres-HOWTO @@ -57,93 +57,6 @@ Migrating from SQLite to PostgreSQL 3 Run "greenbone-certdata-sync". -Handy script to drop all data ------------------------------ - -#!/bin/sh - -export PGOPTIONS='--client-min-messages=warning' - -PSQL="psql -q gvmd --pset pager=off -t -c" - -$PSQL "`psql gvmd --pset pager=off -t -c \"select 'drop table '||schemaname||'.'||tablename||' CASCADE;' from pg_tables where schemaname = 'public' order by schemaname, tablename;\"`" - -$PSQL "DROP FUNCTION IF EXISTS public.common_cve(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.create_index(text, text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.create_index(text, text, text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.current_severity(real, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.dynamic_severity();"; -$PSQL "DROP FUNCTION IF EXISTS public.group_concat_pair(text, text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.hosts_contains(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.iso_time(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.level_max_severity(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.level_min_severity(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.lower(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.m_now();"; -$PSQL "DROP FUNCTION IF EXISTS public.make_uuid();"; -$PSQL "DROP FUNCTION IF EXISTS public.max_hosts(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.next_time(integer, integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.now();"; -$PSQL "DROP FUNCTION IF EXISTS public.order_inet(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.order_message_type(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.order_port(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.order_role(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.order_threat(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_active(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_host_count(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_progress(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_progress_active(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_result_host_count(integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_severity(integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_severity(integer, integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_severity_count(integer, integer, integer, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.report_severity_count(integer, integer, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.resource_name(text, text, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.run_status_name(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_class();"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_in_level(double precision, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_in_level(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_matches(double precision, double precision);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_matches_ov(double precision, double precision);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_to_level(double precision, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_to_level(text, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.severity_to_type(double precision);"; -$PSQL "DROP FUNCTION IF EXISTS public.t();"; -$PSQL "DROP FUNCTION IF EXISTS public.tag(text, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_last_report(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_second_last_report(integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_severity(integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_severity(integer, integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_threat_level(integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_threat_level(integer, integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_trend(integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.task_trend(integer, integer, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.uniquify(text, text, integer, text);"; -$PSQL "DROP FUNCTION IF EXISTS public.user_can_everything(text);"; -$PSQL "DROP FUNCTION IF EXISTS public.user_has_super_on_resource(text, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.user_owns(text, integer);"; -$PSQL "DROP FUNCTION IF EXISTS public.valid_db_resource_type(text);"; - -$PSQL "DROP AGGREGATE IF EXISTS public.group_concat (text, text);"; -$PSQL "DROP AGGREGATE IF EXISTS public.group_concat_pair (text, text, text);"; - -$PSQL "DROP INDEX IF EXISTS public.nvt_cves_by_oid;"; -$PSQL "DROP INDEX IF EXISTS public.nvt_selectors_by_family_or_nvt;"; -$PSQL "DROP INDEX IF EXISTS public.nvt_selectors_by_name;"; -$PSQL "DROP INDEX IF EXISTS public.nvts_by_creation_time;"; -$PSQL "DROP INDEX IF EXISTS public.nvts_by_family;"; -$PSQL "DROP INDEX IF EXISTS public.nvts_by_name;"; -$PSQL "DROP INDEX IF EXISTS public.report_host_details_by_report_host_and_name_and_value;"; -$PSQL "DROP INDEX IF EXISTS public.report_hosts_by_report_and_host;"; -$PSQL "DROP INDEX IF EXISTS public.results_by_report;"; - -echo -n "\\d+: " -$PSQL "\d+" - -echo "\\df: " -$PSQL "\df" - - Analyzing the size of the tables -------------------------------- From 609778410dc8ecb360cbdf32e3ae4e4fd49f351b Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Mon, 27 May 2019 19:20:42 +0200 Subject: [PATCH 2/3] Document Postgres requirements when switching GVM versions --- doc/postgres-HOWTO | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/postgres-HOWTO b/doc/postgres-HOWTO index e1d442b58..be629be38 100644 --- a/doc/postgres-HOWTO +++ b/doc/postgres-HOWTO @@ -57,6 +57,31 @@ Migrating from SQLite to PostgreSQL 3 Run "greenbone-certdata-sync". +Switching between releases +-------------------------- + +There are two factors for developers to consider when switching between +releases if they are using Postgres as the backend: + +1 gvmd uses C server-side extensions that link to gvm-libs, so Postgres + needs to be able to find the version of gvm-libs that goes with gvmd. + + One way to do this is to modify ld.so.conf and run ldconfig after + installing the desired gvmd version. + +2 The Postgres database "gvmd" must be the version that is supported by + gvmd. If it is too high, gvmd will refuse to run. If it is too low + gvmd will only run if the database is migrated to the higher version. + + One way to handle this is to switch between different versions of the + database using RENAME: + + sudo -u postgres psql -q --command='ALTER DATABASE gvmd RENAME TO gvmd_10;' + sudo -u postgres psql -q --command='ALTER DATABASE gvmd_master RENAME TO gvmd;' + + Note that for OpenVAS-9 the database name is "tasks", so this step is not + necessary. + Analyzing the size of the tables -------------------------------- From 326004bb8a563cbee9d276c5d93120b0a825164d Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Mon, 27 May 2019 19:22:26 +0200 Subject: [PATCH 3/3] Add missing line --- doc/postgres-HOWTO | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/postgres-HOWTO b/doc/postgres-HOWTO index be629be38..018d5f2b2 100644 --- a/doc/postgres-HOWTO +++ b/doc/postgres-HOWTO @@ -82,6 +82,7 @@ releases if they are using Postgres as the backend: Note that for OpenVAS-9 the database name is "tasks", so this step is not necessary. + Analyzing the size of the tables --------------------------------