Bug #30679 5.1 name encoding not performed for views during upgrade
Submitted: 28 Aug 2007 20:59 Modified: 9 Apr 2008 14:53
Reporter: Omer Barnir (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.1.21 OS:Any
Assigned to: Ramil Kalimullin CPU Architecture:Any

[28 Aug 2007 20:59] Omer Barnir
Description:
The 5.1 server introduces new encoding for table names that have non ascii characters in them.

When a live upgrade is performed from 5.0 to 5.1 the 5.1 server recognizes the table names that have non ascii characters in them and adds a #mysql50# prefix to them. This is done for table and view names alike.

Then when the mysqlcheck is executed (as part of running mysql_upgrade), it converts the name encoding to the 5.1 format and removes the #mysql50# prefix.

The problem is that the mysqlcheck operation is performed oonly on tables and skips views. As a result vies with non-ascii characters are unconverted and with the #mysql50# prefix.

This leads to breaking of applicationssince the calls to views using the original names fail

How to repeat:
1) Start a 5.0 server.
2) using the client:
   USE test;
   CREATE TABLE tab_ü (i int);
   CREATE VIEW view_ü AS SELECT * from  tab_ü;
Note: If you can't see 'ü' in your client, start it with the 
      --default-character-set=utf8 option.
3) Stop the 5.0 system and start a 5.1 one
4) Using the client:
   USE test;
   SHOW TABLES;
   >> both the table and the view will appear with the #mysql50# prefix
5) From the command line execute mysqlcheck:
   mysqlcheck --check-upgrade --fix-db-names --fix-table-names \
   --socket=<location of socket file> --user=root
6) From the client execte SHOW TABLES again.
   >> The table will apear with the original name but the view still has
      the #mysql50# prefix

Suggested fix:
Have the encoding name conversion run on view as well
[13 Sep 2007 0:31] Paul DuBois
Issue has been noted under "Server Changes" at:

http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html
[24 Oct 2007 17:37] 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/36292

ChangeSet@1.2597, 2007-10-24 22:36:57+05:00, ramil@mysql.com +3 -0
  Fix for bug #30679: 5.1 name encoding not performed for views during upgrade
  
  Problem: we skip views perfoming --fix-table-names.
  
  Fix: rename views as well.
[30 Oct 2007 10:24] Alexander Barkov
Ok to push
[7 Dec 2007 23:08] Bugs System
Pushed into 6.0.5-alpha
[7 Dec 2007 23:09] Bugs System
Pushed into 5.1.23-rc
[20 Dec 2007 1:14] Paul DuBois
Noted in 5.1.23, 6.0.5 changelogs.

mysqlcheck --fix-table-names did not perform name re-encoding for
views. Now it does.

Also updated the mysqlcheck and upgrading-to-5.1 sections.