by Nikolaos Papaspyrou.
First of all, to select the lines that you wanted, the right SQL query is:
SELECT id FROM mdl_user WHERE picture IS NULL;
I had the same problem when upgrading from 2.2 to 2.3, but I think this was due to the fact that my moodle database is really old (from 1.2, if I remember right). I solved it with:
UPDATE mdl_user
SET picture = 0
WHERE picture IS NULL;