List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:November 10 1999 4:45pm
Subject:Re: possible bug in left joins (3.2.27)
View as plain text  
>>>>> "Patrick" == Patrick Michael Kane <modus@stripped> writes:

Patrick> Thanks for the patch.  Unfortunately there are still problems with left
Patrick> joins and count.  Try this:

<cut>

Patrick> select a.id, count(rtg_importance) from a
Patrick> left join b on a.id = b.cmt_id group by a.id;

Patrick> returns:

Patrick> +----+-----------------------+
Patrick> | id | count(rtg_importance) |
Patrick> +----+-----------------------+
Patrick> |  1 |                     1 |
Patrick> +----+-----------------------+
Patrick> 1 row in set (0.01 sec)

Patrick> Which is clearly incorrect, since the situation is identical to above.

Patrick> I have not been able to figure out what about the structure of table 'b' is
Patrick> making this fail.  I have run the tests against 3.23 and 3.22 + enclosed
> patch
Patrick> and get the same results.

Hi!

The above bug manifests when you do a count(*) on a left join on a
column that may have null values but is declared NOT NULL.

Here is a patch for this to MySQL 3.22



Regards,
Monty

Thread
possible bug in left joins (3.2.27)Patrick Michael Kane3 Nov
  • Re: possible bug in left joins (3.2.27)sinisa4 Nov
    • Re: possible bug in left joins (3.2.27)Bob Kline4 Nov
      • Re: possible bug in left joins (3.2.27)Patrick Michael Kane4 Nov
      • Re: possible bug in left joins (3.2.27)sinisa4 Nov
    • Re: possible bug in left joins (3.2.27)Patrick Michael Kane4 Nov
  • possible bug in left joins (3.2.27)Michael Widenius10 Nov
    • Re: possible bug in left joins (3.2.27)Patrick Michael Kane10 Nov
      • Re: possible bug in left joins (3.2.27)Michael Widenius10 Nov
Re: possible bug in left joins (3.2.27)sinisa4 Nov