Allon Mureinik has uploaded a new change for review. Change subject: core: Fix db upgrade in PostgreSQL 8.x ......................................................................
core: Fix db upgrade in PostgreSQL 8.x PostgreSQL 8.x and 9.x have a different behaviour regarding when inline SQL queries in PL/pgSQL code is evaluated (see http://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.0#PL.2FpgSQL_changes_which_may_cause_regressions). The current problem in upgrading the database in PostgreSQL 8.x is the min_refresh_rate column added in 03_02_0440_materialized_views_extensions.sql. The relevant parts of current flow (before the patch): 1. pre_upgrade script 30 creates the materialized_views table 2. materialized view functions are created 3. [various upgrade scripts] 4. 03_02_0440_materialized_views_extensions.sql - add a column to materialized_views. In 8.x variants, stage (2) will fail since the function can not compile due to the missing column. This patch changes the flow as follows: 1. pre_upgrade script 30 creates the materialized_views table 2. pre_upgrade script 40 adds the missing column 3. materialized view functions are created 4. [various upgrade scripts] Note that the original dbscripts/upgrade/03_02_0440_materialized_views_extensions.sql is preserved for backwards compatibility. Since it is reentrant (the column is only created if it did not previously exist), this is the safest way to go. Change-Id: Ifc40a2d40c067b1ace123c565cada27ddd26cc5c Signed-off-by: Allon Mureinik <amure...@redhat.com> --- A backend/manager/dbscripts/upgrade/pre_upgrade/0040_materialized_views_extensions.sql 1 file changed, 6 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/12076/1 diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0040_materialized_views_extensions.sql b/backend/manager/dbscripts/upgrade/pre_upgrade/0040_materialized_views_extensions.sql new file mode 100644 index 0000000..a3d2260 --- /dev/null +++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0040_materialized_views_extensions.sql @@ -0,0 +1,6 @@ +-- Determines the minimum duration we will have to wait between 2 refreshes , 0 means : no wait +select fn_db_add_column('materialized_views', 'min_refresh_rate_in_sec', 'int default 0'); +-- Indicates if this is a product view or custom view +select fn_db_add_column('materialized_views', 'custom', 'boolean default false'); +-- Indicates if this materialized_view is currently active +select fn_db_add_column('materialized_views', 'active', 'boolean default true'); -- To view, visit http://gerrit.ovirt.org/12076 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifc40a2d40c067b1ace123c565cada27ddd26cc5c Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <amure...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches