Bug #61112 | Unqualified table names are changed silently | ||
---|---|---|---|
Submitted: | 10 May 2011 7:31 | Modified: | 10 May 2011 13:01 |
Reporter: | Daniel Jaenecke | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Views | Severity: | S3 (Non-critical) |
Version: | 5.1.55 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[10 May 2011 7:31]
Daniel Jaenecke
[10 May 2011 10:10]
Valeriy Kravchuk
I agree about "store the original VIEW definition" part of your suggestion (but we have a feature request for that already (check bug #5159). As for not qualifying table name with schema name, this can lead to problems with permissions check. The exact definition of view will depend on "current database" then, and this may lead to security problems. See bug #23720 also. Any table reference should resolve to something specific before the view is accessed, in any case.
[10 May 2011 12:33]
Daniel Jaenecke
Regarding problems with permissions - this might be the true, but then again this is the case for any VIEW which does not refer to tables in other databases. MySQL will not replace table references when only "local" tables are used: USE db1; CREATE VIEW foo AS SELECT t1.* FROM table1 AS t1 JOIN table2 AS t2 SHOW CREATE VIEW foo; will result in something like CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `foo` AS select `t1`.`id` AS `id` from (`table_1` `t1` join `table_2` `t2`) *but* USE db2; SHOW CREATE VIEW db1.foo; will return the above definition, but with full qualified table names.
[10 May 2011 13:01]
Valeriy Kravchuk
OK, I agree that we have inconsistency here.