• unknown's avatar
    Fix for BUG#16777: Can not create trigger nor view w/o definer · fad27ebf
    unknown authored
    if --skip-grant-tables specified.
    
    The problem is that there is a check that prevents creating a definer
    with empty host name.
    
    In --skip-grant-tables mode this check prevents the user from creating a
    trigger/view without explicitly specifying its definer. This happens, because
    in --skip-grant-tables mode CURRENT_USER is ''@''. According to Sanja this
    check was implemented intentionally.
    
    However, according to the MySQL manual it is possible to specify empty host
    name (as well as empty user name). Moreover, the behaviour for stored routines
    is different in this aspect -- we allow them to be created with implicit
    definer.
    
    Based on this, we believe it is OK to change the behaviour for views to be
    similar with the behaviour for stored routines.
    
    
    mysql-test/r/skip_grants.result:
      Added a test case for BUG#16777.
    mysql-test/t/skip_grants.test:
      Added a test case for BUG#16777.
    sql/mysql_priv.h:
      Do not check that strlen(host) > 0 in get_default_definer().
    sql/sql_parse.cc:
      Do not check that strlen(host) > 0 in get_default_definer().
    sql/sql_view.cc:
      Do not check that strlen(host) > 0 in get_default_definer().
    fad27ebf
sql_view.cc 46.7 KB