List:Replication« Previous MessageNext Message »
From:Eber Duarte Date:July 29 2008 2:27pm
Subject:Problem related to trigger
View as plain text  
Hi,

I'm note sure if here is the right place to ask about this, but I'm facing some problem
with trigger and replication.
I'm trying to enforce Foreign Key checks on MyISAM using triggers, but I'm not able to
interrupt trigger execution.

On MySQL manual (http://dev.mysql.com/doc/refman/5.1/en/routine-restrictions.html), we
have:

 For triggers, the following additional statements or operations are disallowed:
    * Triggers currently are not activated by foreign key actions.
    * The RETURN statement is disallowed in triggers, which cannot return a
value. To exit a trigger immediately, use the LEAVE statement. 

I tried to use LEAVE statement, but I got a sintax error:

mysql> delimiter //
mysql> create trigger aa before insert on y for each row 
    -> begin    
    ->      declare v int;   
 
    ->      select count(*) into v from x where
id = new.id;
    ->      if v = 0
then       
    ->        
leave;    
    ->      end if;     
    -> end//
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
';    end if;     end' at line 1

Appreciatte any help on this.

Thanks in advance,

Eber.


      Novos endereços, o Yahoo! que você conhece. Crie um email novo com a
sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses
Thread
Problem related to triggerEber Duarte29 Jul
  • Re: Problem related to triggerAugusto Bott21 Aug