Tobias Dittrich wrote : 
>
>Hi,
>
>I have seen this question asked before on this list, but 
>unfortunately the answer deviated a bit from the original 
>question - or maybe I just did not understand the answer 
>good enough, this is the first time I try with triggers and 
>such.
>
>I want to do something like copy the behaviour of the mysql 
>TIMESTAMP. That is: the timestamp column holds the date 
>(and time) of the last modification of the corresponding 
>data row. As I understand for INSERT this can be achieved 
>by setting the default column value to TIMESTAMP. 
>
>For UPDATE the simple aproach: 
>CREATE TRIGGER TEST_TIMESTAMP FOR TEST AFTER UPDATE EXECUTE 
>( 
>UPDATE USER.TEST SET DATUM=TIMESTAMP WHERE TEST.ID=:NEW.ID; 
>)
>does not work. This causes the db kernel to crash every time 
>I execute an update on the table - presumably because of an 
>endless recursion of the trigger?
>
>But what would be the right aproach to this problem?
>
>Many thanks in advance
>
>Tobias Dittrich
>
>
>-- 
>MaxDB Discussion Mailing List
>For list archives: http://lists.mysql.com/maxdb
>To unsubscribe:    
>http://lists.mysql.com/maxdb?>[EMAIL PROTECTED]
>

Your solution definitely codes an endless recursion, which causes
an stack overflow which crashes the kernel.
To avoid the endless recursion please add the ignore trigger option
to your update statement :

UPDATE USER.TEST SET DATUM=TIMESTAMP WHERE TEST.ID=:NEW.ID IGNORE TRIGGER;

Best Regards,
Thomas

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to