List:Commits« Previous MessageNext Message »
From:kgeorge Date:June 1 2006 9:35am
Subject:bk commit into 4.1 tree (gkodinov:1.2485) BUG#4981
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2485 06/06/01 10:35:40 gkodinov@stripped +3 -0
  Bug #4981: 4.x and 5.x produce non-optimal execution path, 
          3.23 regression test failure
  
  Fixed incorrect initialization of SEL_ARG class causing 
  never selecting the 'Range checked' access method (even if
  applicable).

  sql/opt_range.cc
    1.145 06/06/01 10:35:35 gkodinov@stripped +10 -3
    All of the class members initialized

  mysql-test/t/select.test
    1.55 06/06/01 10:35:35 gkodinov@stripped +406 -0
    testcase for 'Range checked' access method

  mysql-test/r/select.result
    1.72 06/06/01 10:35:35 gkodinov@stripped +412 -0
    testcase for 'Range checked' access method

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	rakia.(none)
# Root:	/home/kgeorge/mysql/4.1/B4981

--- 1.144/sql/opt_range.cc	2005-10-18 13:04:07 +03:00
+++ 1.145/sql/opt_range.cc	2006-06-01 10:35:35 +03:00
@@ -57,14 +57,21 @@
   enum leaf_color { BLACK,RED } color;
   enum Type { IMPOSSIBLE, MAYBE, MAYBE_KEY, KEY_RANGE } type;
 
-  SEL_ARG() {}
+  SEL_ARG() 
+    :min_flag(0),max_flag(0),maybe_flag(0),part(0),maybe_null(0),
+     elements(0),use_count(0),field(0),min_value(0),max_value(0),
+     left(0),right(0),next(0),prev(0),parent(0),next_key_part(0),
+     color(BLACK),type(IMPOSSIBLE)
+  {}
   SEL_ARG(SEL_ARG &);
   SEL_ARG(Field *,const char *,const char *);
   SEL_ARG(Field *field, uint8 part, char *min_value, char *max_value,
 	  uint8 min_flag, uint8 max_flag, uint8 maybe_flag);
   SEL_ARG(enum Type type_arg)
-    :elements(1),use_count(1),left(0),next_key_part(0),color(BLACK),
-     type(type_arg)
+    :min_flag(0),max_flag(0),maybe_flag(0),part(0),maybe_null(0),
+     elements(1),use_count(1),field(0),min_value(0),max_value(0),
+     left(0),right(0),next(0),prev(0),parent(0),next_key_part(0),
+     color(BLACK),type(type_arg)
   {}
   inline bool is_same(SEL_ARG *arg)
   {

--- 1.71/mysql-test/r/select.result	2005-11-24 18:15:05 +02:00
+++ 1.72/mysql-test/r/select.result	2006-06-01 10:35:35 +03:00
@@ -2714,3 +2714,415 @@
 f1	f2
 1	1
 drop table t1,t2;
+CREATE TABLE ACL2 (
+delete_access int(11) default '0',
+synch int(11) default '1',
+change_access int(11) default '0',
+prjid int(11) NOT NULL default '0',
+groupid int(11) NOT NULL default '0',
+userid int(11) NOT NULL default '0',
+write_access int(11) default '0',
+id int(11) NOT NULL auto_increment,
+read_access int(11) default '0',
+PRIMARY KEY  (id),
+KEY prjid (prjid),
+KEY userid (userid),
+KEY groupid (groupid)
+) TYPE=MyISAM;
+Warnings:
+Warning	1287	'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
+insert into ACL2 values (0,1,0,1,4,10001,0,1,1);
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+1,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+2,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+8,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+16,read_access
from ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+32,read_access
from ACL2;
+CREATE TABLE PersonTbl22 (
+username varchar(255) NOT NULL default '',
+weeklyhours float(8,2) default NULL,
+personal int(11) default '0',
+realname varchar(255) NOT NULL default '',
+synch int(11) default '1',
+emailclient int(11) default NULL,
+pin varchar(255) default '0',
+addrinfo varchar(255) default NULL,
+wapusername varchar(255) default NULL,
+email varchar(255) default NULL,
+firstname varchar(255) NOT NULL default '',
+webpublish_pass varchar(50) default NULL,
+phone1 varchar(255) default NULL,
+info text,
+phone2 varchar(255) default NULL,
+webpublish_chandesc varchar(255) default NULL,
+phone3 varchar(255) default NULL,
+id int(11) NOT NULL default '0',
+c_userid int(11) NOT NULL default '10001',
+phone4 varchar(255) default NULL,
+webpublish_channame varchar(255) default NULL,
+stylens int(11) NOT NULL default '-1000',
+password varchar(255) default 'pass',
+lastname varchar(255) NOT NULL default '',
+organization varchar(255) default NULL,
+tstamp int(11) default '0',
+webpublish_enable int(11) default NULL,
+onweb varchar(255) default NULL,
+hourlycost float(8,2) default NULL,
+initials varchar(15) default NULL,
+webform_enable int(11) default NULL,
+webform_defaultgroups varchar(255) default NULL,
+webform_headertitle varchar(255) default NULL,
+webform_text1 text,
+webform_text2 text,
+webform_text3 text,
+importid varchar(255) default NULL,
+importsource varchar(255) default NULL,
+location varchar(255) default NULL,
+email_password varchar(128) default NULL,
+email_user_type varchar(128) default NULL,
+personal_profile int(11) default NULL,
+banner_logo varchar(255) default NULL,
+customchar1 varchar(255) default NULL,
+customchar2 varchar(255) default NULL,
+customchar3 varchar(255) default NULL,
+customtext1 text,
+customtext2 text,
+customtext3 text,
+away_msg text,
+imstatus int(11) default '1',
+noimsound int(11) default '0',
+customer_no varchar(50) default NULL,
+customer_autonum varchar(50) default NULL,
+must_change_password int(11) default NULL,
+today_notice int(11) default NULL,
+user_type int(11) default NULL,
+is_template int(11) default NULL,
+personal_fim_sound int(11) NOT NULL default '0',
+today_notice_format int(11) default NULL,
+webform_complete_text text,
+webform_make_login int(11) default NULL,
+webform_send_email_to_user int(11) default NULL,
+webform_complete_email_string text,
+webform_user_template int(11) default NULL,
+webform_verification_url text,
+webform_allow_orgunit_enter int(11) default NULL,
+login_tries varchar(10) default NULL,
+password_expire_num varchar(10) default NULL,
+password_last_changed int(11) default NULL,
+default_login_tries varchar(10) default NULL,
+enablepopup int(11) NOT NULL default '0',
+not_viewable_documents varchar(255) default NULL,
+personalgroup int(11) default NULL,
+friendsgroup int(11) default NULL,
+enable_pers_buttons int(11) default '1',
+timezone int(11) default NULL,
+salutation varchar(20) default NULL,
+active_color varchar(255) NOT NULL default '',
+inactive_color varchar(255) NOT NULL default '',
+PRIMARY KEY  (id),
+KEY PersonTbl22_IX4 (username),
+KEY PersonTbl22_IX1 (realname),
+KEY PersonTbl22_IX2 (firstname),
+KEY PersonTbl22_IX3 (lastname),
+KEY phone1 (phone1),
+KEY phone2 (phone2),
+KEY email (email),
+KEY username (username),
+KEY firstname (firstname),
+KEY lastname (lastname),
+KEY realname (realname),
+KEY person_import_ix (importid)
+) TYPE=MyISAM;
+Warnings:
+Warning	1287	'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+values 
+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',37.50,0,'bbbbbbbbbbbbbbbbbbbbbb',
+8,1,'0','',NULL,'ccccccccccccccccccccccccc','dddddddddddd',NULL,'',
+'','',NULL,'',1,669698297,'',NULL,9,'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
+ ,'fffffffff','',1028706179,NULL,'',1000.00,'mjø',NULL,NULL,NULL,NULL,NULL,
+NULL,'',NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,
+NULL,NULL,0,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+1053518150,NULL,0,NULL,NULL,NULL,1,NULL,NULL,'','');
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id + 1,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color
+from PersonTbl22;
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id + 2,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color
+from PersonTbl22;
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id + 4,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color
+from PersonTbl22;
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id + 8,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color
+from PersonTbl22;
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+phone1,info,phone2,webpublish_chandesc,phone3,id + 16,c_userid,phone4,
+webpublish_channame,stylens,password,lastname,organization,tstamp,
+webpublish_enable,onweb,hourlycost,initials,webform_enable,
+webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+webform_text3,importid,importsource,location,email_password,
+email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+noimsound,customer_no,customer_autonum,must_change_password,
+today_notice,user_type,is_template,personal_fim_sound,
+today_notice_format,webform_complete_text,webform_make_login,
+webform_send_email_to_user,webform_complete_email_string,
+webform_user_template,webform_verification_url,
+webform_allow_orgunit_enter,login_tries,password_expire_num,
+password_last_changed,default_login_tries,enablepopup,
+not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+timezone,salutation,active_color,inactive_color
+from PersonTbl22;
+CREATE TABLE MembersTbl2 (
+groupid int(11) NOT NULL default '0',
+personid int(11) NOT NULL default '0',
+PRIMARY KEY  (groupid,personid),
+KEY groupid (groupid),
+KEY personid (personid)
+) TYPE=MyISAM;
+Warnings:
+Warning	1287	'TYPE=storage_engine' is deprecated; use 'ENGINE=storage_engine' instead
+insert into MembersTbl2 (groupid,personid) values (1,1);
+insert into MembersTbl2 (groupid,personid) 
+select groupid+1,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid+2,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid+4,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid+8,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid+16,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid,personid+1 from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid,personid+2 from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+select groupid,personid+4 from MembersTbl2;
+select count(*) from ACL2;
+count(*)
+32
+select count(*) from PersonTbl22;
+count(*)
+32
+select count(*) from MembersTbl2;
+count(*)
+256
+explain select straight_join DISTINCT 
+p.id,p.realname, ACL2.delete_access,
+ACL2.change_access, ACL2.write_access,ACL2.read_access 
+from ACL2, MembersTbl2 m, PersonTbl22 p 
+where 
+(ACL2.groupid=p.id or 
+(ACL2.groupid=m.groupid and  p.id=m.personid)
+) and 
+ACL2.prjid=556476786 and 
+(p.realname like  '%%' or p.firstname like '%%' or 
+p.phone1 like '%%' or p.phone2 like '%%' or 
+p.phone3 like '%%'  or p.phone4 like '%%' or 
+p.lastname like '%%' or p.organization like '%%'
+       )  
+order by p.realname limit 0,20;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	ACL2	ref	prjid,groupid	prjid	4	const	1	Using where; Using temporary; Using
filesort
+1	SIMPLE	m	index	PRIMARY,groupid,personid	PRIMARY	8	NULL	256	Using index
+1	SIMPLE	p	ALL	PRIMARY	NULL	NULL	NULL	32	Range checked for each record (index map: 0x1)
+explain select DISTINCT 
+p.id,p.realname, ACL2.delete_access,
+ACL2.change_access, ACL2.write_access,ACL2.read_access 
+from ACL2, MembersTbl2 m, PersonTbl22 p 
+where 
+(ACL2.groupid=p.id or 
+(ACL2.groupid=m.groupid and  p.id=m.personid)
+) and 
+ACL2.prjid=556476786 and 
+(p.realname like  '%%' or p.firstname like '%%' or 
+p.phone1 like '%%' or p.phone2 like '%%' or 
+p.phone3 like '%%'  or p.phone4 like '%%' or 
+p.lastname like '%%' or p.organization like '%%'
+       )  
+order by p.realname limit 0,20;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	p	ALL	PRIMARY	NULL	NULL	NULL	32	Using where; Using temporary; Using filesort
+1	SIMPLE	ACL2	ref	prjid,groupid	prjid	4	const	1	Using where
+1	SIMPLE	m	index	PRIMARY,groupid,personid	PRIMARY	8	NULL	256	Using where; Using index;
Distinct
+DROP TABLE ACL2;
+DROP TABLE PersonTbl22;
+DROP TABLE MembersTbl2;

--- 1.54/mysql-test/t/select.test	2005-11-24 18:14:52 +02:00
+++ 1.55/mysql-test/t/select.test	2006-06-01 10:35:35 +03:00
@@ -2248,4 +2248,410 @@
 select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); 
 drop table t1,t2;
 
+#
+# Bug #4981: 4.x and 5.x produce non-optimal execution path, 3.23 regression test failure
+#
+CREATE TABLE ACL2 (
+  delete_access int(11) default '0',
+  synch int(11) default '1',
+  change_access int(11) default '0',
+  prjid int(11) NOT NULL default '0',
+  groupid int(11) NOT NULL default '0',
+  userid int(11) NOT NULL default '0',
+  write_access int(11) default '0',
+  id int(11) NOT NULL auto_increment,
+  read_access int(11) default '0',
+  PRIMARY KEY  (id),
+  KEY prjid (prjid),
+  KEY userid (userid),
+  KEY groupid (groupid)
+) TYPE=MyISAM;
+
+insert into ACL2 values (0,1,0,1,4,10001,0,1,1);
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+ select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+1,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+ select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+2,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+ select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+8,read_access from
ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+ select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+16,read_access
from ACL2;
+insert into
ACL2(delete_access,synch,change_access,prjid,groupid,userid,write_access,id,read_access) 
+ select
delete_access,synch,change_access,prjid,groupid,userid,write_access,id+32,read_access
from ACL2;
+
+CREATE TABLE PersonTbl22 (
+  username varchar(255) NOT NULL default '',
+  weeklyhours float(8,2) default NULL,
+  personal int(11) default '0',
+  realname varchar(255) NOT NULL default '',
+  synch int(11) default '1',
+  emailclient int(11) default NULL,
+  pin varchar(255) default '0',
+  addrinfo varchar(255) default NULL,
+  wapusername varchar(255) default NULL,
+  email varchar(255) default NULL,
+  firstname varchar(255) NOT NULL default '',
+  webpublish_pass varchar(50) default NULL,
+  phone1 varchar(255) default NULL,
+  info text,
+  phone2 varchar(255) default NULL,
+  webpublish_chandesc varchar(255) default NULL,
+  phone3 varchar(255) default NULL,
+  id int(11) NOT NULL default '0',
+  c_userid int(11) NOT NULL default '10001',
+  phone4 varchar(255) default NULL,
+  webpublish_channame varchar(255) default NULL,
+  stylens int(11) NOT NULL default '-1000',
+  password varchar(255) default 'pass',
+  lastname varchar(255) NOT NULL default '',
+  organization varchar(255) default NULL,
+  tstamp int(11) default '0',
+  webpublish_enable int(11) default NULL,
+  onweb varchar(255) default NULL,
+  hourlycost float(8,2) default NULL,
+  initials varchar(15) default NULL,
+  webform_enable int(11) default NULL,
+  webform_defaultgroups varchar(255) default NULL,
+  webform_headertitle varchar(255) default NULL,
+  webform_text1 text,
+  webform_text2 text,
+  webform_text3 text,
+  importid varchar(255) default NULL,
+  importsource varchar(255) default NULL,
+  location varchar(255) default NULL,
+  email_password varchar(128) default NULL,
+  email_user_type varchar(128) default NULL,
+  personal_profile int(11) default NULL,
+  banner_logo varchar(255) default NULL,
+  customchar1 varchar(255) default NULL,
+  customchar2 varchar(255) default NULL,
+  customchar3 varchar(255) default NULL,
+  customtext1 text,
+  customtext2 text,
+  customtext3 text,
+  away_msg text,
+  imstatus int(11) default '1',
+  noimsound int(11) default '0',
+  customer_no varchar(50) default NULL,
+  customer_autonum varchar(50) default NULL,
+  must_change_password int(11) default NULL,
+  today_notice int(11) default NULL,
+  user_type int(11) default NULL,
+  is_template int(11) default NULL,
+  personal_fim_sound int(11) NOT NULL default '0',
+  today_notice_format int(11) default NULL,
+  webform_complete_text text,
+  webform_make_login int(11) default NULL,
+  webform_send_email_to_user int(11) default NULL,
+  webform_complete_email_string text,
+  webform_user_template int(11) default NULL,
+  webform_verification_url text,
+  webform_allow_orgunit_enter int(11) default NULL,
+  login_tries varchar(10) default NULL,
+  password_expire_num varchar(10) default NULL,
+  password_last_changed int(11) default NULL,
+  default_login_tries varchar(10) default NULL,
+  enablepopup int(11) NOT NULL default '0',
+  not_viewable_documents varchar(255) default NULL,
+  personalgroup int(11) default NULL,
+  friendsgroup int(11) default NULL,
+  enable_pers_buttons int(11) default '1',
+  timezone int(11) default NULL,
+  salutation varchar(20) default NULL,
+  active_color varchar(255) NOT NULL default '',
+  inactive_color varchar(255) NOT NULL default '',
+  PRIMARY KEY  (id),
+  KEY PersonTbl22_IX4 (username),
+  KEY PersonTbl22_IX1 (realname),
+  KEY PersonTbl22_IX2 (firstname),
+  KEY PersonTbl22_IX3 (lastname),
+  KEY phone1 (phone1),
+  KEY phone2 (phone2),
+  KEY email (email),
+  KEY username (username),
+  KEY firstname (firstname),
+  KEY lastname (lastname),
+  KEY realname (realname),
+  KEY person_import_ix (importid)
+) TYPE=MyISAM;
+
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+values 
+('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',37.50,0,'bbbbbbbbbbbbbbbbbbbbbb',
+ 8,1,'0','',NULL,'ccccccccccccccccccccccccc','dddddddddddd',NULL,'',
+ '','',NULL,'',1,669698297,'',NULL,9,'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
+ ,'fffffffff','',1028706179,NULL,'',1000.00,'mjø',NULL,NULL,NULL,NULL,NULL,
+ NULL,'',NULL,'',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,
+ NULL,NULL,0,NULL,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
+ 1053518150,NULL,0,NULL,NULL,NULL,1,NULL,NULL,'','');
+
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id + 1,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color
+from PersonTbl22;  
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id + 2,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color
+from PersonTbl22;  
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id + 4,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color
+from PersonTbl22;  
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id + 8,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color
+from PersonTbl22;  
+insert into PersonTbl22(username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color) 
+select username,weeklyhours,personal,realname,synch,
+  emailclient,pin,addrinfo,wapusername,email,firstname,webpublish_pass,
+  phone1,info,phone2,webpublish_chandesc,phone3,id + 16,c_userid,phone4,
+  webpublish_channame,stylens,password,lastname,organization,tstamp,
+  webpublish_enable,onweb,hourlycost,initials,webform_enable,
+  webform_defaultgroups,webform_headertitle,webform_text1,webform_text2,
+  webform_text3,importid,importsource,location,email_password,
+  email_user_type,personal_profile,banner_logo,customchar1,customchar2,
+  customchar3,customtext1,customtext2,customtext3,away_msg,imstatus,
+  noimsound,customer_no,customer_autonum,must_change_password,
+  today_notice,user_type,is_template,personal_fim_sound,
+  today_notice_format,webform_complete_text,webform_make_login,
+  webform_send_email_to_user,webform_complete_email_string,
+  webform_user_template,webform_verification_url,
+  webform_allow_orgunit_enter,login_tries,password_expire_num,
+  password_last_changed,default_login_tries,enablepopup,
+  not_viewable_documents,personalgroup,friendsgroup,enable_pers_buttons,
+  timezone,salutation,active_color,inactive_color
+from PersonTbl22;  
+
+CREATE TABLE MembersTbl2 (
+  groupid int(11) NOT NULL default '0',
+  personid int(11) NOT NULL default '0',
+  PRIMARY KEY  (groupid,personid),
+  KEY groupid (groupid),
+  KEY personid (personid)
+) TYPE=MyISAM;
+
+insert into MembersTbl2 (groupid,personid) values (1,1);
+insert into MembersTbl2 (groupid,personid) 
+  select groupid+1,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid+2,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid+4,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid+8,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid+16,personid from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid,personid+1 from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid,personid+2 from MembersTbl2;
+insert into MembersTbl2 (groupid,personid) 
+  select groupid,personid+4 from MembersTbl2;
+
+select count(*) from ACL2;  
+select count(*) from PersonTbl22;  
+select count(*) from MembersTbl2;  
+
+explain select straight_join DISTINCT 
+        p.id,p.realname, ACL2.delete_access,
+        ACL2.change_access, ACL2.write_access,ACL2.read_access 
+     from ACL2, MembersTbl2 m, PersonTbl22 p 
+     where 
+       (ACL2.groupid=p.id or 
+        (ACL2.groupid=m.groupid and  p.id=m.personid)
+       ) and 
+       ACL2.prjid=556476786 and 
+       (p.realname like  '%%' or p.firstname like '%%' or 
+        p.phone1 like '%%' or p.phone2 like '%%' or 
+        p.phone3 like '%%'  or p.phone4 like '%%' or 
+        p.lastname like '%%' or p.organization like '%%'
+       )  
+     order by p.realname limit 0,20;
+
+explain select DISTINCT 
+        p.id,p.realname, ACL2.delete_access,
+        ACL2.change_access, ACL2.write_access,ACL2.read_access 
+     from ACL2, MembersTbl2 m, PersonTbl22 p 
+     where 
+       (ACL2.groupid=p.id or 
+        (ACL2.groupid=m.groupid and  p.id=m.personid)
+       ) and 
+       ACL2.prjid=556476786 and 
+       (p.realname like  '%%' or p.firstname like '%%' or 
+        p.phone1 like '%%' or p.phone2 like '%%' or 
+        p.phone3 like '%%'  or p.phone4 like '%%' or 
+        p.lastname like '%%' or p.organization like '%%'
+       )  
+     order by p.realname limit 0,20;
+
+DROP TABLE ACL2;
+DROP TABLE PersonTbl22;
+DROP TABLE MembersTbl2;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (gkodinov:1.2485) BUG#4981kgeorge1 Jun