I commented on bug 2876 but thought I would post this in the forum also in case I missed something.
When exporting an entire database, views in the new database point to tables in the original source. I do not get this behavior if I simply export a view directly. I am on version 9.1.0.1867
View export points to source
Confirmed. HeidiSQL creates a view with its body while "using" the source database. For example, you are exporting "dbsource" to "dbtarget", and HeidiSQL fired a "USE dbsource" before. Then, the export does the following:
That "sometable" is located in dbsource, not in dbtarget, and HeidiSQL still has "USEd" the dbsource database.
I guess this does not happen when you export to a sql file, then import that file in a new database?
CREATE VIEW `dbtarget`.`someview` AS SELECT * from sometable;
That "sometable" is located in dbsource, not in dbtarget, and HeidiSQL still has "USEd" the dbsource database.
I guess this does not happen when you export to a sql file, then import that file in a new database?
I'm not sure if I can fix that at all. I think I have to fire a "USE <targetdb>" before creating the view there, so the server references tables from the target database, not the source db. I have a gutt feeling I tried that before and introduced other bugs along with that fix, but I'll check that.
Please login to leave a reply, or register at first.