Bug #25789 Script editor for function uses DEFINER when shouldn't
Submitted: 23 Jan 2007 16:02 Modified: 30 Jan 2007 15:56
Reporter: Sebastien Caisse Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.0.20 OS:Windows (Windows XP Pro, sp2)
Assigned to: CPU Architecture:Any

[23 Jan 2007 16:02] Sebastien Caisse
Description:
When viewing a FUNCTION by openning it by double-clicking the function in the Schemata tab, the new default behavior is to include the DEFINER=`root`@`127.0.0.1` option on the CREATE line.

I would guess this should be fine - though I did not find the DEFINER clause in the documentation, and it doesn't work with my setup. If I run this statement as-is, it will run the DELETE statement and faile the create, leaving me rather stressed that the computer doesn't crash (you know windows...) before I fix that (Yes I do have a backup of statement, but still this leaves me worried...)

How to repeat:
Create a test FUNCTION:

DELIMITER $$
CREATE FUNCTION test() RETURNS INT(1)
BEGIN
  RETURN 1;
END $$
DELIMITER ;

Right click on create FUNCTION,
Select "Edit Function"
(notice DEFINER=`user`@`host` comment)

Execute - in my case the test FUNCTION has dissapeared with the error 1064:

You have an error in your SQL syntax; check the manual that correspongs to your MySQL server version fot the right syntax to user near '$$

DELIMITER' at line 4

Suggested fix:
??
[26 Jan 2007 15:40] Valeriy Kravchuk
What exact version of MySQL server do you use? 

Read the manual, http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html, about DEFINER clause. I was added in 5.0.20.
[26 Jan 2007 20:16] Sebastien Caisse
5.0.27
[30 Jan 2007 10:04] Sveta Smirnova
Please provide the CREATE FUNCTION statement you see after click "Edit Function".

Also indicate user you use to connect via MySQL Query Browser.
[30 Jan 2007 15:55] Sebastien Caisse
After some fiddling with my files I noticed 1.1.2 was still installed and the Tray monitor was of that version and as such started the old versions of the query browser. I tried it and it works fine in the real r9 (and this explains why I didn't see the r9 in the version where I thought it simply wasn't displayed...)
[30 Jan 2007 15:56] Sebastien Caisse
Oh and sorry for the trouble :(