diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3c3df7f..3512414d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add -f arg to sendmail call in email alert [#676](https://github.com/greenbone/gvmd/pull/676) [#678](https://github.com/greenbone/gvmd/pull/678) ### Fixed +- A PostgreSQL statement order issue [#611](https://github.com/greenbone/gvmd/issues/611) has been addressed [#642](https://github.com/greenbone/gvmd/pull/642) - Fix iCalendar recurrence and timezone handling [#654](https://github.com/greenbone/gvmd/pull/654) - Fix issues with some scheduled tasks by using iCalendar more instead of old period fields [#656](https://github.com/greenbone/gvmd/pull/655) - Fix an issue in getting the reports from GMP scanners [#659](https://github.com/greenbone/gvmd/pull/659) [#665](https://github.com/greenbone/gvmd/pull/665) diff --git a/src/manage_pg.c b/src/manage_pg.c index 02adb3837..22b85d354 100644 --- a/src/manage_pg.c +++ b/src/manage_pg.c @@ -3346,12 +3346,11 @@ check_db_sequences () { iterator_t sequence_tables; init_iterator(&sequence_tables, - "SELECT table_name, column_name," - " pg_get_serial_sequence (table_name, column_name)" - " FROM information_schema.columns" - " WHERE table_schema = 'public'" - " AND pg_get_serial_sequence (table_name, column_name)" - " IS NOT NULL;"); + "WITH table_columns AS (" + " SELECT table_name, column_name FROM information_schema.columns" + " WHERE table_schema = 'public')" + " SELECT *, pg_get_serial_sequence (table_name, column_name) FROM table_columns" + " WHERE pg_get_serial_sequence (table_name, column_name) IS NOT NULL;"); while (next (&sequence_tables)) {