From 014fe01512711d3d1296f1dd5326420810b35b79 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Mon, 20 Jun 2005 08:56:37 +0000 Subject: [PATCH 1/5] Fix for BUG#8441: in index_merge code when creating index search tuples use KEY_PART_INFO::store_length, not KEY_PART_INFO::length (like range code does) --- mysql-test/r/index_merge_innodb.result | 11 +++++++++++ mysql-test/t/index_merge_innodb.test | 11 +++++++++++ sql/opt_range.cc | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 52e2a4046cf..662fffe1ba1 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -123,3 +123,14 @@ key1a = 2 and key1b is null and key3a = 2 and key3b is null; count(*) 4 drop table t1,t2; +create table t1 ( +id1 int, +id2 date , +index idx2 (id1,id2), +index idx1 (id2) +) engine = innodb; +insert into t1 values(1,'20040101'), (2,'20040102'); +select * from t1 where id1 = 1 and id2= '20040101'; +id1 id2 +1 2004-01-01 +drop table t1; diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index 5e270c161a2..c10ce3b9688 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -120,3 +120,14 @@ select count(*) from t1 where drop table t1,t2; +# Test for BUG#8441 +create table t1 ( + id1 int, + id2 date , + index idx2 (id1,id2), + index idx1 (id2) +) engine = innodb; +insert into t1 values(1,'20040101'), (2,'20040102'); +select * from t1 where id1 = 1 and id2= '20040101'; +drop table t1; + diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5732e156a7c..ffe0a067d68 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2593,12 +2593,12 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, { tuple_arg= scan->sel_arg; /* Here we use the length of the first key part */ - tuple_arg->store_min(key_part->length, &key_ptr, 0); + tuple_arg->store_min(key_part->store_length, &key_ptr, 0); } while (tuple_arg->next_key_part != sel_arg) { tuple_arg= tuple_arg->next_key_part; - tuple_arg->store_min(key_part[tuple_arg->part].length, &key_ptr, 0); + tuple_arg->store_min(key_part[tuple_arg->part].store_length, &key_ptr, 0); } min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val); records= (info->param->table->file-> From 893c6c9b46a945d5c93098e072e2b653b3e3c172 Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Thu, 23 Jun 2005 02:08:30 -0700 Subject: [PATCH 2/5] opt_range.cc: Fixed buf #11487. Added a call of QUICK_RANGE_SELECT::init to the QUICK_RANGE_SELECT::reset method. Without it the second evaluation of a subquery employing the range access failed. subselect.result, subselect.test: Added a test case for bug #11487. --- mysql-test/r/subselect.result | 21 +++++++++++++++++++++ mysql-test/t/subselect.test | 22 ++++++++++++++++++++++ sql/opt_range.cc | 5 ++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 6703147c635..736559f8569 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -2816,3 +2816,24 @@ select * from t1; EMPNUM E1 DROP TABLE t1,t2; +CREATE TABLE t1(select_id BIGINT, values_id BIGINT); +INSERT INTO t1 VALUES (1, 1); +CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, +PRIMARY KEY(select_id,values_id)); +INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 +WHERE select_id IN (1, 0)); +values_id +1 +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 +WHERE select_id BETWEEN 0 AND 1); +values_id +1 +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 +WHERE select_id = 0 OR select_id = 1); +values_id +1 +DROP TABLE t1, t2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 2e6cea8468b..1e4930d385d 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1837,3 +1837,25 @@ WHERE t1.EMPNUM NOT IN WHERE t1.EMPNUM = t2.EMPNUM); select * from t1; DROP TABLE t1,t2; + +# +# Test for bug #11487: range access in a subquery +# + +CREATE TABLE t1(select_id BIGINT, values_id BIGINT); +INSERT INTO t1 VALUES (1, 1); +CREATE TABLE t2 (select_id BIGINT, values_id BIGINT, + PRIMARY KEY(select_id,values_id)); +INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5); + +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 + WHERE select_id IN (1, 0)); +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 + WHERE select_id BETWEEN 0 AND 1); +SELECT values_id FROM t1 +WHERE values_id IN (SELECT values_id FROM t2 + WHERE select_id = 0 OR select_id = 1); + +DROP TABLE t1, t2; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0a8627b1fa0..200e6dfbabb 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5992,7 +5992,10 @@ int QUICK_RANGE_SELECT::reset() next=0; range= NULL; cur_range= (QUICK_RANGE**) ranges.buffer; - + + if (file->inited == handler::NONE && (error= file->ha_index_init(index))) + DBUG_RETURN(error); + /* Do not allocate the buffers twice. */ if (multi_range_length) { From 03b128971e633ed7ebb3be88aa985ddf5c0c0987 Mon Sep 17 00:00:00 2001 From: "lenz@mysql.com" <> Date: Thu, 23 Jun 2005 11:30:40 +0200 Subject: [PATCH 3/5] - fixed text file generation - the node names in the info page had changed --- Docs/Makefile.am | 8 ++++---- Docs/Support/generate-flag-images | 31 ----------------------------- Docs/Support/generate-text-files.pl | 2 +- 3 files changed, 5 insertions(+), 36 deletions(-) delete mode 100755 Docs/Support/generate-flag-images diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 8577fee52cb..dba3a4f819c 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -36,19 +36,19 @@ CLEAN_FILES: $(txt_files) GT = $(srcdir)/Support/generate-text-files.pl ../INSTALL-SOURCE: mysql.info $(GT) - perl -w $(GT) mysql.info "Installing" "Tutorial" > $@ + perl -w $(GT) mysql.info "installing-source" "windows-source-build" > $@ # We put the description for the binary installation here so that # people who download source wont have to see it. It is moved up to # the toplevel by the script that makes the binary tar files. INSTALL-BINARY: mysql.info $(GT) - perl -w $(GT) mysql.info "Installing binary" "Installing source" > $@ + perl -w $(GT) mysql.info "installing-binary" "installing-source" > $@ ../EXCEPTIONS-CLIENT: mysql.info $(GT) - perl -w $(GT) mysql.info "MySQL FLOSS License Exception" "Function Index" > $@ + perl -w $(GT) mysql.info "mysql-floss-license-exception" "function-index" > $@ ../support-files/MacOSX/ReadMe.txt: mysql.info $(GT) - perl -w $(GT) mysql.info "Mac OS X installation" "NetWare installation" > $@ + perl -w $(GT) mysql.info "mac-os-x-installation" "netware-installation" > $@ # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/Docs/Support/generate-flag-images b/Docs/Support/generate-flag-images deleted file mode 100755 index 21140388012..00000000000 --- a/Docs/Support/generate-flag-images +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -flags=`grep @image mirrors.texi | cut -d" " -f1 | cut -d/ -f2 | tr -d "}" | sort | uniq` - -set -x -cd Flags - -for c in $flags -do - # For PNM, to be used later - giftopnm ../Raw-Flags/$c.gif | pnmscale -xsize 30 > $c-tmp.pnm - pnmpaste $c-tmp.pnm 1 1 ../Images/flag-background.pnm > $c.pnm - rm -f $c-tmp.pnm - - # For GIF version - ppmtogif $c.pnm > $c.gif - # or cjpeg -optimize -quality 70 -outfile $c.jpg - - # For EPS version - pnmtops -noturn $c.pnm > $c.eps - - # For PDF version - ps2pdf $c.eps $c.pdf - - # For text version - echo -n "" > $c.txt - - # PNM isn't really needed - rm -f $c.pnm - -done diff --git a/Docs/Support/generate-text-files.pl b/Docs/Support/generate-text-files.pl index 6470baaa6e9..0829525f679 100755 --- a/Docs/Support/generate-text-files.pl +++ b/Docs/Support/generate-text-files.pl @@ -13,7 +13,7 @@ while () { if ($in) { - if (/Node: $tnode,/) + if (/Node: $tnode,/ || /\[index/) { $in = 0; } From b720c6e5354e09ec406b5b400051df985ec27801 Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com" <> Date: Thu, 23 Jun 2005 16:04:10 +0500 Subject: [PATCH 4/5] WL#2286 - Compile MySQL w/YASSL support Fix for "multiple definition of __cxa_pure_virtual" link failure when compiling with icc. --- extra/yassl/taocrypt/include/runtime.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 70768bb01d1..f506040f0d8 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -25,7 +25,7 @@ -#if !defined(yaSSL_NEW_HPP) && defined(__GNUC__) +#if !defined(yaSSL_NEW_HPP) && defined(__GNUC__) && !defined(__ICC) #define yaSSL_NEW_HPP From c63914c0b3b263e9fe64ffa1b3c0a5c54178cdc9 Mon Sep 17 00:00:00 2001 From: "igor@rurik.mysql.com" <> Date: Thu, 23 Jun 2005 04:10:43 -0700 Subject: [PATCH 5/5] opt_range.cc: Identation correction. --- sql/opt_range.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1d6acb3aee1..59ec1140d15 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5994,7 +5994,7 @@ int QUICK_RANGE_SELECT::reset() cur_range= (QUICK_RANGE**) ranges.buffer; if (file->inited == handler::NONE && (error= file->ha_index_init(index))) - DBUG_RETURN(error); + DBUG_RETURN(error); /* Do not allocate the buffers twice. */ if (multi_range_length)