Hi!

>>>>> "Sinisa" == Sinisa Milivojevic <[EMAIL PROTECTED]> writes:

Sinisa> John Heitmann writes:
>> Thanks for the quick response.
>> 
>> > > select t1.*, t2.name from t1, t2 where t2.id=t2_id;
>> > 
>> > The above is actually expected behaviour, as you are not doing a join
>> > at all, but a full Cartesian product.
>> 
>> That t2_id is actually from t1. Sorry for the confusing naming. Here
>> is a more verbose, but identical statement:
>> 
>> select t1.*, t2.name from t1, t2 where t2.id=t1.t2_id;
>> 
>> Since there is a join condition that works across both tables is this
>> still considered a cartesian product? I did a quick sanity check and
>> the number of rows returned from the problem statement equals the number
>> of rows in t1, rather than t1*t2. Even if it was, I don't see why
>> there is indeterminism in the return values for columns in the result of
>> a cartesian product.
>> 
>> Thanks,
>> 
>> John
>> 

Sinisa> You are right !

Sinisa> This definitely looks like a bug and we shall investigate it further.

The bug was in a combination of doing a join without keys and having
many NULL fields.

Here is now a patch for this (will be in 3.23.49 and MySQL 4.0.2).

===== sql/sql_select.cc 1.116 vs edited =====
*** /tmp/sql_select.cc-1.116-31284      Fri Jan 18 00:43:50 2002
--- edited/sql/sql_select.cc    Sun Feb 10 12:32:59 2002
***************
*** 5701,5707 ****
      if (null_fields && tables[i].table->null_fields)
      {                                         /* must copy null bits */
        copy->str=(char*) tables[i].table->null_flags;
!       copy->length=(tables[i].table->null_fields+7)/8;
        copy->strip=0;
        copy->blob_field=0;
        length+=copy->length;
--- 5701,5707 ----
      if (null_fields && tables[i].table->null_fields)
      {                                         /* must copy null bits */
        copy->str=(char*) tables[i].table->null_flags;
!       copy->length=tables[i].table->null_bytes;
        copy->strip=0;
        copy->blob_field=0;
        length+=copy->length;


Regards,
Monty

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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