From 6c610ed97964a6370e7082ca1fd1f11c4d6720ba Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Feb 2011 14:46:16 +0200 Subject: [PATCH] Fixed build issues - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client - Fixed bug in heap tables when doing handler read next-prev over last row BUILD/compile-dist: - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client cmd-line-utils/libedit/vi.c: Fixed compiler warning about not checking return value for write mysql-test/r/index_intersect.result: Updated results (missed this file in my last push) mysql-test/suite/handler/aria.result: Updated test results mysql-test/suite/handler/handler.inc: Changed test to use read next/read prev on key where there are duplicates that can come in different order depending on system Added testing of read next-prev over last row and read prev-next around first row mysql-test/suite/handler/heap.result: Updated test results mysql-test/suite/handler/init.inc: More rows to test mysql-test/suite/handler/innodb.result: Updated test results mysql-test/suite/handler/interface.result: Updated test results mysql-test/suite/handler/myisam.result: Updated test results mysql-test/t/variables-big.test: Fixed test to not fail on windows mysql-test/valgrind.supp: Removed not matching fun: to get rid of valgrind warning storage/heap/hp_rfirst.c: Added state so that we know if we have an active position in the index. storage/heap/hp_rkey.c: Added state so that we know if we have an active position in the index. storage/heap/hp_rnext.c: Handle reading several next after finding the last row (this caused a crash before) storage/heap/hp_rprev.c: Handle reading several prev after finding the first row (this caused a crash before) storage/xtradb/buf/buf0buf.c: Fixed compiler warning about uninitialized value --- BUILD/compile-dist | 2 +- cmd-line-utils/libedit/vi.c | 9 +- mysql-test/r/index_intersect.result | 44 +++---- mysql-test/suite/handler/aria.result | 139 ++++++++++++++-------- mysql-test/suite/handler/handler.inc | 46 +++++-- mysql-test/suite/handler/heap.result | 139 ++++++++++++++-------- mysql-test/suite/handler/init.inc | 2 +- mysql-test/suite/handler/innodb.result | 139 ++++++++++++++-------- mysql-test/suite/handler/interface.result | 2 +- mysql-test/suite/handler/myisam.result | 139 ++++++++++++++-------- mysql-test/t/variables-big.test | 4 + mysql-test/valgrind.supp | 1 - storage/heap/hp_rfirst.c | 1 + storage/heap/hp_rkey.c | 4 +- storage/heap/hp_rnext.c | 15 ++- storage/heap/hp_rprev.c | 15 ++- storage/heap/hp_rsame.c | 2 +- storage/xtradb/buf/buf0buf.c | 2 +- 18 files changed, 466 insertions(+), 239 deletions(-) diff --git a/BUILD/compile-dist b/BUILD/compile-dist index d8b939dc0fc..3b02629b8c1 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -28,7 +28,7 @@ fi # Default to gcc for CC and CXX if test -z "$CXX" ; then export CXX - CXX=gcc + CXX=g++ # Set some required compile options if test -z "$CXXFLAGS" ; then export CXXFLAGS diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c index d628f076a1d..d18a518a10d 100644 --- a/cmd-line-utils/libedit/vi.c +++ b/cmd-line-utils/libedit/vi.c @@ -1012,8 +1012,13 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__))) if (fd < 0) return CC_ERROR; cp = el->el_line.buffer; - write(fd, cp, el->el_line.lastchar - cp +0u); - write(fd, "\n", 1); + if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1 || + write(fd, "\n", 1) == -1) + { + close(fd); + unlink(tempfile); + return CC_ERROR; + } pid = fork(); switch (pid) { case -1: diff --git a/mysql-test/r/index_intersect.result b/mysql-test/r/index_intersect.result index c1b4464c3dd..1bbe7d09c34 100644 --- a/mysql-test/r/index_intersect.result +++ b/mysql-test/r/index_intersect.result @@ -64,22 +64,22 @@ EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where +1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL 5 Using sort_intersect(Population,Name); Using where +1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Name 35 NULL 164 Using index condition; Using where; Using MRR +1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where; Using MRR EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Name Population 4 NULL 15 Using index condition; Using where; Using MRR +1 SIMPLE City range Population,Name Population 4 NULL # Using index condition; Using where; Using MRR SELECT * FROM City USE INDEX () WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -361,17 +361,17 @@ EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where +1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL 19 Using sort_intersect(Population,Country); Using where +1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL 283 Using index condition; Using where; Using MRR +1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where; Using MRR SELECT * FROM City USE INDEX () WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%'; ID Name Country Population @@ -462,29 +462,29 @@ EXPLAIN SELECT * FROM City WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 359 Using index condition; Using where; Using MRR +1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL 6 Using sort_intersect(Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL # Using sort_intersect(Country,Population); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL 21 Using index condition; Using where; Using MRR +1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL # Using index condition; Using where; Using MRR EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 AND Country BETWEEN 'S' AND 'Z'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL 17 Using sort_intersect(Population,PRIMARY); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL # Using sort_intersect(Population,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z' ; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 429 Using index condition; Using where; Using MRR +1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR SELECT * FROM City USE INDEX () WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; ID Name Country Population @@ -718,33 +718,33 @@ EXPLAIN SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where +1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL 5 Using sort_intersect(Population,Name); Using where +1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL 19 Using sort_intersect(Population,Country); Using where +1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Population,Country,Name Name 35 NULL 225 Using index condition; Using where; Using MRR +1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where; Using MRR EXPLAIN SELECT * FROM City WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL 6 Using sort_intersect(Country,Population); Using where +1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL # Using sort_intersect(Country,Population); Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 AND Country BETWEEN 'S' AND 'Z'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 429 Using index condition; Using where; Using MRR +1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR SELECT * FROM City WHERE Name LIKE 'C%' AND Population > 1000000; ID Name Country Population @@ -885,17 +885,17 @@ EXPLAIN SELECT * FROM City WHERE Country LIKE 'M%' AND Population > 1000000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL 15 Using sort_intersect(Population,CountryID); Using where +1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='CHN' AND Population > 1500000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL 11 Using sort_intersect(Population,CountryID); Using where +1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL 1 Using sort_intersect(CountryName,Population); Using where +1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where SELECT * FROM City USE INDEX () WHERE Country LIKE 'M%' AND Population > 1000000; ID Name Country Population @@ -1028,7 +1028,7 @@ EXPLAIN SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL 5 Using index condition; Using where; Using MRR +1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL # Using index condition; Using where; Using MRR SELECT * FROM t1 WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ; f1 f4 f5 diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result index 58ecdaa1f09..24e00293f92 100644 --- a/mysql-test/suite/handler/aria.result +++ b/mysql-test/suite/handler/aria.result @@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); handler t1 open as t2; handler t2 read b first; a b @@ -20,13 +20,13 @@ a b 16 ccc handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b prev; a b -20 ggg +23 xxx handler t2 read b first; a b 14 aaa @@ -34,13 +34,13 @@ handler t2 read b prev; a b handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b next; a b -22 iii +25 xxx handler t2 read b next; a b handler t2 read a=(15); @@ -105,10 +105,10 @@ handler t2 read a>(54); a b handler t2 read a<=(54); a b -22 iii +25 xxx handler t2 read a<(54); a b -22 iii +25 xxx handler t2 read a=(1); a b handler t2 read a>=(1); @@ -158,9 +158,9 @@ a b 18 eee handler t2 read a last limit 3; a b -22 iii -21 hhh -20 ggg +25 xxx +24 xxx +23 xxx handler t2 read b=(16) limit 1,3; a b 16 xxx @@ -191,10 +191,10 @@ handler t1 close; handler t1 open; handler t1 read a prev; a b -22 iii +25 xxx handler t1 read a prev; a b -21 hhh +24 xxx handler t1 close; handler t1 open as t2; handler t2 read first; @@ -204,53 +204,97 @@ alter table t1 engine = Aria; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx flush tables; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx +handler t1 close; +handler t1 open; +handler t1 read a=(25); +a b +25 xxx +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(14); +a b +14 aaa +handler t1 read a prev; +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a next; +a b +14 aaa handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?) limit ?,?'; -set @a=16,@b=1,@c=100; +set @a=20,@b=1,@c=100; execute stmt using @a,@b,@c; a b -16 xxx -set @a=16,@b=2,@c=1; +set @a=20,@b=2,@c=1; execute stmt using @a,@b,@c; a b -set @a=16,@b=0,@c=2; +set @a=20,@b=0,@c=2; execute stmt using @a,@b,@c; a b -16 ccc -16 xxx +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a next limit ?'; -handler t1 read a>=(11); +handler t1 read a>=(21); a b -14 aaa +21 hhh set @a=3; execute stmt using @a; a b -16 ccc -16 xxx -17 ddd -execute stmt using @a; -a b -18 eee -19 fff -19 yyy -execute stmt using @a; -a b -20 ggg -21 hhh 22 iii +23 xxx +24 xxx +execute stmt using @a; +a b +25 xxx +execute stmt using @a; +a b deallocate prepare stmt; prepare stmt from 'handler t1 read b prev limit ?'; execute stmt using @a; a b +25 xxx +24 xxx +23 xxx +execute stmt using @a; +a b 22 iii 21 hhh 20 ggg @@ -264,9 +308,6 @@ a b 17 ddd 16 xxx 16 ccc -execute stmt using @a; -a b -14 aaa deallocate prepare stmt; prepare stmt from 'handler t1 read b=(?,?)'; set @a=14, @b='aaa'; @@ -289,27 +330,27 @@ a b 16 xxx deallocate prepare stmt; prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5'; -set @a=15, @b=20; +set @a=17, @b=24; execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a=(?)'; -set @a=16; +set @a=17; execute stmt using @a; a b -16 ccc +17 ddd alter table t1 add c int; execute stmt using @a; ERROR 42S02: Unknown table 't1' in HANDLER @@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER handler t1 open; prepare stmt from 'handler t1 read a=(?)'; flush tables; -set @a=16; +set @a=17; execute stmt using @a; ERROR HY000: Prepared statement needs to be re-prepared deallocate prepare stmt; diff --git a/mysql-test/suite/handler/handler.inc b/mysql-test/suite/handler/handler.inc index d0ae6164079..a364c15873a 100644 --- a/mysql-test/suite/handler/handler.inc +++ b/mysql-test/suite/handler/handler.inc @@ -120,9 +120,37 @@ eval alter table t1 engine = $engine_type; handler t2 read first; handler t1 open; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; flush tables; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; +handler t1 close; + +# +# Search after end and before start of index +# + +handler t1 open; +handler t1 read a=(25); +handler t1 read a next; +handler t1 read a next; +handler t1 read a next; +handler t1 read a prev; +handler t1 read a=(1000); +handler t1 read a next; +handler t1 read a prev; +handler t1 read a=(1000); +handler t1 read a prev; + +handler t1 read a=(14); +handler t1 read a prev; +handler t1 read a prev; +handler t1 read a next; +handler t1 read a=(1); +handler t1 read a prev; +handler t1 read a next; +handler t1 read a=(1); +handler t1 read a next; + handler t1 close; # @@ -131,16 +159,16 @@ handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?) limit ?,?'; -set @a=16,@b=1,@c=100; +set @a=20,@b=1,@c=100; execute stmt using @a,@b,@c; -set @a=16,@b=2,@c=1; +set @a=20,@b=2,@c=1; execute stmt using @a,@b,@c; -set @a=16,@b=0,@c=2; +set @a=20,@b=0,@c=2; execute stmt using @a,@b,@c; deallocate prepare stmt; prepare stmt from 'handler t1 read a next limit ?'; -handler t1 read a>=(11); +handler t1 read a>=(21); set @a=3; execute stmt using @a; execute stmt using @a; @@ -168,13 +196,13 @@ execute stmt using @a; deallocate prepare stmt; prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5'; -set @a=15, @b=20; +set @a=17, @b=24; execute stmt using @a,@b; execute stmt using @a,@b; deallocate prepare stmt; prepare stmt from 'handler t1 read a=(?)'; -set @a=16; +set @a=17; execute stmt using @a; alter table t1 add c int; --error 1109 @@ -186,7 +214,7 @@ handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?)'; flush tables; -set @a=16; +set @a=17; --error ER_NEED_REPREPARE execute stmt using @a; deallocate prepare stmt; diff --git a/mysql-test/suite/handler/heap.result b/mysql-test/suite/handler/heap.result index 07050042447..20f16f106de 100644 --- a/mysql-test/suite/handler/heap.result +++ b/mysql-test/suite/handler/heap.result @@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a using btree (a), key b using btree (a, insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); handler t1 open as t2; handler t2 read b first; a b @@ -20,13 +20,13 @@ a b 16 ccc handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b prev; a b -20 ggg +23 xxx handler t2 read b first; a b 14 aaa @@ -34,13 +34,13 @@ handler t2 read b prev; a b handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b next; a b -22 iii +25 xxx handler t2 read b next; a b handler t2 read a=(15); @@ -105,10 +105,10 @@ handler t2 read a>(54); a b handler t2 read a<=(54); a b -22 iii +25 xxx handler t2 read a<(54); a b -22 iii +25 xxx handler t2 read a=(1); a b handler t2 read a>=(1); @@ -158,9 +158,9 @@ a b 18 eee handler t2 read a last limit 3; a b -22 iii -21 hhh -20 ggg +25 xxx +24 xxx +23 xxx handler t2 read b=(16) limit 1,3; a b 16 xxx @@ -191,10 +191,10 @@ handler t1 close; handler t1 open; handler t1 read a prev; a b -22 iii +25 xxx handler t1 read a prev; a b -21 hhh +24 xxx handler t1 close; handler t1 open as t2; handler t2 read first; @@ -204,53 +204,97 @@ alter table t1 engine = MEMORY; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 ccc flush tables; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 ccc +handler t1 close; +handler t1 open; +handler t1 read a=(25); +a b +25 xxx +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(14); +a b +14 aaa +handler t1 read a prev; +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a next; +a b +14 aaa handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?) limit ?,?'; -set @a=16,@b=1,@c=100; +set @a=20,@b=1,@c=100; execute stmt using @a,@b,@c; a b -16 ccc -set @a=16,@b=2,@c=1; +set @a=20,@b=2,@c=1; execute stmt using @a,@b,@c; a b -set @a=16,@b=0,@c=2; +set @a=20,@b=0,@c=2; execute stmt using @a,@b,@c; a b -16 xxx -16 ccc +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a next limit ?'; -handler t1 read a>=(11); +handler t1 read a>=(21); a b -14 aaa +21 hhh set @a=3; execute stmt using @a; a b -16 xxx -16 ccc -17 ddd -execute stmt using @a; -a b -18 eee -19 fff -19 yyy -execute stmt using @a; -a b -20 ggg -21 hhh 22 iii +23 xxx +24 xxx +execute stmt using @a; +a b +25 xxx +execute stmt using @a; +a b deallocate prepare stmt; prepare stmt from 'handler t1 read b prev limit ?'; execute stmt using @a; a b +25 xxx +24 xxx +23 xxx +execute stmt using @a; +a b 22 iii 21 hhh 20 ggg @@ -264,9 +308,6 @@ a b 17 ddd 16 xxx 16 ccc -execute stmt using @a; -a b -14 aaa deallocate prepare stmt; prepare stmt from 'handler t1 read b=(?,?)'; set @a=14, @b='aaa'; @@ -289,27 +330,27 @@ a b 16 xxx deallocate prepare stmt; prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5'; -set @a=15, @b=20; +set @a=17, @b=24; execute stmt using @a,@b; a b -16 xxx -16 ccc 17 ddd 18 eee 19 fff +19 yyy +20 ggg execute stmt using @a,@b; a b -16 xxx -16 ccc 17 ddd 18 eee 19 fff +19 yyy +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a=(?)'; -set @a=16; +set @a=17; execute stmt using @a; a b -16 xxx +17 ddd alter table t1 add c int; execute stmt using @a; ERROR 42S02: Unknown table 't1' in HANDLER @@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER handler t1 open; prepare stmt from 'handler t1 read a=(?)'; flush tables; -set @a=16; +set @a=17; execute stmt using @a; ERROR HY000: Prepared statement needs to be re-prepared deallocate prepare stmt; diff --git a/mysql-test/suite/handler/init.inc b/mysql-test/suite/handler/init.inc index 32c6010f95b..3e63f14a103 100644 --- a/mysql-test/suite/handler/init.inc +++ b/mysql-test/suite/handler/init.inc @@ -30,4 +30,4 @@ eval create table t1 (a int, b char(10), key a $key_type (a), key b $key_type (a insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result index 113d5d7e61f..e9e2fc45837 100644 --- a/mysql-test/suite/handler/innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); handler t1 open as t2; handler t2 read b first; a b @@ -20,13 +20,13 @@ a b 16 ccc handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b prev; a b -20 ggg +23 xxx handler t2 read b first; a b 14 aaa @@ -34,13 +34,13 @@ handler t2 read b prev; a b handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b next; a b -22 iii +25 xxx handler t2 read b next; a b handler t2 read a=(15); @@ -105,10 +105,10 @@ handler t2 read a>(54); a b handler t2 read a<=(54); a b -22 iii +25 xxx handler t2 read a<(54); a b -22 iii +25 xxx handler t2 read a=(1); a b handler t2 read a>=(1); @@ -158,9 +158,9 @@ a b 18 eee handler t2 read a last limit 3; a b -22 iii -21 hhh -20 ggg +25 xxx +24 xxx +23 xxx handler t2 read b=(16) limit 1,3; a b 16 xxx @@ -191,10 +191,10 @@ handler t1 close; handler t1 open; handler t1 read a prev; a b -22 iii +25 xxx handler t1 read a prev; a b -21 hhh +24 xxx handler t1 close; handler t1 open as t2; handler t2 read first; @@ -204,53 +204,97 @@ alter table t1 engine = InnoDB; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx flush tables; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx +handler t1 close; +handler t1 open; +handler t1 read a=(25); +a b +25 xxx +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(14); +a b +14 aaa +handler t1 read a prev; +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a next; +a b +16 ccc handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?) limit ?,?'; -set @a=16,@b=1,@c=100; +set @a=20,@b=1,@c=100; execute stmt using @a,@b,@c; a b -16 xxx -set @a=16,@b=2,@c=1; +set @a=20,@b=2,@c=1; execute stmt using @a,@b,@c; a b -set @a=16,@b=0,@c=2; +set @a=20,@b=0,@c=2; execute stmt using @a,@b,@c; a b -16 ccc -16 xxx +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a next limit ?'; -handler t1 read a>=(11); +handler t1 read a>=(21); a b -14 aaa +21 hhh set @a=3; execute stmt using @a; a b -16 ccc -16 xxx -17 ddd -execute stmt using @a; -a b -18 eee -19 fff -19 yyy -execute stmt using @a; -a b -20 ggg -21 hhh 22 iii +23 xxx +24 xxx +execute stmt using @a; +a b +25 xxx +execute stmt using @a; +a b deallocate prepare stmt; prepare stmt from 'handler t1 read b prev limit ?'; execute stmt using @a; a b +25 xxx +24 xxx +23 xxx +execute stmt using @a; +a b 22 iii 21 hhh 20 ggg @@ -264,9 +308,6 @@ a b 17 ddd 16 xxx 16 ccc -execute stmt using @a; -a b -14 aaa deallocate prepare stmt; prepare stmt from 'handler t1 read b=(?,?)'; set @a=14, @b='aaa'; @@ -289,27 +330,27 @@ a b 16 xxx deallocate prepare stmt; prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5'; -set @a=15, @b=20; +set @a=17, @b=24; execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a=(?)'; -set @a=16; +set @a=17; execute stmt using @a; a b -16 ccc +17 ddd alter table t1 add c int; execute stmt using @a; ERROR 42S02: Unknown table 't1' in HANDLER @@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER handler t1 open; prepare stmt from 'handler t1 read a=(?)'; flush tables; -set @a=16; +set @a=17; execute stmt using @a; ERROR HY000: Prepared statement needs to be re-prepared deallocate prepare stmt; diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index 9949097c65a..04fcb1b9002 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -6,7 +6,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); handler t1 open; handler t1 read a=(SELECT 1); ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1 diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result index fd333015bbe..ff0e7335556 100644 --- a/mysql-test/suite/handler/myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (14,"aaa"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); +(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); handler t1 open as t2; handler t2 read b first; a b @@ -20,13 +20,13 @@ a b 16 ccc handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b prev; a b -20 ggg +23 xxx handler t2 read b first; a b 14 aaa @@ -34,13 +34,13 @@ handler t2 read b prev; a b handler t2 read b last; a b -22 iii +25 xxx handler t2 read b prev; a b -21 hhh +24 xxx handler t2 read b next; a b -22 iii +25 xxx handler t2 read b next; a b handler t2 read a=(15); @@ -105,10 +105,10 @@ handler t2 read a>(54); a b handler t2 read a<=(54); a b -22 iii +25 xxx handler t2 read a<(54); a b -22 iii +25 xxx handler t2 read a=(1); a b handler t2 read a>=(1); @@ -158,9 +158,9 @@ a b 18 eee handler t2 read a last limit 3; a b -22 iii -21 hhh -20 ggg +25 xxx +24 xxx +23 xxx handler t2 read b=(16) limit 1,3; a b 16 xxx @@ -191,10 +191,10 @@ handler t1 close; handler t1 open; handler t1 read a prev; a b -22 iii +25 xxx handler t1 read a prev; a b -21 hhh +24 xxx handler t1 close; handler t1 open as t2; handler t2 read first; @@ -204,53 +204,97 @@ alter table t1 engine = MyISAM; handler t2 read first; ERROR 42S02: Unknown table 't2' in HANDLER handler t1 open; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx flush tables; -handler t1 read a=(16) limit 1,3; +handler t1 read a=(20) limit 1,3; a b -16 xxx +handler t1 close; +handler t1 open; +handler t1 read a=(25); +a b +25 xxx +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a next; +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(1000); +a b +handler t1 read a prev; +a b +25 xxx +handler t1 read a=(14); +a b +14 aaa +handler t1 read a prev; +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a prev; +a b +handler t1 read a next; +a b +14 aaa +handler t1 read a=(1); +a b +handler t1 read a next; +a b +14 aaa handler t1 close; handler t1 open; prepare stmt from 'handler t1 read a=(?) limit ?,?'; -set @a=16,@b=1,@c=100; +set @a=20,@b=1,@c=100; execute stmt using @a,@b,@c; a b -16 xxx -set @a=16,@b=2,@c=1; +set @a=20,@b=2,@c=1; execute stmt using @a,@b,@c; a b -set @a=16,@b=0,@c=2; +set @a=20,@b=0,@c=2; execute stmt using @a,@b,@c; a b -16 ccc -16 xxx +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a next limit ?'; -handler t1 read a>=(11); +handler t1 read a>=(21); a b -14 aaa +21 hhh set @a=3; execute stmt using @a; a b -16 ccc -16 xxx -17 ddd -execute stmt using @a; -a b -18 eee -19 fff -19 yyy -execute stmt using @a; -a b -20 ggg -21 hhh 22 iii +23 xxx +24 xxx +execute stmt using @a; +a b +25 xxx +execute stmt using @a; +a b deallocate prepare stmt; prepare stmt from 'handler t1 read b prev limit ?'; execute stmt using @a; a b +25 xxx +24 xxx +23 xxx +execute stmt using @a; +a b 22 iii 21 hhh 20 ggg @@ -264,9 +308,6 @@ a b 17 ddd 16 xxx 16 ccc -execute stmt using @a; -a b -14 aaa deallocate prepare stmt; prepare stmt from 'handler t1 read b=(?,?)'; set @a=14, @b='aaa'; @@ -289,27 +330,27 @@ a b 16 xxx deallocate prepare stmt; prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5'; -set @a=15, @b=20; +set @a=17, @b=24; execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg execute stmt using @a,@b; a b -16 ccc -16 xxx 17 ddd 18 eee 19 fff +19 yyy +20 ggg deallocate prepare stmt; prepare stmt from 'handler t1 read a=(?)'; -set @a=16; +set @a=17; execute stmt using @a; a b -16 ccc +17 ddd alter table t1 add c int; execute stmt using @a; ERROR 42S02: Unknown table 't1' in HANDLER @@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER handler t1 open; prepare stmt from 'handler t1 read a=(?)'; flush tables; -set @a=16; +set @a=17; execute stmt using @a; ERROR HY000: Prepared statement needs to be re-prepared deallocate prepare stmt; diff --git a/mysql-test/t/variables-big.test b/mysql-test/t/variables-big.test index 67a8d9fe86d..2df0222c9d5 100644 --- a/mysql-test/t/variables-big.test +++ b/mysql-test/t/variables-big.test @@ -40,18 +40,22 @@ SET SESSION transaction_prealloc_size=1024*1024*1024*1; --replace_column 1 6