2
I’m getting the error below when I try to make an insertion in Sqlite.
Error while executing SQL query on database 'BDTESTE': Too Many levels of Trigger recursion
Table creation
CREATE TABLE INSTANCES (
ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
NAME varchar(255) NOT NULL UNIQUE,
DESCRIPTION text,
CONFIG_TXT text,
EXTRA_TXT text,
CREATED varchar(50) NULL,
MODIFIED varchar(50) NULL
);
Creation of Trigger
CREATE TRIGGER INSTANCE_INSERT AFTER INSERT ON INSTANCES
BEGIN
UPDATE INSTANCES SET CREATED = DATETIME('NOW') WHERE ID = NEW.ID;
END;
Creation of Trigger - Update
CREATE TRIGGER INSTANCE_UPDATE AFTER UPDATE ON INSTANCES
BEGIN
UPDATE INSTANCES SET MODIFIED = DATETIME('NOW') WHERE ID = OLD.ID;
END;
Insertion
INSERT INTO INSTANCES (NAME, DESCRIPTION, CONFIG_TXT, EXTRA_TXT)
VALUES
('app02', 'Intancia de teste Windows', 'blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah', '');
You don’t have any update Rigger?
– Jefferson Quesado
Yes @Jeffersonquesado, updated the publication
– Lucas Souza
Interesting, I created it a Rigger with the same structure as its and works perfectly...
– Jefferson Quesado
Ah, so the problem is there, on the update Trigger
– Jefferson Quesado