diff --git a/CHANGELOG.md b/CHANGELOG.md index f1134d7d5..1fbd70841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Use GMP version with leading zero for feed dirs [#1287](https://github.com/greenbone/gvmd/pull/1287) +- Correct FROM of some queries to the right schema [#1295](https://github.com/greenbone/gvmd/pull/1295) ### Removed - Reduce Severity Classes [#1285](https://github.com/greenbone/gvmd/pull/1285) diff --git a/src/manage_pg.c b/src/manage_pg.c index 97754de77..71b08d4d8 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -3133,7 +3133,7 @@ manage_db_init (const gchar *name) sql ("CREATE OR REPLACE FUNCTION cert.cert_delete_bund_adv ()" " RETURNS TRIGGER AS $$" " BEGIN" - " DELETE FROM cert_bund_cves where adv_id = old.id;" + " DELETE FROM cert.cert_bund_cves where adv_id = old.id;" " RETURN old;" " END;" "$$ LANGUAGE plpgsql;"); diff --git a/src/manage_sql.c b/src/manage_sql.c index d282ec4e6..9a83578de 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -32440,7 +32440,7 @@ check_for_new_cert () if (manage_cert_loaded ()) { if (sql_int ("SELECT EXISTS" - " (SELECT * FROM cert_bund_advs" + " (SELECT * FROM cert.cert_bund_advs" " WHERE creation_time" " > coalesce (CAST ((SELECT value FROM meta" " WHERE name" @@ -32811,11 +32811,11 @@ new_cert_bunds_list (event_t event, const void* event_data, alert_t alert, count = 0; if (example) init_iterator (&rows, - "SELECT uuid, name, title FROM cert_bund_advs" + "SELECT uuid, name, title FROM cert.cert_bund_advs" " LIMIT 4;"); else if (event == EVENT_NEW_SECINFO) init_iterator (&rows, - "SELECT uuid, name, title FROM cert_bund_advs" + "SELECT uuid, name, title FROM cert.cert_bund_advs" " WHERE creation_time" " > coalesce (CAST ((SELECT value FROM meta" " WHERE name" @@ -32825,7 +32825,7 @@ new_cert_bunds_list (event_t event, const void* event_data, alert_t alert, " ORDER BY creation_time DESC;"); else init_iterator (&rows, - "SELECT uuid, name, title FROM cert_bund_advs" + "SELECT uuid, name, title FROM cert.cert_bund_advs" " WHERE modification_time" " > coalesce (CAST ((SELECT value FROM meta" " WHERE name" @@ -33218,7 +33218,7 @@ check_for_updated_cert () if (manage_cert_loaded ()) { if (sql_int ("SELECT EXISTS" - " (SELECT * FROM cert_bund_advs" + " (SELECT * FROM cert.cert_bund_advs" " WHERE modification_time" " > coalesce (CAST ((SELECT value FROM meta" " WHERE name" diff --git a/src/manage_sql_secinfo.c b/src/manage_sql_secinfo.c index eea7f4838..488da5fec 100644 --- a/src/manage_sql_secinfo.c +++ b/src/manage_sql_secinfo.c @@ -1292,8 +1292,8 @@ init_cve_cert_bund_adv_iterator (iterator_t *iterator, const char *cve, columns = columns_build_select (select_columns); init_iterator (iterator, "SELECT %s" - " FROM cert_bund_advs" - " WHERE id IN (SELECT adv_id FROM cert_bund_cves" + " FROM cert.cert_bund_advs" + " WHERE id IN (SELECT adv_id FROM cert.cert_bund_cves" " WHERE cve_name = '%s')" " ORDER BY %s %s;", columns, @@ -1316,8 +1316,8 @@ init_nvt_cert_bund_adv_iterator (iterator_t *iterator, const char *oid) init_iterator (iterator, "SELECT name" - " FROM cert_bund_advs" - " WHERE id IN (SELECT adv_id FROM cert_bund_cves" + " FROM cert.cert_bund_advs" + " WHERE id IN (SELECT adv_id FROM cert.cert_bund_cves" " WHERE cve_name IN (SELECT ref_id" " FROM vt_refs" " WHERE vt_oid = '%s'" @@ -2112,7 +2112,7 @@ update_bund_xml (const gchar *xml_path, int last_cert_update, sql ("INSERT INTO cert_bund_cves" " (adv_id, cve_name)" " VALUES" - " ((SELECT id FROM cert_bund_advs" + " ((SELECT id FROM cert.cert_bund_advs" " WHERE name = '%s')," " '%s')", quoted_refnum, diff --git a/src/manage_sql_secinfo.h b/src/manage_sql_secinfo.h index 1f8d734ee..4d280b3f9 100644 --- a/src/manage_sql_secinfo.h +++ b/src/manage_sql_secinfo.h @@ -29,7 +29,7 @@ * @brief SQL to check if a result has CERT Bunds. */ #define SECINFO_SQL_RESULT_HAS_CERT_BUNDS \ - "(SELECT EXISTS (SELECT * FROM cert_bund_cves" \ + "(SELECT EXISTS (SELECT * FROM cert.cert_bund_cves" \ " WHERE cve_name IN (SELECT ref_id" \ " FROM vt_refs" \ " WHERE vt_oid = results.nvt" \ @@ -40,8 +40,8 @@ */ #define SECINFO_SQL_RESULT_CERT_BUNDS \ "(ARRAY (SELECT name::text" \ - " FROM cert_bund_advs" \ - " WHERE id IN (SELECT adv_id FROM cert_bund_cves" \ + " FROM cert.cert_bund_advs" \ + " WHERE id IN (SELECT adv_id FROM cert.cert_bund_cves" \ " WHERE cve_name IN (SELECT ref_id" \ " FROM vt_refs" \ " WHERE vt_oid = results.nvt" \