Skip to content

Commit

Permalink
In _modify_table() and _modify_tables() functions, update the group_l…
Browse files Browse the repository at this point in the history
…ast_alter_time_id column of the emaj_group table, to be consistent with other functions that dynamically change the tables groups structure.
  • Loading branch information
beaud76 committed Aug 21, 2019
1 parent 7a1ca74 commit d46aae5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions sql/emaj--3.1.0--devel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,10 @@ $_modify_tables$
v_nbChangedTbl = v_nbChangedTbl + 1;
END IF;
END LOOP;
-- adjust the groups characteristics
UPDATE emaj.emaj_group
SET group_last_alter_time_id = v_timeId
WHERE group_name = ANY(v_groups);
END IF;
-- insert the end entry into the emaj_hist table
INSERT INTO emaj.emaj_hist (hist_function, hist_event, hist_wording)
Expand Down
6 changes: 5 additions & 1 deletion sql/emaj--devel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ CREATE TABLE emaj.emaj_group (
group_creation_time_id BIGINT NOT NULL, -- time stamp of the group's creation
group_pg_version TEXT NOT NULL -- postgres version at emaj_create_group() time
DEFAULT substring (version() FROM E'PostgreSQL\\s([.,0-9,A-Z,a-z]*)'),
group_last_alter_time_id BIGINT, -- time stamp of the last emaj_alter_group() call
group_last_alter_time_id BIGINT, -- time stamp of the last group structure change
-- set to NULL at emaj_create_group() time
group_has_waiting_changes BOOLEAN NOT NULL, -- are there recent changes in emaj_group_def not yet applied in emaj_group ?
group_is_logging BOOLEAN NOT NULL, -- are log triggers activated ?
Expand Down Expand Up @@ -2425,6 +2425,10 @@ $_modify_tables$
v_nbChangedTbl = v_nbChangedTbl + 1;
END IF;
END LOOP;
-- adjust the groups characteristics
UPDATE emaj.emaj_group
SET group_last_alter_time_id = v_timeId
WHERE group_name = ANY(v_groups);
END IF;
-- insert the end entry into the emaj_hist table
INSERT INTO emaj.emaj_hist (hist_function, hist_event, hist_wording)
Expand Down
6 changes: 5 additions & 1 deletion sql/emaj-devel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ CREATE TABLE emaj.emaj_group (
group_creation_time_id BIGINT NOT NULL, -- time stamp of the group's creation
group_pg_version TEXT NOT NULL -- postgres version at emaj_create_group() time
DEFAULT substring (version() FROM E'PostgreSQL\\s([.,0-9,A-Z,a-z]*)'),
group_last_alter_time_id BIGINT, -- time stamp of the last emaj_alter_group() call
group_last_alter_time_id BIGINT, -- time stamp of the last group structure change
-- set to NULL at emaj_create_group() time
group_has_waiting_changes BOOLEAN NOT NULL, -- are there recent changes in emaj_group_def not yet applied in emaj_group ?
group_is_logging BOOLEAN NOT NULL, -- are log triggers activated ?
Expand Down Expand Up @@ -2432,6 +2432,10 @@ $_modify_tables$
v_nbChangedTbl = v_nbChangedTbl + 1;
END IF;
END LOOP;
-- adjust the groups characteristics
UPDATE emaj.emaj_group
SET group_last_alter_time_id = v_timeId
WHERE group_name = ANY(v_groups);
END IF;
-- insert the end entry into the emaj_hist table
INSERT INTO emaj.emaj_hist (hist_function, hist_event, hist_wording)
Expand Down
8 changes: 6 additions & 2 deletions test/11/expected/install_psql.out
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ CREATE TABLE emaj.emaj_group (
group_creation_time_id BIGINT NOT NULL, -- time stamp of the group's creation
group_pg_version TEXT NOT NULL -- postgres version at emaj_create_group() time
DEFAULT substring (version() FROM E'PostgreSQL\\s([.,0-9,A-Z,a-z]*)'),
group_last_alter_time_id BIGINT, -- time stamp of the last emaj_alter_group() call
group_last_alter_time_id BIGINT, -- time stamp of the last group structure change
-- set to NULL at emaj_create_group() time
group_has_waiting_changes BOOLEAN NOT NULL, -- are there recent changes in emaj_group_def not yet applied in emaj_group ?
group_is_logging BOOLEAN NOT NULL, -- are log triggers activated ?
Expand Down Expand Up @@ -2363,6 +2363,10 @@ $_modify_tables$
v_nbChangedTbl = v_nbChangedTbl + 1;
END IF;
END LOOP;
-- adjust the groups characteristics
UPDATE emaj.emaj_group
SET group_last_alter_time_id = v_timeId
WHERE group_name = ANY(v_groups);
END IF;
-- insert the end entry into the emaj_hist table
INSERT INTO emaj.emaj_hist (hist_function, hist_event, hist_wording)
Expand Down Expand Up @@ -9679,7 +9683,7 @@ $do$
RETURN;
END;
$do$;
psql:sql/emaj-devel.sql:9898: NOTICE: E-Maj installation: E-Maj successfully installed.
psql:sql/emaj-devel.sql:9902: NOTICE: E-Maj installation: E-Maj successfully installed.
COMMIT;
-----------------------------
-- check installation
Expand Down

0 comments on commit d46aae5

Please sign in to comment.