Bug #16777 Can not create trigger nor view w/o definer if --skip-grant-tables specified
Submitted: 25 Jan 2006 12:52 Modified: 10 Mar 2006 18:25
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.18/5.0.19 BK OS:Linux (Linux)
Assigned to: Alexander Nozdrin CPU Architecture:Any

[25 Jan 2006 12:52] Alexander Nozdrin
Description:
It's impossible to create a trigger or a view without explicitly
specifying DEFINER-clause if the server is running with
--skip-grant-tables option.

How to repeat:
1. Start the server with --skip-grant-tables (./mysqld --skip-grant-tables)
2. Check with mysql client:

mysql> create trigger trg1 before insert on t1 for each row set @a = 1;
ERROR 1446 (HY000): Definer is not fully qualified

mysql> create view v1 as select * from t1;
ERROR 1446 (HY000): Definer is not fully qualified

mysql> create definer=a@b trigger trg1 before insert on t1 for each row set @a = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> create definer=a@b view v1 as select * from t1;
Query OK, 0 rows affected (0.01 sec)

Suggested fix:
The problem seems to be in sql_parse.cc::get_default_definer() function.
When server is running with --skip-grant-tables privilege host is NULL and
this function treats this as an error.
[7 Mar 2006 19:38] Alexander Nozdrin
Pushed into 5.0 tree, currently tagged 5.0.20.
[9 Mar 2006 20:44] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3663
[9 Mar 2006 21:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3672
[9 Mar 2006 21:29] Alexander Nozdrin
The bug was not fixed completely; a new part of the patch is pending.
[10 Mar 2006 11:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3696
[10 Mar 2006 11:40] Alexander Nozdrin
Approved by email with minor changes.
[10 Mar 2006 11:41] Alexander Nozdrin
Pushed into 5.0, currently tagged 5.0.20.
[10 Mar 2006 12:09] Alexander Nozdrin
Merged into 5.1, currently taggesd 5.1.8-beta.
[10 Mar 2006 18:25] Paul Dubois
Noted in 5.0.20, 5.1.8 changelogs.

If the server was started with the
<option>--skip-grant-tables</option> option, it was impossible
to create a trigger or a view without explicitly specifying a 
<literal>DEFINER</literal> clause. (Bug #16777)