Bug #25727 The error message raise from trigger were print on terminal/console.
Submitted: 19 Jan 2007 22:42 Modified: 20 Jan 2007 19:07
Reporter: Tim Xu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Errors Severity:S2 (Serious)
Version:5.0.24a OS:
Assigned to: CPU Architecture:Any
Tags: error message; console

[19 Jan 2007 22:42] Tim Xu
Description:
I have a before insert trigger installed on a table, it will check the insert record. There's a unique index on the table, if the trigger found there's two record with the same unique wanna insert into the table. it will insert the new record into another table, and let the unique key bounce back the record on current table. 

It works great except one thing, every time a duplicate record trying to insert, mysql will report an error "ERROR 1062 (23000) at line 8: Duplicate entry... ", it not in the log but was output to the terminal directly. I can not find a way to supress it.

Thanks.

How to repeat:
1.Create a table  with a unique key. 
2.Create a before insert trigger but doing nothing.
3.try to insert two same record into mysql using any program.
4.You will see the error message show up on console.
[20 Jan 2007 18:15] Sveta Smirnova
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

Please read how to suppress error output at http://dev.mysql.com/doc/refman/5.0/en/declare-handlers.html
[20 Jan 2007 19:07] Tim Xu
Hello Support Team,

I am pretty sure it should not be the way the system works.

Let me rephrase it .

How to reproduce the bug:

1. Create a table with a unique key index.
2. Try to insert duplicate record using a program at background.
3. login in mysql and you will see the error message popup when you try to insert the duplicate records.
4. After you see the error message popup. logout mysql and back to normal terminal. You will still can see the error message popup on the terminal.
5. The most interesting part: if you open a terminal but don't login mysql, you will never see those messages popup.
[20 Jan 2007 19:43] Sveta Smirnova
Thank you for the feedback, but I was unable to repeat described behaviour using following PHP script:

<?php
/* 
test database

mysql> create database bug25727;
Query OK, 1 row affected (0.00 sec)

mysql> use bug25727;
Database changed

mysql> create table t1(id int unique);
Query OK, 0 rows affected (0.08 sec)

mysql> insert into t1 values(1);
Query OK, 1 row affected (0.01 sec)

mysql> CREATE TRIGGER t1_bi BEFORE INSERT ON t1
    -> FOR EACH ROW SET @sum = 1;
Query OK, 0 rows affected (0.26 sec)

*/

$link=mysql_connect("localhost:/tmp/mysql50.sock","root","") or die("can't connect");
mysql_select_db('bug25727',$link) or print mysql_error($link);

for ($i = 1; $i < 150000; $i ++)
        mysql_query('INSERT INTO t1 values(3)');

?>