diff --git a/sql/emaj--next_version.sql b/sql/emaj--next_version.sql index 5fa09a98..3c41aa78 100644 --- a/sql/emaj--next_version.sql +++ b/sql/emaj--next_version.sql @@ -4907,7 +4907,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -4919,7 +4919,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/sql/emaj.sql b/sql/emaj.sql index 995d083f..e9f11f62 100644 --- a/sql/emaj.sql +++ b/sql/emaj.sql @@ -4983,7 +4983,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -4995,7 +4995,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/sql/emaj_src.sql b/sql/emaj_src.sql index 1586b731..7d339673 100644 --- a/sql/emaj_src.sql +++ b/sql/emaj_src.sql @@ -5006,7 +5006,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5018,7 +5018,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/83/expected/instPsql.out b/test/83/expected/instPsql.out index 3bbc0d38..d4418546 100644 --- a/test/83/expected/instPsql.out +++ b/test/83/expected/instPsql.out @@ -5075,7 +5075,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5087,7 +5087,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/83/expected/misc.out b/test/83/expected/misc.out index 2062d151..3761f09f 100644 --- a/test/83/expected/misc.out +++ b/test/83/expected/misc.out @@ -457,6 +457,13 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); + emaj_estimate_rollback_group +------------------------------ + @ 0.00 secs +(1 row) + +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); emaj_estimate_rollback_group ------------------------------ diff --git a/test/84/expected/instPsql.out b/test/84/expected/instPsql.out index 3d1d1d3a..ad247f1f 100644 --- a/test/84/expected/instPsql.out +++ b/test/84/expected/instPsql.out @@ -5075,7 +5075,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5087,7 +5087,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/84/expected/misc.out b/test/84/expected/misc.out index 99a41e88..d0493d99 100644 --- a/test/84/expected/misc.out +++ b/test/84/expected/misc.out @@ -457,6 +457,13 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); + emaj_estimate_rollback_group +------------------------------ + @ 0.004 secs +(1 row) + +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); emaj_estimate_rollback_group ------------------------------ diff --git a/test/90/expected/instPsql.out b/test/90/expected/instPsql.out index 7d58d7c5..47f7c09b 100644 --- a/test/90/expected/instPsql.out +++ b/test/90/expected/instPsql.out @@ -5075,7 +5075,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5087,7 +5087,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/90/expected/misc.out b/test/90/expected/misc.out index c6afb38c..63dad0d0 100644 --- a/test/90/expected/misc.out +++ b/test/90/expected/misc.out @@ -457,6 +457,13 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); + emaj_estimate_rollback_group +------------------------------ + @ 0.004 secs +(1 row) + +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); emaj_estimate_rollback_group ------------------------------ diff --git a/test/91/expected/instPsql.out b/test/91/expected/instPsql.out index 525c02a2..90d65e85 100644 --- a/test/91/expected/instPsql.out +++ b/test/91/expected/instPsql.out @@ -5075,7 +5075,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5087,7 +5087,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/91/expected/misc.out b/test/91/expected/misc.out index 38a361e8..04726b17 100644 --- a/test/91/expected/misc.out +++ b/test/91/expected/misc.out @@ -457,6 +457,13 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); + emaj_estimate_rollback_group +------------------------------ + @ 0.004 secs +(1 row) + +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); emaj_estimate_rollback_group ------------------------------ diff --git a/test/92/expected/instPsql.out b/test/92/expected/instPsql.out index 2f879b61..34046f17 100644 --- a/test/92/expected/instPsql.out +++ b/test/92/expected/instPsql.out @@ -5075,7 +5075,7 @@ r record; BEGIN -- check supplied group names and mark parameters SELECT emaj._rlbk_check(v_groupNames,v_mark) INTO v_markName; --- compute a random negative rollback-id +-- compute a random negative rollback-id (not to interfere with ids of real rollbacks) SELECT (random() * -10000000000)::bigint INTO v_rlbkId; -- -- simulate a rollback planning @@ -5087,7 +5087,7 @@ r record; -- call the _rlbk_planning function PERFORM emaj._rlbk_planning(v_rlbkId); -- compute the sum of the duration estimates of all elementary steps - SELECT sum(rlbp_estimated_duration) INTO v_estimDuration + SELECT coalesce(sum(rlbp_estimated_duration), '0 SECONDS'::INTERVAL) INTO v_estimDuration FROM emaj.emaj_rlbk_plan WHERE rlbp_rlbk_id = v_rlbkId; -- cancel the effect of the rollback planning diff --git a/test/92/expected/misc.out b/test/92/expected/misc.out index 5cf3980d..02f322a9 100644 --- a/test/92/expected/misc.out +++ b/test/92/expected/misc.out @@ -457,6 +457,13 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); + emaj_estimate_rollback_group +------------------------------ + @ 0.004 secs +(1 row) + +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); emaj_estimate_rollback_group ------------------------------ diff --git a/test/sql/misc.sql b/test/sql/misc.sql index 61e83fc4..eccb4bc3 100644 --- a/test/sql/misc.sql +++ b/test/sql/misc.sql @@ -164,6 +164,9 @@ select reltuples from pg_class, pg_namespace where relnamespace=pg_namespace.oid -- estimate with empty rollback statistics and default parameters delete from emaj.emaj_rlbk_stat; +select emaj.emaj_estimate_rollback_group('myGroup2','EMAJ_LAST_MARK',FALSE); +-- should return 0.004000 sec (nothing to rollback => only the fixed costs) + select emaj.emaj_estimate_rollback_group('myGroup2','Mark21',FALSE); -- should return 1.436620 sec