federated tables structure not replicable

Giuseppe Maxia <[email protected]> Thu, 29 Sep 2005 17:32:10 +0200
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
federated tables structure not replicable

 >Description:
         In MySQL 5.0.13 a change for federated tables was made,
         to move the connection string from COMMENT to CONNECTION.
         While this works, federated tables now can not be backed up
         since "SHOW CREATE TABLE" does not include the CONNECTION
         string.

 >How-To-Repeat:
         try using the output of
         SHOW CREATE TABLE federated_table_name \G
         to create a new table.
         Or try this:
         $ mysqldump --no-data -h host1 database_name federated_table_name | \
                 mysql -h host2 database_name

 >Fix:
         No direct workaround.
         When creating a federated table, add a COMMENT with the connection string,
         and then you can do something like

         $ mysqldump --no-data -h host1 database_name federated_table_name | \
                 perl -pe 's/\bCOMMENT\s*=\b/CONNECTION=/' | \
                 mysql -h host2 database_name

Notice that, if you have enough privileges to access the .frm file, you can get the
connection string with a regexp:
$ perl -lne 'print $1 if m{(mysql://[^/]+\@[^/]+/[^/]+/\w+)}' /datadir/dbname/fed_table.frm
mysql://user:[email protected]:3306/r_db/r_table

regards

GM

-- 
Giuseppe Maxia
CTO http://www.StarData.it
MySQL Certified Professional

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]