Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the state of a database trigger of type "On Commit" from inactive to active, the state change has no effect on other already opened connections. [CORE6021] #6271

Open
firebird-automations opened this issue Mar 1, 2019 · 0 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Fernando Burciaga (fernando.burciaga)

When having a database with a transaction commit database trigger and changing its state from inactive to active and vice versa the state is not changed in already opened connections. If there are other open connections, the commits done on these other connections do not execute the on transacttion commit trigger. Only new connections and the connection which activated the trigger execute it when commiting a transaction.
With firebird version 2.5.8 the state change did affect other opened connections , but it doesn't with version 3.0.4.
Table triggers do not have the same behavior, when activating a table trigger, other connections do execute the trigger correctly, even on version 3.0.4.

Steps to reproduce:

--- Create table in which the time of commit will be inserted by database trigger for every transaction commit ---
CREATE TABLE COMMITED(
COMMITED_TIME VARCHAR(50)
);

--- create inactive on transaction commit trigger ---
CREATE TRIGGER TR_ONCOMMIT_TIME INACTIVE ON TRANSACTION COMMIT
AS
BEGIN
INSERT INTO COMMITED(COMMITED_TIME)
VALUES (CURRENT_TIME);
END;

--- Open 2 connections at the same time for the database ---

--- On connection 1 change the trigger status to ACTIVE ---
ALTER TRIGGER TR_ONCOMMIT_TIME ACTIVE

--- Start doing commits on both connections. Commits on connection 1 should start inserting into table COMMITED for every commit made, while connection 2 will not. ---

This same test has different behavior on versions 2.5.8 and 3.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant