Fix for BUG#30027: mysqldump does not dump views properly.
mysqldump generates view defitions in two stages: - dump CREATE TABLE statements for the temporary tables. For each view a temporary table, that has the same structure as the view is created. - dump DROP TABLE statements for the temporary tables and CREATE VIEW statements for the view. This approach is required because views can have dependencies on each other (a view can use other views). So, they should be created in the particular order. mysqldump however is not smart enough, so in order to resolve dependencies it creates temporary tables first of all. The problem was that mysqldump might have generated incorrect dump for the temporary table when a view has non-ASCII column name. That happened when default-character-set is not utf8. The fix is to: 1. Switch character_set_client for the mysqldump's connection to binary before issuing SHOW FIELDS statement in order to avoid conversion. 2. Dump switch character_set_client statements to UTF8 and back for CREATE TABLE statement that is issued to create temporary table. client/mysqldump.c: 1. Switch character_set_results for mysqldump's connection to binary before SHOW FIELDS in order to avoid conversion to client character set. 2. Dump switch character_set_client statements to UTF8 and back for CREATE TABLE statement. mysql-test/r/mysqldump.result: Update result file. mysql-test/t/mysqldump.test: Test case for BUG#30027.
Showing
Please register or sign in to comment