mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
This commit is contained in:
@@ -2117,6 +2117,17 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
||||
if (!mysql_num_rows(result) && ! quick && !info_flag)
|
||||
{
|
||||
strmov(buff, "Empty set");
|
||||
if (opt_xml)
|
||||
{
|
||||
/*
|
||||
We must print XML header and footer
|
||||
to produce a well-formed XML even if
|
||||
the result set is empty (Bug#27608).
|
||||
*/
|
||||
init_pager();
|
||||
print_table_data_xml(result);
|
||||
end_pager();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -71,4 +71,18 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
||||
<field name="NULL" xsi:nil="true" />
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 limit 0
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
|
||||
--------------
|
||||
select 1 limit 0
|
||||
--------------
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 limit 0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
|
||||
Empty set
|
||||
|
||||
Bye
|
||||
drop table t1;
|
||||
|
@@ -1480,6 +1480,49 @@ aa
|
||||
xxx
|
||||
yyy
|
||||
DROP TABLE t1;
|
||||
create table t1 (
|
||||
a varchar(26) not null
|
||||
) default character set utf8;
|
||||
insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
|
||||
select * from t1;
|
||||
a
|
||||
abcdefghijklmnopqrstuvwxyz
|
||||
alter table t1 change a a varchar(20) character set utf8 not null;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
abcdefghijklmnopqrst
|
||||
alter table t1 change a a char(15) character set utf8 not null;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
abcdefghijklmno
|
||||
alter table t1 change a a char(10) character set utf8 not null;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
abcdefghij
|
||||
alter table t1 change a a varchar(5) character set utf8 not null;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select * from t1;
|
||||
a
|
||||
abcde
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(4000) not null
|
||||
) default character set utf8;
|
||||
insert into t1 values (repeat('a',4000));
|
||||
alter table t1 change a a varchar(3000) character set utf8 not null;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
select length(a) from t1;
|
||||
length(a)
|
||||
3000
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
select hex(char(1 using utf8));
|
||||
hex(char(1 using utf8))
|
||||
|
@@ -1992,4 +1992,73 @@ abc
|
||||
SELECT INSERT('abc', 6, 3, '1234');
|
||||
INSERT('abc', 6, 3, '1234')
|
||||
abc
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1;
|
||||
CRC32(a) COUNT(*)
|
||||
450215437 1
|
||||
498629140 1
|
||||
1790921346 1
|
||||
1842515611 1
|
||||
2212294583 1
|
||||
2226203566 1
|
||||
2366072709 1
|
||||
2707236321 1
|
||||
4088798008 1
|
||||
4194326291 1
|
||||
SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1;
|
||||
CRC32(a) COUNT(*)
|
||||
450215437 1
|
||||
498629140 1
|
||||
1790921346 1
|
||||
1842515611 1
|
||||
2212294583 1
|
||||
2226203566 1
|
||||
2366072709 1
|
||||
2707236321 1
|
||||
4088798008 1
|
||||
4194326291 1
|
||||
SELECT * FROM (SELECT CRC32(a) FROM t1) t2;
|
||||
CRC32(a)
|
||||
2212294583
|
||||
450215437
|
||||
1842515611
|
||||
4088798008
|
||||
2226203566
|
||||
498629140
|
||||
1790921346
|
||||
4194326291
|
||||
2366072709
|
||||
2707236321
|
||||
CREATE TABLE t2 SELECT CRC32(a) FROM t1;
|
||||
desc t2;
|
||||
Field Type Null Key Default Extra
|
||||
CRC32(a) int(10) unsigned YES NULL
|
||||
SELECT * FROM v1;
|
||||
C
|
||||
2212294583
|
||||
450215437
|
||||
1842515611
|
||||
4088798008
|
||||
2226203566
|
||||
498629140
|
||||
1790921346
|
||||
4194326291
|
||||
2366072709
|
||||
2707236321
|
||||
SELECT * FROM (SELECT * FROM v1) x;
|
||||
C
|
||||
2212294583
|
||||
450215437
|
||||
1842515611
|
||||
4088798008
|
||||
2226203566
|
||||
498629140
|
||||
1790921346
|
||||
4194326291
|
||||
2366072709
|
||||
2707236321
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
End of 5.0 tests
|
||||
|
@@ -414,3 +414,44 @@ a int(11) NO PRI
|
||||
b varchar(20) NO MUL
|
||||
c varchar(20) NO
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a INTEGER auto_increment PRIMARY KEY,
|
||||
b INTEGER NOT NULL,
|
||||
c INTEGER NOT NULL,
|
||||
d CHAR(64)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
a INTEGER auto_increment PRIMARY KEY,
|
||||
b INTEGER NOT NULL,
|
||||
c SMALLINT NOT NULL,
|
||||
d DATETIME NOT NULL,
|
||||
e SMALLINT NOT NULL,
|
||||
f INTEGER NOT NULL,
|
||||
g INTEGER NOT NULL,
|
||||
h SMALLINT NOT NULL,
|
||||
i INTEGER NOT NULL,
|
||||
j INTEGER NOT NULL,
|
||||
UNIQUE INDEX (b),
|
||||
INDEX (b, d, e, f, g, h, i, j, c),
|
||||
INDEX (c)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
(NULL, 1, 254, '1000-01-01 00:00:00', 257, 0, 0, 0, 0, 0),
|
||||
(NULL, 2, 1, '2004-11-30 12:00:00', 1, 0, 0, 0, 0, 0),
|
||||
(NULL, 3, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -21600, 0),
|
||||
(NULL, 4, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -10800, 0),
|
||||
(NULL, 5, 1, '2004-11-30 12:00:00', 1, 0, 0, 5, -10800, 0),
|
||||
(NULL, 6, 1, '2004-11-30 12:00:00', 102, 0, 0, 0, 0, 0),
|
||||
(NULL, 7, 1, '2004-11-30 12:00:00', 105, 2, 0, 0, 0, 0),
|
||||
(NULL, 8, 1, '2004-11-30 12:00:00', 105, 10, 0, 0, 0, 0);
|
||||
INSERT INTO t1 (b, c, d) VALUES
|
||||
(3388000, -553000, NULL),
|
||||
(3388000, -553000, NULL);
|
||||
SELECT *
|
||||
FROM t2 c JOIN t1 pa ON c.b = pa.a
|
||||
WHERE c.c = 1
|
||||
ORDER BY c.b, c.d
|
||||
;
|
||||
a b c d e f g h i j a b c d
|
||||
2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
|
||||
DROP TABLE t1, t2;
|
||||
|
@@ -193,6 +193,103 @@ SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
CREATE TABLE t1(a int, b int, c int);
|
||||
INSERT INTO t1 VALUES (1, 2, 3),
|
||||
(NULL, 2, 3 ), (1, NULL, 3 ), (1, 2, NULL),
|
||||
(NULL, 2, 3+1), (1, NULL, 3+1), (1, 2+1, NULL),
|
||||
(NULL, 2, 3-1), (1, NULL, 3-1), (1, 2-1, NULL);
|
||||
SELECT (1,2,3) = (1, NULL, 3);
|
||||
(1,2,3) = (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) = (1+1, NULL, 3);
|
||||
(1,2,3) = (1+1, NULL, 3)
|
||||
0
|
||||
SELECT (1,2,3) = (1, NULL, 3+1);
|
||||
(1,2,3) = (1, NULL, 3+1)
|
||||
0
|
||||
SELECT * FROM t1 WHERE (a,b,c) = (1,2,3);
|
||||
a b c
|
||||
1 2 3
|
||||
SELECT (1,2,3) <> (1, NULL, 3);
|
||||
(1,2,3) <> (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) <> (1+1, NULL, 3);
|
||||
(1,2,3) <> (1+1, NULL, 3)
|
||||
1
|
||||
SELECT (1,2,3) <> (1, NULL, 3+1);
|
||||
(1,2,3) <> (1, NULL, 3+1)
|
||||
1
|
||||
SELECT * FROM t1 WHERE (a,b,c) <> (1,2,3);
|
||||
a b c
|
||||
NULL 2 4
|
||||
1 NULL 4
|
||||
1 3 NULL
|
||||
NULL 2 2
|
||||
1 NULL 2
|
||||
1 1 NULL
|
||||
SELECT (1,2,3) < (NULL, 2, 3);
|
||||
(1,2,3) < (NULL, 2, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) < (1, NULL, 3);
|
||||
(1,2,3) < (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) < (1-1, NULL, 3);
|
||||
(1,2,3) < (1-1, NULL, 3)
|
||||
0
|
||||
SELECT (1,2,3) < (1+1, NULL, 3);
|
||||
(1,2,3) < (1+1, NULL, 3)
|
||||
1
|
||||
SELECT * FROM t1 WHERE (a,b,c) < (1,2,3);
|
||||
a b c
|
||||
1 1 NULL
|
||||
SELECT (1,2,3) <= (NULL, 2, 3);
|
||||
(1,2,3) <= (NULL, 2, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) <= (1, NULL, 3);
|
||||
(1,2,3) <= (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) <= (1-1, NULL, 3);
|
||||
(1,2,3) <= (1-1, NULL, 3)
|
||||
0
|
||||
SELECT (1,2,3) <= (1+1, NULL, 3);
|
||||
(1,2,3) <= (1+1, NULL, 3)
|
||||
1
|
||||
SELECT * FROM t1 WHERE (a,b,c) <= (1,2,3);
|
||||
a b c
|
||||
1 2 3
|
||||
1 1 NULL
|
||||
SELECT (1,2,3) > (NULL, 2, 3);
|
||||
(1,2,3) > (NULL, 2, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) > (1, NULL, 3);
|
||||
(1,2,3) > (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) > (1-1, NULL, 3);
|
||||
(1,2,3) > (1-1, NULL, 3)
|
||||
1
|
||||
SELECT (1,2,3) > (1+1, NULL, 3);
|
||||
(1,2,3) > (1+1, NULL, 3)
|
||||
0
|
||||
SELECT * FROM t1 WHERE (a,b,c) > (1,2,3);
|
||||
a b c
|
||||
1 3 NULL
|
||||
SELECT (1,2,3) >= (NULL, 2, 3);
|
||||
(1,2,3) >= (NULL, 2, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) >= (1, NULL, 3);
|
||||
(1,2,3) >= (1, NULL, 3)
|
||||
NULL
|
||||
SELECT (1,2,3) >= (1-1, NULL, 3);
|
||||
(1,2,3) >= (1-1, NULL, 3)
|
||||
1
|
||||
SELECT (1,2,3) >= (1+1, NULL, 3);
|
||||
(1,2,3) >= (1+1, NULL, 3)
|
||||
0
|
||||
SELECT * FROM t1 WHERE (a,b,c) >= (1,2,3);
|
||||
a b c
|
||||
1 2 3
|
||||
1 3 NULL
|
||||
DROP TABLE t1;
|
||||
SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
|
||||
1 0 0 0 null
|
||||
1 0 0 0 NULL
|
||||
|
1
mysql-test/r/rpl_critical_errors.result
Normal file
1
mysql-test/r/rpl_critical_errors.result
Normal file
@@ -0,0 +1 @@
|
||||
Turn on parsing to run this test
|
56
mysql-test/r/rpl_critical_errors.result.txt
Normal file
56
mysql-test/r/rpl_critical_errors.result.txt
Normal file
@@ -0,0 +1,56 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
|
||||
INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
KILL QUERY 2;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
COUNT(*)
|
||||
0
|
||||
SHOW SLAVE STATUS;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos #
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running Yes
|
||||
Slave_SQL_Running No
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 1317
|
||||
Last_Error #
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos #
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
@@ -6068,6 +6068,56 @@ select bug20777(18446744073709551613)+1;
|
||||
bug20777(18446744073709551613)+1
|
||||
18446744073709551614
|
||||
drop function bug20777;
|
||||
DROP FUNCTION IF EXISTS bug5274_f1|
|
||||
DROP FUNCTION IF EXISTS bug5274_f2|
|
||||
CREATE FUNCTION bug5274_f1(p1 CHAR) RETURNS CHAR
|
||||
RETURN CONCAT(p1, p1)|
|
||||
CREATE FUNCTION bug5274_f2() RETURNS CHAR
|
||||
BEGIN
|
||||
DECLARE v1 INT DEFAULT 0;
|
||||
DECLARE v2 CHAR DEFAULT 'x';
|
||||
WHILE v1 < 30 DO
|
||||
SET v1 = v1 + 1;
|
||||
SET v2 = bug5274_f1(v2);
|
||||
END WHILE;
|
||||
RETURN v2;
|
||||
END|
|
||||
SELECT bug5274_f2()|
|
||||
bug5274_f2()
|
||||
x
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
|
||||
DROP FUNCTION bug5274_f1|
|
||||
DROP FUNCTION bug5274_f2|
|
||||
End of 5.0 tests.
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
|
||||
|
@@ -692,3 +692,22 @@ a MAX(b) test
|
||||
2 3 h
|
||||
3 4 i
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int, PRIMARY KEY(b));
|
||||
INSERT INTO t1 VALUES (1), (NULL), (4);
|
||||
INSERT INTO t2 VALUES (3), (1),(2), (5), (4), (7), (6);
|
||||
EXPLAIN EXTENDED
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`b` = `test`.`t1`.`a`) and (not(<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` where ((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`a`) or isnull(`test`.`t1`.`a`)) having <is_not_null_test>(`test`.`t1`.`a`))))))
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
a
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
a
|
||||
1
|
||||
4
|
||||
DROP TABLE t1,t2;
|
||||
|
@@ -637,6 +637,37 @@ set lc_time_names=0;
|
||||
select @@lc_time_names;
|
||||
@@lc_time_names
|
||||
en_US
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
en_US en_US
|
||||
set @@global.lc_time_names=fr_FR;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
fr_FR en_US
|
||||
New connection
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
fr_FR fr_FR
|
||||
set @@lc_time_names=ru_RU;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
fr_FR ru_RU
|
||||
Returnung to default connection
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
fr_FR en_US
|
||||
set lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
fr_FR fr_FR
|
||||
set @@global.lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
en_US fr_FR
|
||||
set @@lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
@@global.lc_time_names @@lc_time_names
|
||||
en_US en_US
|
||||
set @test = @@query_prealloc_size;
|
||||
set @@query_prealloc_size = @test;
|
||||
select @@query_prealloc_size = @test;
|
||||
|
@@ -3319,4 +3319,39 @@ lgid clid
|
||||
2 YES
|
||||
DROP VIEW v1;
|
||||
DROP table t1,t2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
|
||||
SELECT * FROM t1 UNION SELECT * FROM v1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
2 UNION t1 ALL NULL NULL NULL NULL 3
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
SELECT * FROM v1 UNION SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
EXPLAIN SELECT * FROM v1 UNION SELECT * FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
2 UNION t1 ALL NULL NULL NULL NULL 3
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
|
||||
SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
|
||||
2 UNION t1 ALL NULL NULL NULL NULL 3
|
||||
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@@ -17,5 +17,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
|
||||
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
|
||||
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
|
||||
--exec $MYSQL --xml test -e "select null from dual"
|
||||
--exec $MYSQL --xml test -e "select 1 limit 0"
|
||||
--exec $MYSQL --xml test -vv -e "select 1 limit 0"
|
||||
|
||||
drop table t1;
|
||||
|
@@ -1192,6 +1192,41 @@ SELECT DISTINCT id FROM t1 ORDER BY id;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#20095 Changing length of VARCHAR field with UTF8
|
||||
# collation does not truncate values
|
||||
#
|
||||
create table t1 (
|
||||
a varchar(26) not null
|
||||
) default character set utf8;
|
||||
insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
|
||||
select * from t1;
|
||||
# varchar to varchar
|
||||
alter table t1 change a a varchar(20) character set utf8 not null;
|
||||
select * from t1;
|
||||
# varchar to char
|
||||
alter table t1 change a a char(15) character set utf8 not null;
|
||||
select * from t1;
|
||||
# char to char
|
||||
alter table t1 change a a char(10) character set utf8 not null;
|
||||
select * from t1;
|
||||
# char to varchar
|
||||
alter table t1 change a a varchar(5) character set utf8 not null;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check that do_varstring2_mb produces a warning
|
||||
#
|
||||
create table t1 (
|
||||
a varchar(4000) not null
|
||||
) default character set utf8;
|
||||
insert into t1 values (repeat('a',4000));
|
||||
alter table t1 change a a varchar(3000) character set utf8 not null;
|
||||
select length(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#10504: Character set does not support traditional mode
|
||||
# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
|
||||
|
@@ -1058,4 +1058,22 @@ SELECT INSERT('abc', 4, 3, '1234');
|
||||
SELECT INSERT('abc', 5, 3, '1234');
|
||||
SELECT INSERT('abc', 6, 3, '1234');
|
||||
|
||||
#
|
||||
# Bug #27530: Grouping on crc32, or create table select crc32
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1;
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1;
|
||||
SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1;
|
||||
SELECT * FROM (SELECT CRC32(a) FROM t1) t2;
|
||||
CREATE TABLE t2 SELECT CRC32(a) FROM t1;
|
||||
desc t2;
|
||||
SELECT * FROM v1;
|
||||
SELECT * FROM (SELECT * FROM v1) x;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@@ -384,3 +384,51 @@ desc t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #24778: Innodb: No result when using ORDER BY
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a INTEGER auto_increment PRIMARY KEY,
|
||||
b INTEGER NOT NULL,
|
||||
c INTEGER NOT NULL,
|
||||
d CHAR(64)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a INTEGER auto_increment PRIMARY KEY,
|
||||
b INTEGER NOT NULL,
|
||||
c SMALLINT NOT NULL,
|
||||
d DATETIME NOT NULL,
|
||||
e SMALLINT NOT NULL,
|
||||
f INTEGER NOT NULL,
|
||||
g INTEGER NOT NULL,
|
||||
h SMALLINT NOT NULL,
|
||||
i INTEGER NOT NULL,
|
||||
j INTEGER NOT NULL,
|
||||
UNIQUE INDEX (b),
|
||||
INDEX (b, d, e, f, g, h, i, j, c),
|
||||
INDEX (c)
|
||||
);
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(NULL, 1, 254, '1000-01-01 00:00:00', 257, 0, 0, 0, 0, 0),
|
||||
(NULL, 2, 1, '2004-11-30 12:00:00', 1, 0, 0, 0, 0, 0),
|
||||
(NULL, 3, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -21600, 0),
|
||||
(NULL, 4, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -10800, 0),
|
||||
(NULL, 5, 1, '2004-11-30 12:00:00', 1, 0, 0, 5, -10800, 0),
|
||||
(NULL, 6, 1, '2004-11-30 12:00:00', 102, 0, 0, 0, 0, 0),
|
||||
(NULL, 7, 1, '2004-11-30 12:00:00', 105, 2, 0, 0, 0, 0),
|
||||
(NULL, 8, 1, '2004-11-30 12:00:00', 105, 10, 0, 0, 0, 0);
|
||||
|
||||
INSERT INTO t1 (b, c, d) VALUES
|
||||
(3388000, -553000, NULL),
|
||||
(3388000, -553000, NULL);
|
||||
|
||||
SELECT *
|
||||
FROM t2 c JOIN t1 pa ON c.b = pa.a
|
||||
WHERE c.c = 1
|
||||
ORDER BY c.b, c.d
|
||||
;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
@@ -110,6 +110,51 @@ SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
|
||||
--error 1241
|
||||
SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
|
||||
|
||||
#
|
||||
# Bug#27704: erroneous comparison of rows with NULL components
|
||||
#
|
||||
CREATE TABLE t1(a int, b int, c int);
|
||||
INSERT INTO t1 VALUES (1, 2, 3),
|
||||
(NULL, 2, 3 ), (1, NULL, 3 ), (1, 2, NULL),
|
||||
(NULL, 2, 3+1), (1, NULL, 3+1), (1, 2+1, NULL),
|
||||
(NULL, 2, 3-1), (1, NULL, 3-1), (1, 2-1, NULL);
|
||||
|
||||
SELECT (1,2,3) = (1, NULL, 3);
|
||||
SELECT (1,2,3) = (1+1, NULL, 3);
|
||||
SELECT (1,2,3) = (1, NULL, 3+1);
|
||||
SELECT * FROM t1 WHERE (a,b,c) = (1,2,3);
|
||||
|
||||
SELECT (1,2,3) <> (1, NULL, 3);
|
||||
SELECT (1,2,3) <> (1+1, NULL, 3);
|
||||
SELECT (1,2,3) <> (1, NULL, 3+1);
|
||||
SELECT * FROM t1 WHERE (a,b,c) <> (1,2,3);
|
||||
|
||||
SELECT (1,2,3) < (NULL, 2, 3);
|
||||
SELECT (1,2,3) < (1, NULL, 3);
|
||||
SELECT (1,2,3) < (1-1, NULL, 3);
|
||||
SELECT (1,2,3) < (1+1, NULL, 3);
|
||||
SELECT * FROM t1 WHERE (a,b,c) < (1,2,3);
|
||||
|
||||
SELECT (1,2,3) <= (NULL, 2, 3);
|
||||
SELECT (1,2,3) <= (1, NULL, 3);
|
||||
SELECT (1,2,3) <= (1-1, NULL, 3);
|
||||
SELECT (1,2,3) <= (1+1, NULL, 3);
|
||||
SELECT * FROM t1 WHERE (a,b,c) <= (1,2,3);
|
||||
|
||||
SELECT (1,2,3) > (NULL, 2, 3);
|
||||
SELECT (1,2,3) > (1, NULL, 3);
|
||||
SELECT (1,2,3) > (1-1, NULL, 3);
|
||||
SELECT (1,2,3) > (1+1, NULL, 3);
|
||||
SELECT * FROM t1 WHERE (a,b,c) > (1,2,3);
|
||||
|
||||
SELECT (1,2,3) >= (NULL, 2, 3);
|
||||
SELECT (1,2,3) >= (1, NULL, 3);
|
||||
SELECT (1,2,3) >= (1-1, NULL, 3);
|
||||
SELECT (1,2,3) >= (1+1, NULL, 3);
|
||||
SELECT * FROM t1 WHERE (a,b,c) >= (1,2,3);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
66
mysql-test/t/rpl_critical_errors.test
Normal file
66
mysql-test/t/rpl_critical_errors.test
Normal file
@@ -0,0 +1,66 @@
|
||||
# Test for BUG#26551
|
||||
#
|
||||
|
||||
# This test is unfortunately very fragile and very dependent on the
|
||||
# load of the computer. The test is therefore disabled normally. It is
|
||||
# entered here to demonstrate how to check that the bug is actually
|
||||
# solved.
|
||||
|
||||
--echo Turn on parsing to run this test
|
||||
|
||||
disable_parsing;
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 (data LONGBLOB) ENGINE=MYISAM;
|
||||
CREATE TABLE t2 (data LONGBLOB) ENGINE=MYISAM;
|
||||
|
||||
INSERT INTO t1 (data) VALUES (repeat('a',1024*1024));
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
send INSERT INTO t2 SELECT * FROM t1;
|
||||
|
||||
connection master1;
|
||||
|
||||
# This sleep is picked so that the query above has started to insert
|
||||
# some rows into t2. If it hasn't the slave will not stop below.
|
||||
sleep 4;
|
||||
|
||||
# SHOW PROCESSLIST;
|
||||
|
||||
# Code for the 5.1 server to get the thread id of the thread executing
|
||||
# the query above.
|
||||
#
|
||||
#SET @id = 0;
|
||||
#SELECT id INTO @id
|
||||
# FROM information_schema.processlist
|
||||
# WHERE info LIKE 'INSERT INTO t2%';
|
||||
|
||||
# This is the connection that is executing the INSERT INTO t2...
|
||||
KILL QUERY 2;
|
||||
|
||||
connection slave;
|
||||
|
||||
# Here the slave will only stop if the query above actually started
|
||||
# inserting some rows into t2. Otherwise, it will hang forever.
|
||||
wait_for_slave_to_stop;
|
||||
|
||||
# The following should be 0
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
# ... and there the error code should be 1317 (ER_QUERY_INTERRUPTED)
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 7 # 8 # 9 # 20 # 22 # 23 # 33 #
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
|
||||
enable_parsing;
|
@@ -7017,6 +7017,44 @@ select bug20777(18446744073709551613)+1;
|
||||
drop function bug20777;
|
||||
delimiter |;
|
||||
|
||||
|
||||
#
|
||||
# BUG#5274: Stored procedure crash if length of CHAR variable too great.
|
||||
#
|
||||
|
||||
# Prepare.
|
||||
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS bug5274_f1|
|
||||
DROP FUNCTION IF EXISTS bug5274_f2|
|
||||
--enable_warnings
|
||||
|
||||
# Test.
|
||||
|
||||
CREATE FUNCTION bug5274_f1(p1 CHAR) RETURNS CHAR
|
||||
RETURN CONCAT(p1, p1)|
|
||||
|
||||
CREATE FUNCTION bug5274_f2() RETURNS CHAR
|
||||
BEGIN
|
||||
DECLARE v1 INT DEFAULT 0;
|
||||
DECLARE v2 CHAR DEFAULT 'x';
|
||||
|
||||
WHILE v1 < 30 DO
|
||||
SET v1 = v1 + 1;
|
||||
SET v2 = bug5274_f1(v2);
|
||||
END WHILE;
|
||||
|
||||
RETURN v2;
|
||||
END|
|
||||
|
||||
SELECT bug5274_f2()|
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP FUNCTION bug5274_f1|
|
||||
DROP FUNCTION bug5274_f2|
|
||||
|
||||
|
||||
###
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
@@ -528,3 +528,21 @@ SELECT a, MAX(b),
|
||||
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug #27870: crash of an equijoin query with WHERE condition containing
|
||||
# a subquery predicate of the form <join attr> NOT IN (SELECT ...)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (b int, PRIMARY KEY(b));
|
||||
INSERT INTO t1 VALUES (1), (NULL), (4);
|
||||
INSERT INTO t2 VALUES (3), (1),(2), (5), (4), (7), (6);
|
||||
|
||||
EXPLAIN EXTENDED
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
|
||||
SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@@ -504,6 +504,30 @@ select @@lc_time_names;
|
||||
set lc_time_names=0;
|
||||
select @@lc_time_names;
|
||||
|
||||
#
|
||||
# Bug #22648 LC_TIME_NAMES: Setting GLOBAL has no effect
|
||||
#
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
set @@global.lc_time_names=fr_FR;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
--echo New connection
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
set @@lc_time_names=ru_RU;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
--echo Returnung to default connection
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
set lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
set @@global.lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
set @@lc_time_names=default;
|
||||
select @@global.lc_time_names, @@lc_time_names;
|
||||
|
||||
|
||||
#
|
||||
# Bug #13334: query_prealloc_size default less than minimum
|
||||
#
|
||||
|
@@ -3205,4 +3205,20 @@ SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
DROP table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#27786: Inconsistent Operation Performing UNION On View With ORDER BY
|
||||
#
|
||||
CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
|
||||
|
||||
SELECT * FROM t1 UNION SELECT * FROM v1;
|
||||
EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1;
|
||||
SELECT * FROM v1 UNION SELECT * FROM t1;
|
||||
EXPLAIN SELECT * FROM v1 UNION SELECT * FROM t1;
|
||||
SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
|
||||
EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@@ -434,6 +434,26 @@ static void do_varstring1(Copy_field *copy)
|
||||
}
|
||||
|
||||
|
||||
static void do_varstring1_mb(Copy_field *copy)
|
||||
{
|
||||
int well_formed_error;
|
||||
CHARSET_INFO *cs= copy->from_field->charset();
|
||||
uint from_length= (uint) *(uchar*) copy->from_ptr;
|
||||
const char *from_ptr= copy->from_ptr + 1;
|
||||
uint to_char_length= (copy->to_length - 1) / cs->mbmaxlen;
|
||||
uint length= cs->cset->well_formed_len(cs, from_ptr, from_ptr + from_length,
|
||||
to_char_length, &well_formed_error);
|
||||
if (length < from_length)
|
||||
{
|
||||
if (current_thd->count_cuted_fields)
|
||||
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
*(uchar*) copy->to_ptr= (uchar) length;
|
||||
memcpy(copy->to_ptr + 1, from_ptr, length);
|
||||
}
|
||||
|
||||
|
||||
static void do_varstring2(Copy_field *copy)
|
||||
{
|
||||
uint length=uint2korr(copy->from_ptr);
|
||||
@@ -459,6 +479,12 @@ static void do_varstring2_mb(Copy_field *copy)
|
||||
const char *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH;
|
||||
uint length= cs->cset->well_formed_len(cs, from_beg, from_beg + from_length,
|
||||
char_length, &well_formed_error);
|
||||
if (length < from_length)
|
||||
{
|
||||
if (current_thd->count_cuted_fields)
|
||||
copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
int2store(copy->to_ptr, length);
|
||||
memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, from_beg, length);
|
||||
}
|
||||
@@ -634,8 +660,10 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
||||
return do_field_string;
|
||||
if (to_length != from_length)
|
||||
return (((Field_varstring*) to)->length_bytes == 1 ?
|
||||
do_varstring1 : (from->charset()->mbmaxlen == 1 ?
|
||||
do_varstring2 : do_varstring2_mb));
|
||||
(from->charset()->mbmaxlen == 1 ? do_varstring1 :
|
||||
do_varstring1_mb) :
|
||||
(from->charset()->mbmaxlen == 1 ? do_varstring2 :
|
||||
do_varstring2_mb));
|
||||
}
|
||||
else if (to_length < from_length)
|
||||
return (from->charset()->mbmaxlen == 1 ?
|
||||
|
@@ -812,8 +812,18 @@ int Arg_comparator::compare_row()
|
||||
if (owner->null_value)
|
||||
{
|
||||
// NULL was compared
|
||||
if (owner->abort_on_null)
|
||||
return -1; // We do not need correct NULL returning
|
||||
switch (owner->functype()) {
|
||||
case Item_func::NE_FUNC:
|
||||
break; // NE never aborts on NULL even if abort_on_null is set
|
||||
case Item_func::LT_FUNC:
|
||||
case Item_func::LE_FUNC:
|
||||
case Item_func::GT_FUNC:
|
||||
case Item_func::GE_FUNC:
|
||||
return -1; // <, <=, > and >= always fail on NULL
|
||||
default: // EQ_FUNC
|
||||
if (owner->abort_on_null)
|
||||
return -1; // We do not need correct NULL returning
|
||||
}
|
||||
was_null= 1;
|
||||
owner->null_value= 0;
|
||||
res= 0; // continue comparison (maybe we will meet explicit difference)
|
||||
@@ -824,8 +834,8 @@ int Arg_comparator::compare_row()
|
||||
if (was_null)
|
||||
{
|
||||
/*
|
||||
There was NULL(s) in comparison in some parts, but there was not
|
||||
explicit difference in other parts, so we have to return NULL
|
||||
There was NULL(s) in comparison in some parts, but there was no
|
||||
explicit difference in other parts, so we have to return NULL.
|
||||
*/
|
||||
owner->null_value= 1;
|
||||
return -1;
|
||||
|
@@ -333,7 +333,7 @@ public:
|
||||
bool is_bool_func() { return 1; }
|
||||
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
|
||||
uint decimal_precision() const { return 1; }
|
||||
void top_level_item() { abort_on_null=1; }
|
||||
void top_level_item() { abort_on_null= TRUE; }
|
||||
|
||||
friend class Arg_comparator;
|
||||
};
|
||||
|
@@ -790,7 +790,7 @@ class Item_func_crc32 :public Item_int_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_crc32(Item *a) :Item_int_func(a) {}
|
||||
Item_func_crc32(Item *a) :Item_int_func(a) { unsigned_flag= 1; }
|
||||
const char *func_name() const { return "crc32"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
longlong val_int();
|
||||
|
@@ -276,7 +276,11 @@ public:
|
||||
{
|
||||
return pushed_cond_guards ? pushed_cond_guards + i : NULL;
|
||||
}
|
||||
void set_cond_guard_var(int i, bool v) { pushed_cond_guards[i]= v; }
|
||||
void set_cond_guard_var(int i, bool v)
|
||||
{
|
||||
if ( pushed_cond_guards)
|
||||
pushed_cond_guards[i]= v;
|
||||
}
|
||||
bool have_guarded_conds() { return test(pushed_cond_guards); }
|
||||
|
||||
Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery
|
||||
|
@@ -149,6 +149,7 @@ typedef struct my_locale_st
|
||||
|
||||
extern MY_LOCALE my_locale_en_US;
|
||||
extern MY_LOCALE *my_locales[];
|
||||
extern MY_LOCALE *my_default_lc_time_names;
|
||||
|
||||
MY_LOCALE *my_locale_by_name(const char *name);
|
||||
MY_LOCALE *my_locale_by_number(uint number);
|
||||
|
@@ -315,6 +315,7 @@ static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
|
||||
static char *opt_init_slave, *language_ptr, *opt_init_connect;
|
||||
static char *default_character_set_name;
|
||||
static char *character_set_filesystem_name;
|
||||
static char *lc_time_names_name;
|
||||
static char *my_bind_addr_str;
|
||||
static char *default_collation_name;
|
||||
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
|
||||
@@ -495,6 +496,8 @@ CHARSET_INFO *system_charset_info, *files_charset_info ;
|
||||
CHARSET_INFO *national_charset_info, *table_alias_charset;
|
||||
CHARSET_INFO *character_set_filesystem;
|
||||
|
||||
MY_LOCALE *my_default_lc_time_names;
|
||||
|
||||
SHOW_COMP_OPTION have_isam;
|
||||
SHOW_COMP_OPTION have_raid, have_ssl, have_symlink, have_query_cache;
|
||||
SHOW_COMP_OPTION have_geometry, have_rtree_keys, have_dlopen;
|
||||
@@ -2826,6 +2829,14 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
||||
return 1;
|
||||
global_system_variables.character_set_filesystem= character_set_filesystem;
|
||||
|
||||
if (!(my_default_lc_time_names=
|
||||
my_locale_by_name(lc_time_names_name)))
|
||||
{
|
||||
sql_print_error("Unknown locale: '%s'", lc_time_names_name);
|
||||
return 1;
|
||||
}
|
||||
global_system_variables.lc_time_names= my_default_lc_time_names;
|
||||
|
||||
sys_init_connect.value_length= 0;
|
||||
if ((sys_init_connect.value= opt_init_connect))
|
||||
sys_init_connect.value_length= strlen(opt_init_connect);
|
||||
@@ -4750,6 +4761,7 @@ enum options_mysqld
|
||||
OPT_DEFAULT_COLLATION,
|
||||
OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
|
||||
OPT_CHARACTER_SET_FILESYSTEM,
|
||||
OPT_LC_TIME_NAMES,
|
||||
OPT_INIT_CONNECT,
|
||||
OPT_INIT_SLAVE,
|
||||
OPT_SECURE_AUTH,
|
||||
@@ -5079,6 +5091,11 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
|
||||
"Client error messages in given language. May be given as a full path.",
|
||||
(gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
{"lc-time-names", OPT_LC_TIME_NAMES,
|
||||
"Set the language used for the month names and the days of the week.",
|
||||
(gptr*) &lc_time_names_name,
|
||||
(gptr*) &lc_time_names_name,
|
||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||
{"local-infile", OPT_LOCAL_INFILE,
|
||||
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).",
|
||||
(gptr*) &opt_local_infile,
|
||||
@@ -6553,7 +6570,7 @@ static void mysql_init_variables(void)
|
||||
default_collation_name= compiled_default_collation_name;
|
||||
sys_charset_system.value= (char*) system_charset_info->csname;
|
||||
character_set_filesystem_name= (char*) "binary";
|
||||
|
||||
lc_time_names_name= (char*) "en_US";
|
||||
|
||||
/* Set default values for some option variables */
|
||||
global_system_variables.table_type= DB_TYPE_MYISAM;
|
||||
|
@@ -2825,7 +2825,10 @@ bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
|
||||
|
||||
bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
|
||||
{
|
||||
thd->variables.lc_time_names= var->save_result.locale_value;
|
||||
if (var->type == OPT_GLOBAL)
|
||||
global_system_variables.lc_time_names= var->save_result.locale_value;
|
||||
else
|
||||
thd->variables.lc_time_names= var->save_result.locale_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2833,13 +2836,18 @@ bool sys_var_thd_lc_time_names::update(THD *thd, set_var *var)
|
||||
byte *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
|
||||
LEX_STRING *base)
|
||||
{
|
||||
return (byte *)(thd->variables.lc_time_names->name);
|
||||
return type == OPT_GLOBAL ?
|
||||
(byte *) global_system_variables.lc_time_names->name :
|
||||
(byte *) thd->variables.lc_time_names->name;
|
||||
}
|
||||
|
||||
|
||||
void sys_var_thd_lc_time_names::set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
thd->variables.lc_time_names = &my_locale_en_US;
|
||||
if (type == OPT_GLOBAL)
|
||||
global_system_variables.lc_time_names= my_default_lc_time_names;
|
||||
else
|
||||
thd->variables.lc_time_names= global_system_variables.lc_time_names;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -3099,6 +3099,7 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error)
|
||||
switch (expected_error) {
|
||||
case ER_NET_READ_ERROR:
|
||||
case ER_NET_ERROR_ON_WRITE:
|
||||
case ER_QUERY_INTERRUPTED:
|
||||
case ER_SERVER_SHUTDOWN:
|
||||
case ER_NEW_ABORTING_CONNECTION:
|
||||
return 1;
|
||||
|
@@ -344,7 +344,6 @@ void THD::init(void)
|
||||
total_warn_count= 0;
|
||||
update_charset();
|
||||
bzero((char *) &status_var, sizeof(status_var));
|
||||
variables.lc_time_names = &my_locale_en_US;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -468,6 +468,7 @@ public:
|
||||
bool change_result(select_subselect *result, select_subselect *old_result);
|
||||
void set_limit(st_select_lex *values);
|
||||
void set_thd(THD *thd_arg) { thd= thd_arg; }
|
||||
inline bool is_union ();
|
||||
|
||||
friend void lex_start(THD *thd, uchar *buf, uint length);
|
||||
friend int subselect_union_engine::exec();
|
||||
@@ -700,6 +701,13 @@ public:
|
||||
};
|
||||
typedef class st_select_lex SELECT_LEX;
|
||||
|
||||
|
||||
inline bool st_select_lex_unit::is_union ()
|
||||
{
|
||||
return first_select()->next_select() &&
|
||||
first_select()->next_select()->linkage == UNION_TYPE;
|
||||
}
|
||||
|
||||
#define ALTER_ADD_COLUMN 1
|
||||
#define ALTER_DROP_COLUMN 2
|
||||
#define ALTER_CHANGE_COLUMN 4
|
||||
|
@@ -5982,10 +5982,7 @@ make_join_readinfo(JOIN *join, ulonglong options)
|
||||
*/
|
||||
if (!ordered_set &&
|
||||
(table == join->sort_by_table &&
|
||||
(!join->order || join->skip_sort_order ||
|
||||
test_if_skip_sort_order(tab, join->order, join->select_limit,
|
||||
1))
|
||||
) ||
|
||||
(!join->order || join->skip_sort_order)) ||
|
||||
(join->sort_by_table == (TABLE *) 1 && i != join->const_tables))
|
||||
ordered_set= 1;
|
||||
|
||||
|
@@ -2315,18 +2315,32 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
res= open_normal_and_derived_tables(thd, show_table_list,
|
||||
MYSQL_LOCK_IGNORE_FLUSH);
|
||||
lex->sql_command= save_sql_command;
|
||||
/*
|
||||
We should use show_table_list->alias instead of
|
||||
show_table_list->table_name because table_name
|
||||
could be changed during opening of I_S tables. It's safe
|
||||
to use alias because alias contains original table name
|
||||
in this case.
|
||||
/*
|
||||
They can drop table after table names list creation and
|
||||
before table opening. We open non existing table and
|
||||
get ER_NO_SUCH_TABLE error. In this case we do not store
|
||||
the record into I_S table and clear error.
|
||||
*/
|
||||
res= schema_table->process_table(thd, show_table_list, table,
|
||||
res, orig_base_name,
|
||||
show_table_list->alias);
|
||||
close_tables_for_reopen(thd, &show_table_list);
|
||||
DBUG_ASSERT(!lex->query_tables_own_last);
|
||||
if (thd->net.last_errno == ER_NO_SUCH_TABLE)
|
||||
{
|
||||
res= 0;
|
||||
thd->clear_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
We should use show_table_list->alias instead of
|
||||
show_table_list->table_name because table_name
|
||||
could be changed during opening of I_S tables. It's safe
|
||||
to use alias because alias contains original table name
|
||||
in this case.
|
||||
*/
|
||||
res= schema_table->process_table(thd, show_table_list, table,
|
||||
res, orig_base_name,
|
||||
show_table_list->alias);
|
||||
close_tables_for_reopen(thd, &show_table_list);
|
||||
DBUG_ASSERT(!lex->query_tables_own_last);
|
||||
}
|
||||
if (res)
|
||||
goto err;
|
||||
}
|
||||
|
@@ -1279,13 +1279,18 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
||||
unit->slave= save_slave; // fix include_down initialisation
|
||||
}
|
||||
|
||||
/*
|
||||
We can safely ignore the VIEW's ORDER BY if we merge into union
|
||||
branch, as order is not important there.
|
||||
*/
|
||||
if (!table->select_lex->master_unit()->is_union())
|
||||
table->select_lex->order_list.push_back(&lex->select_lex.order_list);
|
||||
/*
|
||||
This SELECT_LEX will be linked in global SELECT_LEX list
|
||||
to make it processed by mysql_handle_derived(),
|
||||
but it will not be included to SELECT_LEX tree, because it
|
||||
will not be executed
|
||||
*/
|
||||
table->select_lex->order_list.push_back(&lex->select_lex.order_list);
|
||||
*/
|
||||
goto ok;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user