From: Claudio Nanni Date: July 5 2012 7:01pm Subject: Re: group_key? List-Archive: http://lists.mysql.com/mysql/227773 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec52be47fad812404c419c550 --bcaec52be47fad812404c419c550 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, you might have hit: http://bugs.mysql.com/bug.php?id=3D58081 Cheers Claudio 2012/7/5 Hal=E1sz S=E1ndor > Here is something queer: > > select ifnull(email, round(10000 * rand(), 1)) as ux, count(*) from nam > group by ux; > ERROR 1062 (23000): Duplicate entry '2514.0' for key 'group_key' > > I have a name-list, with e-mail address or not. I wanted to fill the NULL > e-mail addresses with something random, and, I hope, unique. (ROUND is > there only to make that surprising error liklier.) > > The field "email" is not UNIQUE, not a key, no intention of making it suc= h. > > Why this error? Is RAND called more than once for each record? > > I tryed also UUID, but that came with its own shortcoming: if the UUID > call were the whole field, it indeed was once called for every record, bu= t > if argument to IFNULL, only once for the whole query. > > Version 5.5.8 > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql > > --=20 Claudio --bcaec52be47fad812404c419c550--