in older version of 5.0: --------------------------- drop table if exists t1; create table t1(id int); delimiter // CREATE TRIGGER Name_trigger BEFORE INSERT ON t1 FOR EACH ROW begin DECLARE temp INTEGER; select max(id)+1 into temp from t1 union select 1 from t1 LIMIT 1; SET NEW.id = temp; end// delimiter ; in 5.0.42 with datadir pointing to old version ------------- select * from information_schema.triggers; stack trace: mysqld-debug.exe!Protocol::send_fields(List * list=0x02849c68, unsigned int flags=0x00000005) Line 580 + 0x11 bytes C++ mysqld-debug.exe!select_send::send_fields(List & list={...}, unsigned int flags=0x00000005) Line 961 + 0x2b bytes C++ mysqld-debug.exe!JOIN::exec() Line 2063 + 0x58 bytes C++ mysqld-debug.exe!mysql_select(THD * thd=0x02848c88, Item * * * rref_pointer_array=0x02849cf8, st_table_list * tables=0x028523c8, unsigned int wild_num=0x00000001, List & fields={...}, Item * conds=0x00000000, unsigned int og_num=0x00000000, st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000, st_order * proc_param=0x00000000, unsigned __int64 select_options=0x00000000a0844a00, select_result * result=0x02853340, st_select_lex_unit * unit=0x02849948, st_select_lex * select_lex=0x02849bc8) Line 2233 C++ mysqld-debug.exe!handle_select(THD * thd=0x02848c88, st_lex * lex=0x028498e8, select_result * result=0x02853340, unsigned long setup_tables_done_option=0x00000000) Line 255 + 0x9f bytes C++ mysqld-debug.exe!mysql_execute_command(THD * thd=0x02848c88) Line 2657 + 0x13 bytes C++ mysqld-debug.exe!mysql_parse(THD * thd=0x02848c88, const char * inBuf=0x02852270, unsigned int length=0x00000029, const char * * found_semicolon=0x04c7fd70) Line 6055 + 0x9 bytes C++ mysqld-debug.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x02848c88, char * packet=0x0284a1c1, unsigned int packet_length=0x0000002a) Line 1805 + 0x1e bytes C++ mysqld-debug.exe!do_command(THD * thd=0x02848c88) Line 1582 + 0x31 bytes C++ mysqld-debug.exe!handle_one_connection(void * arg=0x02848c88) Line 1193 + 0x9 bytes C++ mysqld-debug.exe!pthread_start(void * param=0x02824338) Line 62 + 0x7 bytes C mysqld-debug.exe!_callthreadstart() Line 293 + 0xf bytes C mysqld-debug.exe!_threadstart(void * ptd=0x0283d630) Line 277 C