Bug #64656 mysqldbcopy fails to copy some views
Submitted: 15 Mar 2012 10:26 Modified: 11 Jun 2013 20:33
Reporter: hugo pires Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S3 (Non-critical)
Version:5.2.38 CE OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqldbcopy, Views

[15 Mar 2012 10:26] hugo pires
Description:
mysqldbcopy fails, if there is no space before the database name in fields selection in views.

How to repeat:
CREATE VIEW `db_test`.`test_view` AS 
SELECT `db_test`.`tb_test`.`field1`,`db_test`.`tb_test`.`field2` 
FROM `db_test`.`tb_test`

In the select, the first database name will be replaced, but the next ones will not.

Suggested fix:
After searching in the sources, i find that the problem is in "utitilies/common/database.py" in the function __make_create_statement. 
A solution for this is to add more substitutions with comma instead of space before the database name.
[15 Mar 2012 10:58] hugo pires
Found one more problem: opening parenthesis before the database name
[15 Mar 2012 11:32] Valeriy Kravchuk
Thank you for the bug report. Verified on Windows XP:

C:\Program Files\MySQL\MySQL Workbench 5.2 CE\utilities>mysqldbcopy --source=roo
t:root@localhost:3312 --destination=root:root@localhost:3312 db_test:db_test2
# Source on localhost: ... connected.
# Destination on localhost: ... connected.
# Copying database db_test renamed as db_test2
# Copying TABLE db_test.tb_test
# Copying table data.
# Copying VIEW db_test.v1
ERROR: Cannot operate on VIEW object. Error: Query failed. 1054: Unknown column
'db_test.tb_test.c2' in 'field list'
[11 Jun 2013 20:33] Chuck Bell
Fixed in release-1.2.3
[12 Jun 2013 6:42] Philip Olson
Fixed as of the upcoming MySQL Utilities 1.2.3 release, and here's the changelog entry:

"mysqldcopy" was failing to copy views if there was not a space before the
database name for the selected fields. Support for spaces and parentheses
before the database name was added.

Thank you for the bug report.