Bug #19188 incorrect temporary table name of DROP query in replication
Submitted: 19 Apr 2006 9:39 Modified: 18 Aug 2006 13:34
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:4.1.19, 5.0.21, 5.1. OS:Linux (FC3, others)
Assigned to: Andrei Elkin CPU Architecture:Any

[19 Apr 2006 9:39] Andrei Elkin
Description:
Considering #17263 Serg noted in dev-bugs@ that
a pattern existing in close_temporary_tables is buggy
>     {
>       /*
>         We are going to add 4 ` around the db/table names, so 1 might not look
>         enough; indeed it is enough, because table->key_length is greater (by 8,
>         because of server_id and thread_id) than db||table.
>      */

> This was a bug in the old code (a very typical one - I saw it _many_
> times), don't repeat it in your patch. You cannot "add 4 `", you have to
> use append_identifier() function. Otherwise a table name with ` in it
> will break replication:

  mysql> create temporary table `t``1` (a int);
  Query OK, 0 rows affected (0.08 sec)
  mysql> ^D
  % client/mysqlbinlog ~/Abk/binaries/var/*1
  ...
  SET @@session.pseudo_thread_id=1;
  create temporary table `t``1` (a int);
  ...
  SET @@session.pseudo_thread_id=1;
  DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t`1`;

I file this as separate bug since the issue of #17263 relates to pseudo_thread_id feature.

How to repeat:
mysql -e create temporary table `t``1` (a int);
mysqlbinlog binlog | grep DROP
=> DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t`1`;

Suggested fix:
> use append_identifier() function.
[27 Apr 2006 20:11] 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/5657
[27 Apr 2006 20:43] 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/5660
[9 May 2006 7:11] 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/6134
[12 May 2006 19:06] 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/6316
[14 May 2006 17:31] 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/6360
[29 May 2006 15:02] 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/6981
[16 Aug 2006 11:07] Andrei Elkin
Fixed in 4.1.20, 5.0.22, 5.1.12
[18 Aug 2006 13:34] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 4.1.20, 5.0.22, and 5.1.12 changelogs.