This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Unable to create after insert trigger on mariadb

Hi,

I followed trigger instructions from documentation. When i run the script from command line, cursor does not come back. i have to kill the execution

Server version: 5.5.46-MariaDB MariaDB Server

Tried various formats

CREATE TRIGGER company_insert AFTER INSERT ON companyMain FOR EACH ROW INSERT INTO companytest (ID, Value) VALUES (20, CONCAT(NEW.`Code`,' - ',NEW.`Name`)); ------------ DELIMITER DROP TRIGGER IF EXISTS company_insert ; CREATE TRIGGER company_insert AFTER INSERT ON companyMainFOR EACH ROW BEGIN DECLARE vFormatID int; SET vFormatID=20; INSERT INTO companytest (ID,Value) VALUES ( vFormatID,NEW.`Name`); END; DELIMITER;

Tried running from command directly or pass as .sql file. both ways its stuck no response back on command. Have to kill. ^CCtrl-C -- query killed. Continuing normally. ERROR 1317 (70100) at line 3: Query execution was interrupted

Your help will be appreciated.

Answer Answered by Federico Razzoli in this comment.

Ideally, the process that's holding the lock should COMMIT the current transaction. If you can't achieve this, just kill the process:

KILL 8

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.