Reputation: 25
I apologize in advance for my English, I have updated both mysql (5.7.30) and Phpmyadmin (5.0.2). It happens that when copying a database with a different name, the views in the clause where you are adding something like databasename.tablename, in previous versions did not someone know why this happens?
In the previous version when cloning a database (Enterprise) with a different name (NewEnterprise) the views kept their original structure, example:
CREATE VIEW customerPayments AS select ID, FIRST_NAME, LAST_NAME from customer;
In the current version, when it is cloned, the structures change, being in the new database, the views refer to the previous example:
CREATE VIEW customerPayments AS select ID, FIRST_NAME, LAST_NAME from Enterprise.custome
Where should something like
CREATE VIEW customerPayments AS select ID, FIRST_NAME, LAST_NAME from NewEnterprise.custome
Or as it happened that left it without the alias of the database. I hope I have made myself understood, otherwise please let me know and I will try to expand the information
Upvotes: 0
Views: 87
Reputation: 12422
This is really a side-effect of how MySQL handles views — they are strictly defined with the database, table, and column names all needing to be explicitly referenced in the view (for instance, a view of SELECT * FROM `bar`;
gets interpreted and stored as SELECT `id`, `name` FROM `foo`.`bar`;
. So even though you may not have explicitly set the database name or even column names in the view, that's how MySQL stores them.
When copying a database, phpMyAdmin should do the helpful thing and ask you to adjust these; it doesn't right now. I've added a feature request at https://github.com/phpmyadmin/phpmyadmin/issues/16214 to add that functionality.
Upvotes: 1