Description:
Both SHOW CREATE VIEW and mysqldump prepend the name of the schema in which the view exists. This makes porting to a different schema difficult.
How to repeat:
14:51 root@localhost:(none)~> CREATE SCHEMA csc6198;
Query OK, 1 row affected (0.00 sec)
14:51 root@localhost:(none)~> USE csc6198
Database changed
14:51 root@localhost:csc6198~> CREATE TABLE t1(id INT NOT NULL);
Query OK, 0 rows affected (0.01 sec)
14:51 root@localhost:csc6198~> CREATE VIEW v1 AS SELECT * FROM t1;
Query OK, 0 rows affected (0.03 sec)
14:52 root@localhost:csc6198~> SHOW CREATE VIEW v1\G
*************************** 1. row ***************************
View: v1
Create View: CREATE ALGORITHM=UNDEFINED VIEW `csc6198`.`v1` AS select `csc6198`.`t1`.`id` AS `id` from `csc6198`.`t1`
1 row in set (0.00 sec)
Suggested fix:
Remove the schema name from in-front of the view.
Description: Both SHOW CREATE VIEW and mysqldump prepend the name of the schema in which the view exists. This makes porting to a different schema difficult. How to repeat: 14:51 root@localhost:(none)~> CREATE SCHEMA csc6198; Query OK, 1 row affected (0.00 sec) 14:51 root@localhost:(none)~> USE csc6198 Database changed 14:51 root@localhost:csc6198~> CREATE TABLE t1(id INT NOT NULL); Query OK, 0 rows affected (0.01 sec) 14:51 root@localhost:csc6198~> CREATE VIEW v1 AS SELECT * FROM t1; Query OK, 0 rows affected (0.03 sec) 14:52 root@localhost:csc6198~> SHOW CREATE VIEW v1\G *************************** 1. row *************************** View: v1 Create View: CREATE ALGORITHM=UNDEFINED VIEW `csc6198`.`v1` AS select `csc6198`.`t1`.`id` AS `id` from `csc6198`.`t1` 1 row in set (0.00 sec) Suggested fix: Remove the schema name from in-front of the view.