Commit 90004e34 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fixed bug in LEFT JOIN

parent 4b513347
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -46784,6 +46784,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code.
@menu
* News-3.23.47::                
* News-3.23.46::                Changes in release 3.23.46
* News-3.23.45::                Changes in release 3.23.45
* News-3.23.44::                Changes in release 3.23.44
@@ -46834,7 +46835,13 @@ not yet 100% confident in this code.
* News-3.23.0::                 Changes in release 3.23.0
@end menu
@node News-3.23.46, News-3.23.45, News-3.23.x, News-3.23.x
@node News-3.23.47, News-3.23.46, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.46
@itemize @bullet
Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}.
@end itemize
@node News-3.23.46, News-3.23.45, News-3.23.47, News-3.23.x
@appendixsubsec Changes in release 3.23.46
@itemize @bullet
@item
+3 −4
Original line number Diff line number Diff line
@@ -303,7 +303,6 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
  {
    if (!share->r_locks && !share->w_locks)
    {
      if ((info->tmp_lock_type=lock_type) != F_RDLCK)
      if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
		  info->lock_wait | MY_SEEK_NOT_DONE))
	DBUG_RETURN(1);
+11 −0
Original line number Diff line number Diff line
@@ -320,3 +320,14 @@ id name id idx
2	no	NULL	NULL
bug_id	reporter	bug_id	who
1	1	1	2
table	type	possible_keys	key	key_len	ref	rows	Extra
t2	index	NULL	PRIMARY	4	NULL	3	Using index
t1	eq_ref	PRIMARY	PRIMARY	2	const	1	where used; Using index
fooID	barID	fooID
10	1	NULL
20	2	NULL
30	3	30
fooID	barID	fooID
10	1	NULL
20	2	NULL
30	3	30
+12 −0
Original line number Diff line number Diff line
@@ -404,3 +404,15 @@ insert into t2 values (1,1),(1,2);
insert into t1 values (1,1),(2,1);
SELECT * FROM t1 LEFT JOIN t2 ON (t1.bug_id =  t2.bug_id AND  t2.who = 2) WHERE  (t1.reporter = 2 OR t2.who = 2);
drop table t1,t2;

#
# Test problem with LEFT JOIN

create table t1 (fooID smallint unsigned auto_increment, primary key (fooID));
create table t2 (fooID smallint unsigned not null, barID smallint unsigned not null, primary key (fooID,barID));
insert into t1 (fooID) values (10),(20),(30);
insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
select * from t2 left join t1 ignore index(primary) on t1.fooID = t2.fooID and t1.fooID = 30;
drop table t1,t2;
+1 −1
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ void my_end(int infoflag)
      DBUG_PRINT("error",("%s",errbuff[0]));
    }
  }
  free_charsets();
  if (infoflag & MY_GIVE_INFO || info_file != stderr)
  {
#ifdef HAVE_GETRUSAGE
@@ -150,7 +151,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
#if defined(MSDOS) && !defined(__WIN__)
    fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
#endif
    free_charsets();
#if defined(SAFEMALLOC)
    TERMINATE(stderr);		/* Give statistic on screen */
#elif defined(__WIN__) && defined(_MSC_VER)
Loading