#3125 All views in server are shown for every database

1.410
closed-fixed
Jamie Cameron
5
2008-05-20
2008-05-20
Linda Howard
No

When a MySQL server has multiple databases, and there are views defined in one or more databases, those views are displayed in the table list for *every* database (as opposed to just the relevant one). This can be fixed by editing the function list_views which is found in /usr/share/webmin/mysql/mysql-lib.pl :

# list_views(db)
# Returns the names of all views in some database
sub list_views
{
local ($db) = @_;
local @rv;
# *** FIX - next line has WHERE clause added to it ***
local $d = &execute_sql($db, "select table_schema,table_name from information_schema.views where table_schema='$db';");
foreach $r (@{$d->{'data'}}) {
push(@rv, $r->[1]);
}
return @rv;
}

Simply adding "where table_schema='$db'" fixes the problem. This occurs in version 1.410, as well as previous versions.

Thanks,
Linda

Discussion

  • Jamie Cameron
    Jamie Cameron
    2008-05-20

    • status: open --> closed-fixed
     
  • Jamie Cameron
    Jamie Cameron
    2008-05-20

    Logged In: YES
    user_id=129364
    Originator: NO

    Doh! That's a pretty stupid bug on my part .. thanks for the fix. It will go into the upcoming 1.420 Webmin release.

     
  • Linda Howard
    Linda Howard
    2008-05-28

    Logged In: YES
    user_id=2092955
    Originator: YES

    Thanks, just tried 1.420 and it works great now!