Under MySQL 3.23.40/Win32 and 3.23.33/Linux, neither mysql.user.user nor
mysql.user.password are permitted to have NULL values:

mysql> insert into mysql.user set user=NULL,password=NULL;
ERROR 1048: Column 'User' cannot be null

However, the default 'guest' user has NULLs for both of these values. In
addition, GRANT can create NULL values for passwords (and possibly users).

This causes an interesting problem using certain select queries, notably
this one and similiar variants:

SELECT user FROM mysql.user WHERE user IS NOT NULL

will return all of the users, even the NULL values.

I believe this is caused by the optimizer happily taking the "user IS NOT
NULL" part out of the query, because it sees that the user column doesn't
support NULL, and thus obviously everything will be NOT NULL.



- Daniel Grace - [EMAIL PROTECTED]
  http://dewin.oldbattery.com/ and http://dewin.venura.net/


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to