2

Given error: #1436 - Thread stack overrun: 6024 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack.

DROP TRIGGER IF EXISTS `After_delete_area_package`;
DELIMITER //
CREATE TRIGGER `After_delete_area_package` AFTER DELETE ON `area_package`
FOR EACH ROW BEGIN    
DELETE FROM accounts_areas
WHERE (area_id = 1); 
END
//
DELIMITER ;

simple as hell i would guess. The only area_id in table accounts_areas is 1
Before that i tried old.package_area_id

I do not have foreign key restraints and my overhead goes red in phpMyAdmin set to 28B.

RDMS: myISAM

SQLFIDDLE: http://sqlfiddle.com/#!2/79a41

Question: Why would my trigger not delete all the rows from accounts_areas where area_id = 1

Kermit
  • 33,827
  • 13
  • 85
  • 121
Niels Aulman
  • 79
  • 2
  • 9
  • sample data or table schema or i personally feel sqlfiddle with some real data would allow SO users to solve questions in seconds .. – rahularyansharma Oct 16 '12 at 15:12

1 Answers1

0

Could you perhaps be missing an END?

DROP TRIGGER IF EXISTS After_delete_area_package;

DELIMITER $$
CREATE TRIGGER After_delete_area_package AFTER DELETE ON area_package
FOR EACH ROW
BEGIN
DELETE FROM accounts_areas
    WHERE area_id = 1;
END$$
DELIMITER;

Edit 1

Since you are reviving a thread_stack error, the solution would would be to increase the stack size.

Kermit
  • 33,827
  • 13
  • 85
  • 121
  • Forgot to copy that. Edited to the above, still not working. I am deleting the row from my backend – Niels Aulman Oct 16 '12 at 15:24
  • Do you receive any errors? What is the result of `SELECT * FROM accounts_areas WHERE area_id = 1`? Try including adding the database (`...TRIGGER db.After_delete...`) – Kermit Oct 16 '12 at 15:26
  • The error i get when removing the row in phpMyAdmin #1436 - Thread stack overrun: 6024 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld -O thread_stack=#' to specify a bigger stack. – Niels Aulman Oct 16 '12 at 15:32
  • @NielsAulman See [this](http://stackoverflow.com/questions/8821575/mysql-error-1436-thread-stack-overrun-with-simple-query), [this](http://stackoverflow.com/questions/10376725/how-do-i-resolve-a-mysql-thread-stack-overrun) and [this](http://stackoverflow.com/questions/5021945/why-does-this-mysql-trigger-cause-a-stack-overflow) for possible resolutions to the error. – Kermit Oct 16 '12 at 15:35
  • I have manualy edited the my.cnf to 256kb but. The query now works but the downside is that i lost my insert in phpMyAdmin. Bit weird – Niels Aulman Oct 16 '12 at 15:55
  • Ok i lost most functionality in phpMyAdmin – Niels Aulman Oct 16 '12 at 15:59