mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Manually merged
mysql-test/r/sp.result: Auto merged mysql-test/t/sp.test: Auto merged sql/field.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/innobase/os/os0thread.c: Auto merged storage/myisam/myisam_ftdump.c: Auto merged storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged storage/ndb/src/ndbapi/NdbImpl.hpp: Auto merged storage/ndb/src/ndbapi/NdbRecAttr.cpp: Auto merged storage/ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged
This commit is contained in:
commit
9422fee7de
33 changed files with 868 additions and 38 deletions
|
@ -95,6 +95,9 @@ extern "C" {
|
|||
/* On NetWare, stack grows towards lower address*/
|
||||
#define STACK_DIRECTION -1
|
||||
|
||||
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
|
||||
#define NW_THD_STACKSIZE 65536
|
||||
|
||||
/* On NetWare, to fix the problem with the deletion of open files */
|
||||
#define CANT_DELETE_OPEN_FILES 1
|
||||
|
||||
|
|
4
mysql-test/include/have_euckr.inc
Normal file
4
mysql-test/include/have_euckr.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- require r/have_euckr.require
|
||||
disable_query_log;
|
||||
show collation like "euckr_korean_ci";
|
||||
enable_query_log;
|
4
mysql-test/include/have_gb2312.inc
Normal file
4
mysql-test/include/have_gb2312.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- require r/have_gb2312.require
|
||||
disable_query_log;
|
||||
show collation like "gb2312_chinese_ci";
|
||||
enable_query_log;
|
167
mysql-test/r/ctype_euckr.result
Normal file
167
mysql-test/r/ctype_euckr.result
Normal file
|
@ -0,0 +1,167 @@
|
|||
drop table if exists t1;
|
||||
SET @test_character_set= 'euckr';
|
||||
SET @test_collation= 'euckr_korean_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) euckr_korean_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) euckr_korean_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET NAMES euckr;
|
||||
SET collation_connection='euckr_korean_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
euckr_korean_ci 6109
|
||||
euckr_korean_ci 61
|
||||
euckr_korean_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
euckr_korean_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
euckr_korean_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
SET collation_connection='euckr_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
euckr_bin 6109
|
||||
euckr_bin 61
|
||||
euckr_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
euckr_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
euckr_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
SET NAMES euckr;
|
||||
CREATE TABLE t1 (a text) character set euckr;
|
||||
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
hex(a)
|
||||
A2E6
|
||||
FEF7
|
||||
DROP TABLE t1;
|
167
mysql-test/r/ctype_gb2312.result
Normal file
167
mysql-test/r/ctype_gb2312.result
Normal file
|
@ -0,0 +1,167 @@
|
|||
drop table if exists t1;
|
||||
SET @test_character_set= 'gb2312';
|
||||
SET @test_collation= 'gb2312_chinese_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) gb2312_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) gb2312_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET NAMES gb2312;
|
||||
SET collation_connection='gb2312_chinese_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gb2312_chinese_ci 6109
|
||||
gb2312_chinese_ci 61
|
||||
gb2312_chinese_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gb2312_chinese_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gb2312_chinese_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
SET collation_connection='gb2312_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gb2312_bin 6109
|
||||
gb2312_bin 61
|
||||
gb2312_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gb2312_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gb2312_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
SET NAMES gb2312;
|
||||
CREATE TABLE t1 (a text) character set gb2312;
|
||||
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
hex(a)
|
||||
A2A1
|
||||
D7FE
|
||||
DROP TABLE t1;
|
|
@ -1058,6 +1058,14 @@ char(a)
|
|||
1
|
||||
2
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
|
||||
INSERT INTO t1 VALUES(REPEAT('a', 100));
|
||||
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
|
||||
SELECT LENGTH(bug) FROM t2;
|
||||
LENGTH(bug)
|
||||
100
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
|
||||
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
|
||||
SELECT id FROM t1;
|
||||
|
|
|
@ -865,6 +865,7 @@ select 1, min(a) from t1m where 1=99;
|
|||
1 NULL
|
||||
select 1, min(1) from t1m where a=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
|
@ -876,6 +877,7 @@ select 1, max(a) from t1m where 1=99;
|
|||
1 NULL
|
||||
select 1, max(1) from t1m where a=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
|
|
2
mysql-test/r/have_euckr.require
Normal file
2
mysql-test/r/have_euckr.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Collation Charset Id Default Compiled Sortlen
|
||||
euckr_korean_ci euckr 19 Yes Yes 1
|
2
mysql-test/r/have_gb2312.require
Normal file
2
mysql-test/r/have_gb2312.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Collation Charset Id Default Compiled Sortlen
|
||||
gb2312_chinese_ci gb2312 24 Yes Yes 1
|
|
@ -384,3 +384,21 @@ max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.ke
|
|||
8186
|
||||
set join_buffer_size= @save_join_buffer_size;
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (
|
||||
cola char(3) not null, colb char(3) not null, filler char(200),
|
||||
key(cola), key(colb)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
8704
|
||||
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
|
||||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
|
||||
drop table t1;
|
||||
|
|
|
@ -3337,6 +3337,30 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
create table t1 (f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
create table t2 (f2 int, f3 int, key(f2));
|
||||
insert into t2 values(1,1),(2,2);
|
||||
create table t3 (f4 int not null);
|
||||
insert into t3 values (2),(2),(2);
|
||||
select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
|
||||
f1 count
|
||||
1 0
|
||||
2 3
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (f1 int unique);
|
||||
create table t2 (f2 int unique);
|
||||
create table t3 (f3 int unique);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(2);
|
||||
insert into t3 values(1),(NULL);
|
||||
select * from t3 where f3 is null;
|
||||
f3
|
||||
NULL
|
||||
select t2.f2 from t1 left join t2 on f1=f2 join t3 on f1=f3 where f1=1;
|
||||
f2
|
||||
1
|
||||
drop table t1,t2,t3;
|
||||
create table t1(f1 char, f2 char not null);
|
||||
insert into t1 values(null,'a');
|
||||
create table t2 (f2 char not null);
|
||||
|
@ -3345,3 +3369,5 @@ select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
|
|||
f1 f2 f2
|
||||
NULL a NULL
|
||||
drop table t1,t2;
|
||||
select * from (select * left join t on f1=f2) tt;
|
||||
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 'on f1=f2) tt' at line 1
|
||||
|
|
|
@ -918,6 +918,11 @@ drop function if exists f5|
|
|||
drop function if exists f6|
|
||||
drop function if exists f7|
|
||||
drop function if exists f8|
|
||||
drop function if exists f9|
|
||||
drop function if exists f10|
|
||||
drop function if exists f11|
|
||||
drop function if exists f12_1|
|
||||
drop function if exists f12_2|
|
||||
drop view if exists v0|
|
||||
drop view if exists v1|
|
||||
drop view if exists v2|
|
||||
|
@ -1097,6 +1102,62 @@ ERROR HY000: Table 't1' was not locked with LOCK TABLES
|
|||
select f4()|
|
||||
ERROR HY000: Table 't2' was not locked with LOCK TABLES
|
||||
unlock tables|
|
||||
create function f9() returns int
|
||||
begin
|
||||
declare a, b int;
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
set a:= (select count(*) from t3);
|
||||
set b:= (select count(*) from t3 t3_alias);
|
||||
return a + b;
|
||||
end|
|
||||
select f9()|
|
||||
f9()
|
||||
6
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't3'
|
||||
select f9() from t1 limit 1|
|
||||
f9()
|
||||
6
|
||||
create function f10() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 select id from t4;
|
||||
return (select count(*) from t3);
|
||||
end|
|
||||
select f10()|
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
create table t4 as select 1 as id|
|
||||
select f10()|
|
||||
f10()
|
||||
1
|
||||
create function f11() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return (select count(*) from t3 as a, t3 as b);
|
||||
end|
|
||||
select f11()|
|
||||
ERROR HY000: Can't reopen table: 'a'
|
||||
select f11() from t1|
|
||||
ERROR HY000: Can't reopen table: 'a'
|
||||
create function f12_1() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return f12_2();
|
||||
end|
|
||||
create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
drop temporary table t3|
|
||||
select f12_1()|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
select f12_1() from t1 limit 1|
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
drop function f0|
|
||||
drop function f1|
|
||||
drop function f2|
|
||||
|
@ -1106,11 +1167,17 @@ drop function f5|
|
|||
drop function f6|
|
||||
drop function f7|
|
||||
drop function f8|
|
||||
drop function f9|
|
||||
drop function f10|
|
||||
drop function f11|
|
||||
drop function f12_1|
|
||||
drop function f12_2|
|
||||
drop view v0|
|
||||
drop view v1|
|
||||
drop view v2|
|
||||
delete from t1 |
|
||||
delete from t2 |
|
||||
drop table t4|
|
||||
drop table if exists fac|
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
||||
drop procedure if exists ifac|
|
||||
|
|
33
mysql-test/t/ctype_euckr.test
Normal file
33
mysql-test/t/ctype_euckr.test
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- source include/have_euckr.inc
|
||||
|
||||
#
|
||||
# Tests with the euckr character set
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
SET @test_character_set= 'euckr';
|
||||
SET @test_collation= 'euckr_korean_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
||||
SET NAMES euckr;
|
||||
SET collation_connection='euckr_korean_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_innodb_like.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
SET collation_connection='euckr_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_innodb_like.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
#
|
||||
# Bug#15377 Valid multibyte sequences are truncated on INSERT
|
||||
#
|
||||
SET NAMES euckr;
|
||||
CREATE TABLE t1 (a text) character set euckr;
|
||||
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
33
mysql-test/t/ctype_gb2312.test
Normal file
33
mysql-test/t/ctype_gb2312.test
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- source include/have_gb2312.inc
|
||||
|
||||
#
|
||||
# Tests with the gb2312 character set
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
SET @test_character_set= 'gb2312';
|
||||
SET @test_collation= 'gb2312_chinese_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
||||
SET NAMES gb2312;
|
||||
SET collation_connection='gb2312_chinese_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_innodb_like.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
SET collation_connection='gb2312_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_innodb_like.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
#
|
||||
# Bug#15377 Valid multibyte sequences are truncated on INSERT
|
||||
#
|
||||
SET NAMES gb2312;
|
||||
CREATE TABLE t1 (a text) character set gb2312;
|
||||
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
|
@ -868,6 +868,16 @@ set names utf8;
|
|||
select distinct char(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
|
||||
#
|
||||
CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
|
||||
INSERT INTO t1 VALUES(REPEAT('a', 100));
|
||||
CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
|
||||
SELECT LENGTH(bug) FROM t2;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -327,3 +327,33 @@ set join_buffer_size= @save_join_buffer_size;
|
|||
|
||||
drop table t0, t1, t2, t3, t4;
|
||||
|
||||
# BUG#16166
|
||||
CREATE TABLE t1 (
|
||||
cola char(3) not null, colb char(3) not null, filler char(200),
|
||||
key(cola), key(colb)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('foo','bar', 'ZZ'),('fuz','baz', 'ZZ');
|
||||
|
||||
--disable_query_log
|
||||
let $1=9;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT * from t1 WHERE cola = 'foo';
|
||||
dec $1;
|
||||
}
|
||||
|
||||
let $1=13;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 SELECT * from t1 WHERE cola <> 'foo';
|
||||
dec $1;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
|
||||
OPTIMIZE TABLE t1;
|
||||
select count(*) from t1;
|
||||
explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
|
||||
explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar';
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -2806,6 +2806,33 @@ EXPLAIN SELECT t2.key_a,foo
|
|||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug#15347 Wrong result of subselect when records cache and set functions
|
||||
# are involved
|
||||
#
|
||||
create table t1 (f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
create table t2 (f2 int, f3 int, key(f2));
|
||||
insert into t2 values(1,1),(2,2);
|
||||
create table t3 (f4 int not null);
|
||||
insert into t3 values (2),(2),(2);
|
||||
select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #15633 Evaluation of Item_equal for non-const table caused wrong
|
||||
# select result
|
||||
#
|
||||
create table t1 (f1 int unique);
|
||||
create table t2 (f2 int unique);
|
||||
create table t3 (f3 int unique);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(2);
|
||||
insert into t3 values(1),(NULL);
|
||||
select * from t3 where f3 is null;
|
||||
select t2.f2 from t1 left join t2 on f1=f2 join t3 on f1=f3 where f1=1;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug#15268 Unchecked null value caused server crash
|
||||
#
|
||||
|
@ -2815,3 +2842,9 @@ create table t2 (f2 char not null);
|
|||
insert into t2 values('b');
|
||||
select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#15538 unchecked table absense caused server crash.
|
||||
#
|
||||
--error 1064
|
||||
select * from (select * left join t on f1=f2) tt;
|
||||
|
|
|
@ -1157,6 +1157,11 @@ drop function if exists f5|
|
|||
drop function if exists f6|
|
||||
drop function if exists f7|
|
||||
drop function if exists f8|
|
||||
drop function if exists f9|
|
||||
drop function if exists f10|
|
||||
drop function if exists f11|
|
||||
drop function if exists f12_1|
|
||||
drop function if exists f12_2|
|
||||
drop view if exists v0|
|
||||
drop view if exists v1|
|
||||
drop view if exists v2|
|
||||
|
@ -1234,8 +1239,6 @@ create function f7() returns int
|
|||
select f6()|
|
||||
select id, f6() from t1|
|
||||
|
||||
# TODO Test temporary table handling
|
||||
|
||||
#
|
||||
# Let us test how new locking work with views
|
||||
#
|
||||
|
@ -1316,6 +1319,73 @@ select * from v1, t1|
|
|||
select f4()|
|
||||
unlock tables|
|
||||
|
||||
# Tests for handling of temporary tables in functions.
|
||||
#
|
||||
# Unlike for permanent tables we should be able to create, use
|
||||
# and drop such tables in functions.
|
||||
#
|
||||
# Simplest function using temporary table. It is also test case for bug
|
||||
# #12198 "Temporary table aliasing does not work inside stored functions"
|
||||
create function f9() returns int
|
||||
begin
|
||||
declare a, b int;
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
set a:= (select count(*) from t3);
|
||||
set b:= (select count(*) from t3 t3_alias);
|
||||
return a + b;
|
||||
end|
|
||||
# This will emit warning as t3 was not existing before.
|
||||
select f9()|
|
||||
select f9() from t1 limit 1|
|
||||
|
||||
# Function which uses both temporary and permanent tables.
|
||||
create function f10() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 select id from t4;
|
||||
return (select count(*) from t3);
|
||||
end|
|
||||
# Check that we don't ignore completely tables used in function
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f10()|
|
||||
create table t4 as select 1 as id|
|
||||
select f10()|
|
||||
|
||||
# Practical cases which we don't handle well (yet)
|
||||
#
|
||||
# Function which does not work because of well-known and documented
|
||||
# limitation of MySQL. We can't use the several instances of the
|
||||
# same temporary table in statement.
|
||||
create function f11() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return (select count(*) from t3 as a, t3 as b);
|
||||
end|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select f11()|
|
||||
--error ER_CANT_REOPEN_TABLE
|
||||
select f11() from t1|
|
||||
# We don't handle temporary tables used by nested functions well
|
||||
create function f12_1() returns int
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int);
|
||||
insert into t3 values (1), (2), (3);
|
||||
return f12_2();
|
||||
end|
|
||||
create function f12_2() returns int
|
||||
return (select count(*) from t3)|
|
||||
# We need clean start to get error
|
||||
drop temporary table t3|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1()|
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select f12_1() from t1 limit 1|
|
||||
|
||||
# Cleanup
|
||||
drop function f0|
|
||||
|
@ -1327,11 +1397,17 @@ drop function f5|
|
|||
drop function f6|
|
||||
drop function f7|
|
||||
drop function f8|
|
||||
drop function f9|
|
||||
drop function f10|
|
||||
drop function f11|
|
||||
drop function f12_1|
|
||||
drop function f12_2|
|
||||
drop view v0|
|
||||
drop view v1|
|
||||
drop view v2|
|
||||
delete from t1 |
|
||||
delete from t2 |
|
||||
drop table t4|
|
||||
|
||||
# End of non-bug tests
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ make
|
|||
cp extra/comp_err extra/comp_err.linux
|
||||
cp libmysql/conf_to_src libmysql/conf_to_src.linux
|
||||
#cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux
|
||||
cp sql/gen_lex_hash sql/gen_lex_hash.linux
|
||||
cp sql/.libs/gen_lex_hash sql/gen_lex_hash.linux
|
||||
cp strings/conf_to_src strings/conf_to_src.linux
|
||||
|
||||
# Delete mysql_version.h
|
||||
|
|
|
@ -258,11 +258,11 @@ void finish_defaults()
|
|||
void read_defaults(arg_list_t *pal)
|
||||
{
|
||||
arg_list_t al;
|
||||
char defaults_file[PATH_MAX];
|
||||
char defaults_file[PATH_MAX];
|
||||
char mydefaults[PATH_MAX];
|
||||
char line[PATH_MAX];
|
||||
FILE *fp;
|
||||
|
||||
|
||||
// defaults output file
|
||||
snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir);
|
||||
remove(defaults_file);
|
||||
|
@ -270,7 +270,7 @@ void read_defaults(arg_list_t *pal)
|
|||
// mysqladmin file
|
||||
snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir);
|
||||
|
||||
// args
|
||||
// args
|
||||
init_args(&al);
|
||||
add_arg(&al, mydefaults);
|
||||
if (default_option[0])
|
||||
|
@ -279,11 +279,11 @@ void read_defaults(arg_list_t *pal)
|
|||
add_arg(&al, "server");
|
||||
add_arg(&al, "mysqld_safe");
|
||||
add_arg(&al, "safe_mysqld");
|
||||
|
||||
|
||||
spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL);
|
||||
|
||||
|
||||
free_args(&al);
|
||||
|
||||
|
||||
// gather defaults
|
||||
if ((fp= fopen(defaults_file, "r")) != NULL)
|
||||
{
|
||||
|
|
|
@ -9068,11 +9068,11 @@ uint32 Field_blob::max_length()
|
|||
switch (packlength)
|
||||
{
|
||||
case 1:
|
||||
return 255;
|
||||
return 255 * field_charset->mbmaxlen;
|
||||
case 2:
|
||||
return 65535;
|
||||
return 65535 * field_charset->mbmaxlen;
|
||||
case 3:
|
||||
return 16777215;
|
||||
return 16777215 * field_charset->mbmaxlen;
|
||||
case 4:
|
||||
return (uint32) 4294967295U;
|
||||
default:
|
||||
|
|
|
@ -3765,6 +3765,7 @@ void Item_equal::update_used_tables()
|
|||
|
||||
longlong Item_equal::val_int()
|
||||
{
|
||||
Item_field *item_field;
|
||||
if (cond_false)
|
||||
return 0;
|
||||
List_iterator_fast<Item_field> it(fields);
|
||||
|
@ -3772,10 +3773,14 @@ longlong Item_equal::val_int()
|
|||
if ((null_value= item->null_value))
|
||||
return 0;
|
||||
eval_item->store_value(item);
|
||||
while ((item= it++))
|
||||
while ((item_field= it++))
|
||||
{
|
||||
if ((null_value= item->null_value) || eval_item->cmp(item))
|
||||
return 0;
|
||||
/* Skip fields of non-const tables. They haven't been read yet */
|
||||
if (item_field->field->table->const_table)
|
||||
{
|
||||
if ((null_value= item_field->null_value) || eval_item->cmp(item_field))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1150,6 +1150,11 @@ public:
|
|||
are deleted in the end of execution. All changes made to these
|
||||
objects need not be registered in the list of changes of the parse
|
||||
tree and do not harm PS/SP re-execution.
|
||||
|
||||
Item equal objects are employed only at the optimize phase. Usually they are
|
||||
not supposed to be evaluated. Yet in some cases we call the method val_int()
|
||||
for them. We have to take care of restricting the predicate such an
|
||||
object represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.
|
||||
*/
|
||||
|
||||
class Item_equal: public Item_bool_func
|
||||
|
|
|
@ -3493,6 +3493,11 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
/* Increasing stacksize of threads on NetWare */
|
||||
|
||||
pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE);
|
||||
#endif
|
||||
|
||||
(void) thr_setconcurrency(concurrency); // 10 by default
|
||||
|
||||
|
|
|
@ -3146,7 +3146,14 @@ sp_restore_security_context(THD *thd, Security_context *backup)
|
|||
|
||||
typedef struct st_sp_table
|
||||
{
|
||||
LEX_STRING qname; /* Multi-set key: db_name\0table_name\0alias\0 */
|
||||
/*
|
||||
Multi-set key:
|
||||
db_name\0table_name\0alias\0 - for normal tables
|
||||
db_name\0table_name\0 - for temporary tables
|
||||
Note that in both cases we don't take last '\0' into account when
|
||||
we count length of key.
|
||||
*/
|
||||
LEX_STRING qname;
|
||||
uint db_length, table_name_length;
|
||||
bool temp; /* true if corresponds to a temporary table */
|
||||
thr_lock_type lock_type; /* lock type used for prelocking */
|
||||
|
@ -3216,10 +3223,14 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
|
|||
tname[tlen]= '\0';
|
||||
|
||||
/*
|
||||
It is safe to store pointer to table list elements in hash,
|
||||
since they are supposed to have the same lifetime.
|
||||
We ignore alias when we check if table was already marked as temporary
|
||||
(and therefore should not be prelocked). Otherwise we will erroneously
|
||||
treat table with same name but with different alias as non-temporary.
|
||||
*/
|
||||
if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname, tlen)))
|
||||
if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname, tlen)) ||
|
||||
((tab= (SP_TABLE *)hash_search(&m_sptabs, (byte *)tname,
|
||||
tlen - alen - 1)) &&
|
||||
tab->temp))
|
||||
{
|
||||
if (tab->lock_type < table->lock_type)
|
||||
tab->lock_type= table->lock_type; // Use the table with the highest lock type
|
||||
|
@ -3231,14 +3242,18 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
|
|||
{
|
||||
if (!(tab= (SP_TABLE *)thd->calloc(sizeof(SP_TABLE))))
|
||||
return FALSE;
|
||||
tab->qname.length= tlen;
|
||||
tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);
|
||||
if (!tab->qname.str)
|
||||
return FALSE;
|
||||
if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE &&
|
||||
lex_for_tmp_check->query_tables == table &&
|
||||
lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
||||
{
|
||||
tab->temp= TRUE;
|
||||
tab->qname.length= tlen - alen - 1;
|
||||
}
|
||||
else
|
||||
tab->qname.length= tlen;
|
||||
tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);
|
||||
if (!tab->qname.str)
|
||||
return FALSE;
|
||||
tab->table_name_length= table->table_name_length;
|
||||
tab->db_length= table->db_length;
|
||||
tab->lock_type= table->lock_type;
|
||||
|
|
|
@ -2083,8 +2083,10 @@ static bool reopen_table(TABLE *table)
|
|||
(*field)->table_name= &table->alias;
|
||||
}
|
||||
for (key=0 ; key < table->s->keys ; key++)
|
||||
{
|
||||
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
|
||||
table->key_info[key].key_part[part].field->table= table;
|
||||
}
|
||||
if (table->triggers)
|
||||
table->triggers->set_table(table);
|
||||
|
||||
|
|
|
@ -424,7 +424,11 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
|||
|
||||
if (cond && ((!cond->fixed &&
|
||||
cond->fix_fields(thd, &cond)) || cond->check_cols(1)))
|
||||
{
|
||||
if (table->query_id != thd->query_id)
|
||||
cond->cleanup(); // File was reopened
|
||||
goto err0;
|
||||
}
|
||||
|
||||
if (keyname)
|
||||
{
|
||||
|
|
|
@ -3508,13 +3508,32 @@ best_access_path(JOIN *join,
|
|||
parts of the row from any of the used index.
|
||||
This is because table scans uses index and we would not win
|
||||
anything by using a table scan.
|
||||
|
||||
A word for word translation of the below if-statement in psergey's
|
||||
understanding: we check if we should use table scan if:
|
||||
(1) The found 'ref' access produces more records than a table scan
|
||||
(or index scan, or quick select), or 'ref' is more expensive than
|
||||
any of them.
|
||||
(2) This doesn't hold: the best way to perform table scan is to to perform
|
||||
'range' access using index IDX, and the best way to perform 'ref'
|
||||
access is to use the same index IDX, with the same or more key parts.
|
||||
(note: it is not clear how this rule is/should be extended to
|
||||
index_merge quick selects)
|
||||
(3) See above note about InnoDB.
|
||||
(4) NOT ("FORCE INDEX(...)" is used for table and there is 'ref' access
|
||||
path, but there is no quick select)
|
||||
If the condition in the above brackets holds, then the only possible
|
||||
"table scan" access method is ALL/index (there is no quick select).
|
||||
Since we have a 'ref' access path, and FORCE INDEX instructs us to
|
||||
choose it over ALL/index, there is no need to consider a full table
|
||||
scan.
|
||||
*/
|
||||
if ((records >= s->found_records || best > s->read_time) &&
|
||||
!(s->quick && best_key && s->quick->index == best_key->key &&
|
||||
best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&
|
||||
!((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) &&
|
||||
! s->table->used_keys.is_clear_all() && best_key) &&
|
||||
!(s->table->force_index && best_key))
|
||||
if ((records >= s->found_records || best > s->read_time) && // (1)
|
||||
!(s->quick && best_key && s->quick->index == best_key->key && // (2)
|
||||
best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&// (2)
|
||||
!((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) && // (3)
|
||||
! s->table->used_keys.is_clear_all() && best_key) && // (3)
|
||||
!(s->table->force_index && best_key && !s->quick)) // (4)
|
||||
{ // Check full join
|
||||
ha_rows rnd_records= s->found_records;
|
||||
/*
|
||||
|
@ -4497,13 +4516,15 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
|
|||
parts of the row from any of the used index.
|
||||
This is because table scans uses index and we would not win
|
||||
anything by using a table scan.
|
||||
(see comment in best_access_path() for more details on the below
|
||||
condition)
|
||||
*/
|
||||
if ((records >= s->found_records || best > s->read_time) &&
|
||||
!(s->quick && best_key && s->quick->index == best_key->key &&
|
||||
best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&
|
||||
!((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) &&
|
||||
! s->table->used_keys.is_clear_all() && best_key) &&
|
||||
!(s->table->force_index && best_key))
|
||||
!(s->table->force_index && best_key && !s->quick))
|
||||
{ // Check full join
|
||||
ha_rows rnd_records= s->found_records;
|
||||
/*
|
||||
|
@ -8651,6 +8672,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
have null
|
||||
*/
|
||||
hidden_null_count=null_count;
|
||||
/*
|
||||
We need to update hidden_field_count as we may have stored group
|
||||
functions with constant arguments
|
||||
*/
|
||||
param->hidden_field_count= (uint) (reg_field - table->field);
|
||||
null_count= 0;
|
||||
}
|
||||
}
|
||||
|
@ -8872,7 +8898,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
}
|
||||
}
|
||||
|
||||
if (distinct)
|
||||
if (distinct && field_count != param->hidden_field_count)
|
||||
{
|
||||
/*
|
||||
Create an unique key or an unique constraint over all columns
|
||||
|
@ -9938,6 +9964,7 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
|
|||
int error;
|
||||
READ_RECORD *info;
|
||||
|
||||
join_tab->table->null_row= 0;
|
||||
if (!join_tab->cache.records)
|
||||
return NESTED_LOOP_OK; /* Nothing to do */
|
||||
if (skip_last)
|
||||
|
|
|
@ -2734,12 +2734,15 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
|
|||
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
|
||||
field->real_type() == MYSQL_TYPE_STRING) // For binary type
|
||||
{
|
||||
uint32 octet_max_length= field->max_length();
|
||||
if (octet_max_length != (uint32) 4294967295U)
|
||||
octet_max_length /= field->charset()->mbmaxlen;
|
||||
longlong char_max_len= is_blob ?
|
||||
(longlong) field->max_length() / field->charset()->mbminlen :
|
||||
(longlong) field->max_length() / field->charset()->mbmaxlen;
|
||||
(longlong) octet_max_length / field->charset()->mbminlen :
|
||||
(longlong) octet_max_length / field->charset()->mbmaxlen;
|
||||
table->field[8]->store(char_max_len, TRUE);
|
||||
table->field[8]->set_notnull();
|
||||
table->field[9]->store((longlong) field->max_length(), TRUE);
|
||||
table->field[9]->store((longlong) octet_max_length, TRUE);
|
||||
table->field[9]->set_notnull();
|
||||
}
|
||||
|
||||
|
|
|
@ -6710,13 +6710,13 @@ join_table:
|
|||
| table_ref LEFT opt_outer JOIN_SYM table_ref
|
||||
ON
|
||||
{
|
||||
YYERROR_UNLESS($1 && $5);
|
||||
/* Change the current name resolution context to a local context. */
|
||||
if (push_new_name_resolution_context(YYTHD, $1, $5))
|
||||
YYABORT;
|
||||
}
|
||||
expr
|
||||
{
|
||||
YYERROR_UNLESS($1 && $5);
|
||||
add_join_on($5,$8);
|
||||
Lex->pop_context();
|
||||
$5->outer_join|=JOIN_TYPE_LEFT;
|
||||
|
@ -6741,6 +6741,7 @@ join_table:
|
|||
| table_ref RIGHT opt_outer JOIN_SYM table_ref
|
||||
ON
|
||||
{
|
||||
YYERROR_UNLESS($1 && $5);
|
||||
/* Change the current name resolution context to a local context. */
|
||||
if (push_new_name_resolution_context(YYTHD, $1, $5))
|
||||
YYABORT;
|
||||
|
@ -6748,7 +6749,6 @@ join_table:
|
|||
expr
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
YYERROR_UNLESS($1 && $5);
|
||||
if (!($$= lex->current_select->convert_right_join()))
|
||||
YYABORT;
|
||||
add_join_on($$, $8);
|
||||
|
|
|
@ -147,6 +147,15 @@ os_thread_create(
|
|||
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
#ifdef __NETWARE__
|
||||
ret = pthread_attr_setstacksize(&attr,
|
||||
(size_t) NW_THD_STACKSIZE);
|
||||
if (ret) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
os_mutex_enter(os_sync_mutex);
|
||||
os_thread_count++;
|
||||
|
|
|
@ -8635,6 +8635,41 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Returns well formed length of a EUC-KR string.
|
||||
*/
|
||||
static uint
|
||||
my_well_formed_len_euckr(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const char *b0= b;
|
||||
const char *emb= e - 1; /* Last possible end of an MB character */
|
||||
|
||||
*error= 0;
|
||||
while (pos-- && b < e)
|
||||
{
|
||||
if ((uchar) b[0] < 128)
|
||||
{
|
||||
/* Single byte ascii character */
|
||||
b++;
|
||||
}
|
||||
else if (b < emb && iseuc_kr(*b) && iseuc_kr(b[1]))
|
||||
{
|
||||
/* Double byte character */
|
||||
b+= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wrong byte sequence */
|
||||
*error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (uint) (b - b0);
|
||||
}
|
||||
|
||||
|
||||
static MY_COLLATION_HANDLER my_collation_ci_handler =
|
||||
{
|
||||
NULL, /* init */
|
||||
|
@ -8657,7 +8692,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
|
|||
mbcharlen_euc_kr,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
my_well_formed_len_mb,
|
||||
my_well_formed_len_euckr,
|
||||
my_lengthsp_8bit,
|
||||
my_numcells_8bit,
|
||||
my_mb_wc_euc_kr, /* mb_wc */
|
||||
|
|
|
@ -5686,6 +5686,41 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Returns well formed length of a EUC-KR string.
|
||||
*/
|
||||
static uint
|
||||
my_well_formed_len_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b, const char *e,
|
||||
uint pos, int *error)
|
||||
{
|
||||
const char *b0= b;
|
||||
const char *emb= e - 1; /* Last possible end of an MB character */
|
||||
|
||||
*error= 0;
|
||||
while (pos-- && b < e)
|
||||
{
|
||||
if ((uchar) b[0] < 128)
|
||||
{
|
||||
/* Single byte ascii character */
|
||||
b++;
|
||||
}
|
||||
else if (b < emb && isgb2312head(*b) && isgb2312tail(b[1]))
|
||||
{
|
||||
/* Double byte character */
|
||||
b+= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wrong byte sequence */
|
||||
*error= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (uint) (b - b0);
|
||||
}
|
||||
|
||||
|
||||
static MY_COLLATION_HANDLER my_collation_ci_handler =
|
||||
{
|
||||
NULL, /* init */
|
||||
|
@ -5708,7 +5743,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
|
|||
mbcharlen_gb2312,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
my_well_formed_len_mb,
|
||||
my_well_formed_len_gb2312,
|
||||
my_lengthsp_8bit,
|
||||
my_numcells_8bit,
|
||||
my_mb_wc_gb2312, /* mb_wc */
|
||||
|
|
Loading…
Reference in a new issue