Bug #45642 Generated INSERT statements don't have database name
Submitted: 21 Jun 2009 20:35 Modified: 25 Jun 2009 16:16
Reporter: Mark M Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.1.14RC OS:Any
Assigned to: Alexander Musienko CPU Architecture:Any
Tags: insert

[21 Jun 2009 20:35] Mark M
Description:
The generated INSERT statements are at the end of the SQL output.  There is not a 'USE database' statement before a group of inserts -- interesting enough the comment before the group of INSERTS mentions the database.table.  If you have multiple databases, this will generate errors on import.  For example: you have Databases A and B.  Database A has tables W and X and B has tables Y and Z.  You have inserts for W and X so the schema defines A.W, A.X, B.Y and B.Z in that order.  The "current" database in in use is now B, the inserts do not have a fully qualified path or have a USE database command preceding it.  So the INSERT looks like: "INSERT INTO `W` (foo, bar) values('abc','def')", etc.  Since it wasn't INSERT INTO  `A.W`, or a USE A; preceding it, the import process will assume that database is B and database B doesn't have a W table. 

How to repeat:
Have multiple databases and have INSERT statements for some of the different tables and generate INSERT statements on the output.
[22 Jun 2009 7:18] Valeriy Kravchuk
Thank you for the bug report. Verified just as described on Windows.
[24 Jun 2009 17:34] Johannes Taxacher
a "use `schemaname`" is now inserted preceding the insert-statments.
will be included in 5.1.15
[25 Jun 2009 16:16] Tony Bedford
An entry was added to the 5.1.15 changelog:

Generated INSERT statements did not have a database name.

The generated INSERT statements were at the end of the SQL output. However, there was no USE database statement before the group of inserts. The comment before the group of INSERTS did refer to the database table.

If you had multiple databases, this generated errors on import.