Paul DuBois wrote:
At 15:46 +0100 12/23/03, Plinio Conti wrote:
Sorry, I was not using any SELECT in my queries, it's just an error typing the email
I confirm: SHOW GRANTS FOR CURRENT_USER(); does not work, while that query is exactly what you expect to do reading mysql manual.
I agree, one might easily come to that conclusion based on the wording.
The manual was imprecise/wrong. I've changed it to point out that you must first select the value of CURRENT_USER(), then use the value it returns in the SHOW GRANTS statement.
From the manual, "To list grants for the current session, you can find out what user the session was authenticated as by selecting the value of the CURRENT_USER() function (new in version 4.0.6). Then use that value in the SHOW GRANTS statement."
I assume that's the reworked version. I don't think that's sufficient. Though it does not suggest "SHOW GRANTS FOR CURRENT_USER()", it doesn't say it won't work. Even then, if you are familiar with mysql user variables, surely "get a value in one statement then use it in the next" implies a user variable, but
SET @u = CURRENT_USER(); SHOW GRANTS FOR @u;
doesn't work, either. As I see it, "use that value" here really means copy/paste, or assign it to a variable in your external client program. There does not appear to be any way *within mysql* to pass the result of CURRENT_USER() to SHOW GRANTS. I assume this is because the processing of SHOW GRANTS FOR simply does not consider the possibility that what comes next might be a variable or function, as SELECT does, for example.
Now that we've determined that's the way it works, isn't "Should it work that way?" the next logical question? After all, CURRENT_USER() returns [EMAIL PROTECTED], while SHOW GRANTS FOR expects [EMAIL PROTECTED] Intuitively, SHOW GRANTS FOR CURRENT_USER() should work. But it doesn't. Shouldn't that be considered a bug, or at least a missing feature? Admittedly, I haven't yet looked at that portion of the code, so I don't know how easy or difficult this would be to change.
Michael
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]