Bug #15103 SHOW TRIGGERS: small output alignment problem
Submitted: 21 Nov 2005 17:07 Modified: 20 Jan 2006 1:34
Reporter: Paul Dubois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0/5.0.17 BK OS:Linux (Linux)
Assigned to: Alexander Nozdrin CPU Architecture:Any

[21 Nov 2005 17:07] Paul Dubois
Description:
SHOW TRIGGERS output has a minor alignment problem.
There is extraneous leading whitespace in the Statement
column.

How to repeat:
Execute these statements:

DROP TABLE IF EXISTS account;
CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
CREATE TRIGGER ins_sum BEFORE INSERT ON account
FOR EACH ROW SET @sum = @sum + NEW.amount;
SHOW TRIGGERS\G

The resulting output looks like this:

*************************** 1. row ***************************
  Trigger: ins_sum
    Event: INSERT
    Table: account
Statement:  SET @sum = @sum + NEW.amount
   Timing: BEFORE
  Created: NULL
 sql_mode: 
  Definer: paul@localhost

Suggested fix:
I suppose the .TRG file parser should skip over
"FOR EACH ROW\s*" to find the trigger statement,
not just skip over "FOR EACH ROW".
[21 Nov 2005 17:16] Miguel Solorzano
miguel@hegel:~/dbs/5.0> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.17-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> DROP TABLE IF EXISTS account;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
Query OK, 0 rows affected (0.08 sec)

mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
    -> FOR EACH ROW SET @sum = @sum + NEW.amount;
Query OK, 0 rows affected (0.04 sec)

mysql> SHOW TRIGGERS\G
*************************** 1. row ***************************
  Trigger: ins_sum
    Event: INSERT
    Table: account
Statement:  SET @sum = @sum + NEW.amount
   Timing: BEFORE
  Created: NULL
 sql_mode: 
  Definer: root@localhost
1 row in set (0.02 sec)

mysql>
[23 Dec 2005 0:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/378
[11 Jan 2006 12:10] Alexander Nozdrin
Patch approved by email.
[13 Jan 2006 17:38] Alexander Nozdrin
Pushed into 5.0, currently tagged 5.0.18.
Merged into 5.1, currently tagged 5.1.5.
[20 Jan 2006 1:34] Paul Dubois
Noted in 5.0.18, 5.1.5 changelogs.

        <para>
          The output of <literal>SHOW TRIGGERS</literal> contained
          extraneous whitespace. (Bug #15103)
        </para>