mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge gleb.loc:/home/uchum/work/bk/5.1
into gleb.loc:/home/uchum/work/bk/5.1-opt
This commit is contained in:
commit
a1ebc8590c
37 changed files with 617 additions and 194 deletions
|
@ -3657,33 +3657,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
|||
case MYSQL_TYPE_FLOAT:
|
||||
{
|
||||
/*
|
||||
We need to store data in the buffer before the truncation check to
|
||||
We need to mark the local variable volatile to
|
||||
workaround Intel FPU executive precision feature.
|
||||
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details)
|
||||
AFAIU it does not guarantee to work.
|
||||
*/
|
||||
float data;
|
||||
volatile float data;
|
||||
if (is_unsigned)
|
||||
{
|
||||
data= (float) ulonglong2double(value);
|
||||
*param->error= ((ulonglong) value) != ((ulonglong) data);
|
||||
}
|
||||
else
|
||||
data= (float) value;
|
||||
{
|
||||
data= (float)value;
|
||||
*param->error= value != ((longlong) data);
|
||||
}
|
||||
floatstore(buffer, data);
|
||||
*param->error= is_unsigned ?
|
||||
((ulonglong) value) != ((ulonglong) (*(float*) buffer)) :
|
||||
((longlong) value) != ((longlong) (*(float*) buffer));
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_DOUBLE:
|
||||
{
|
||||
double data;
|
||||
volatile double data;
|
||||
if (is_unsigned)
|
||||
{
|
||||
data= ulonglong2double(value);
|
||||
*param->error= ((ulonglong) value) != ((ulonglong) data);
|
||||
}
|
||||
else
|
||||
{
|
||||
data= (double)value;
|
||||
*param->error= value != ((longlong) data);
|
||||
}
|
||||
doublestore(buffer, data);
|
||||
*param->error= is_unsigned ?
|
||||
((ulonglong) value) != ((ulonglong) (*(double*) buffer)) :
|
||||
((longlong) value) != ((longlong) (*(double*) buffer));
|
||||
break;
|
||||
}
|
||||
case MYSQL_TYPE_TIME:
|
||||
|
|
|
@ -362,6 +362,32 @@ cast(-19999999999999999999 as signed)
|
|||
-9223372036854775808
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
select -9223372036854775808;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -9223372036854775808 8 20 20 N 32897 0 63
|
||||
-9223372036854775808
|
||||
-9223372036854775808
|
||||
select -(9223372036854775808);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -(9223372036854775808) 8 20 20 N 32897 0 63
|
||||
-(9223372036854775808)
|
||||
-9223372036854775808
|
||||
select -((9223372036854775808));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -((9223372036854775808)) 8 20 20 N 32897 0 63
|
||||
-((9223372036854775808))
|
||||
-9223372036854775808
|
||||
select -(-(9223372036854775808));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -(-(9223372036854775808)) 246 21 19 N 129 0 63
|
||||
-(-(9223372036854775808))
|
||||
9223372036854775808
|
||||
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
|
||||
--9223372036854775808 ---9223372036854775808 ----9223372036854775808
|
||||
9223372036854775808 -9223372036854775808 9223372036854775808
|
||||
select -(-9223372036854775808), -(-(-9223372036854775808));
|
||||
-(-9223372036854775808) -(-(-9223372036854775808))
|
||||
9223372036854775808 -9223372036854775808
|
||||
create table t1 select -9223372036854775808 bi;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
|
|
|
@ -2394,4 +2394,96 @@ C
|
|||
2707236321
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
SELECT LOCATE('foo', NULL) FROM DUAL;
|
||||
LOCATE('foo', NULL)
|
||||
NULL
|
||||
SELECT LOCATE(NULL, 'o') FROM DUAL;
|
||||
LOCATE(NULL, 'o')
|
||||
NULL
|
||||
SELECT LOCATE(NULL, NULL) FROM DUAL;
|
||||
LOCATE(NULL, NULL)
|
||||
NULL
|
||||
SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
|
||||
LOCATE('foo', NULL) IS NULL
|
||||
1
|
||||
SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
|
||||
LOCATE(NULL, 'o') IS NULL
|
||||
1
|
||||
SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
|
||||
LOCATE(NULL, NULL) IS NULL
|
||||
1
|
||||
SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
|
||||
ISNULL(LOCATE('foo', NULL))
|
||||
1
|
||||
SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
|
||||
ISNULL(LOCATE(NULL, 'o'))
|
||||
1
|
||||
SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
|
||||
ISNULL(LOCATE(NULL, NULL))
|
||||
1
|
||||
SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
|
||||
LOCATE('foo', NULL) <=> NULL
|
||||
1
|
||||
SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
|
||||
LOCATE(NULL, 'o') <=> NULL
|
||||
1
|
||||
SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
|
||||
LOCATE(NULL, NULL) <=> NULL
|
||||
1
|
||||
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
|
||||
INSERT INTO t1 VALUES (1, 'foo', 'o');
|
||||
INSERT INTO t1 VALUES (2, 'foo', NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL, 'o');
|
||||
INSERT INTO t1 VALUES (4, NULL, NULL);
|
||||
SELECT id, LOCATE(a,p) FROM t1;
|
||||
id LOCATE(a,p)
|
||||
1 0
|
||||
2 NULL
|
||||
3 NULL
|
||||
4 NULL
|
||||
SELECT id, LOCATE(a,p) IS NULL FROM t1;
|
||||
id LOCATE(a,p) IS NULL
|
||||
1 0
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
|
||||
id ISNULL(LOCATE(a,p))
|
||||
1 0
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
SELECT id, LOCATE(a,p) <=> NULL FROM t1;
|
||||
id LOCATE(a,p) <=> NULL
|
||||
1 0
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
|
||||
id
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
|
||||
id
|
||||
2
|
||||
3
|
||||
4
|
||||
DROP TABLE t1;
|
||||
SELECT SUBSTR('foo',1,0) FROM DUAL;
|
||||
SUBSTR('foo',1,0)
|
||||
|
||||
SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
|
||||
SUBSTR('foo',1,CAST(0 AS SIGNED))
|
||||
|
||||
SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
|
||||
SUBSTR('foo',1,CAST(0 AS UNSIGNED))
|
||||
|
||||
CREATE TABLE t1 (a varchar(10), len int unsigned);
|
||||
INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
|
||||
SELECT SUBSTR(a,1,len) FROM t1;
|
||||
SUBSTR(a,1,len)
|
||||
ba
|
||||
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list'
|
|||
drop table t1,t2;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY);
|
||||
INSERT INTO t1 values (1), (2);
|
||||
flush status;
|
||||
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
|
||||
show status like 'Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 1
|
||||
Handler_read_key 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (x int, y int);
|
||||
CREATE TABLE t2 (z int, y int);
|
||||
|
@ -759,3 +768,25 @@ d
|
|||
20
|
||||
20
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
prev_id INT,
|
||||
join_id INT DEFAULT 0);
|
||||
INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
|
||||
SELECT * FROM t1;
|
||||
id prev_id join_id
|
||||
1 NULL 0
|
||||
2 1 0
|
||||
3 2 0
|
||||
CREATE TABLE t2 (join_id INT);
|
||||
INSERT INTO t2 (join_id) VALUES (0);
|
||||
INSERT INTO t1 (prev_id) SELECT id
|
||||
FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
|
||||
ORDER BY id DESC LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
id prev_id join_id
|
||||
1 NULL 0
|
||||
2 1 0
|
||||
3 2 0
|
||||
4 3 0
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -140,4 +140,45 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
|
|||
def a v_small v_small 3 9 9 N 32769 0 63
|
||||
v_small
|
||||
214748364
|
||||
CREATE TABLE t1 (c1 CHAR(1));
|
||||
CREATE TABLE t2 (c2 CHAR(1));
|
||||
CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
|
||||
CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
|
||||
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
|
||||
INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
|
||||
SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 c1 c1 254 1 1 Y 0 0 8
|
||||
c1
|
||||
1
|
||||
2
|
||||
2
|
||||
3
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 c1 c1 254 1 1 Y 0 0 8
|
||||
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
|
||||
c1 c2
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
2 2
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
|
||||
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
|
||||
c1 c2
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
|
||||
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
|
||||
c1 c2
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -313,6 +313,12 @@ DELIMITER ;
|
|||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
CREATE TABLE t1 (c1 CHAR(10));
|
||||
flush logs;
|
||||
INSERT INTO t1 VALUES ('0123456789');
|
||||
flush logs;
|
||||
DROP TABLE t1;
|
||||
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
|
||||
End of 5.0 tests
|
||||
flush logs;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -35,3 +35,49 @@ SELECT * FROM t4;
|
|||
id name number
|
||||
3 XXX 12345
|
||||
4 XXY 12345
|
||||
FLUSH LOGS;
|
||||
FLUSH LOGS;
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
|
||||
CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB";
|
||||
SET AUTOCOMMIT = 0;
|
||||
-------- switch to slave --------
|
||||
SHOW CREATE TABLE mysqltest1.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` bigint(20) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
-------- switch to master --------
|
||||
INSERT INTO mysqltest1.t1 SET f1= 1;
|
||||
DROP TEMPORARY TABLE mysqltest1.tmp;
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
COUNT(*)
|
||||
0
|
||||
INSERT INTO mysqltest1.t1 SET f1= 2;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
Table Create Table
|
||||
tmp2 CREATE TEMPORARY TABLE `tmp2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
COUNT(*)
|
||||
0
|
||||
-------- switch to slave --------
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
ERROR 42S02: Table 'mysqltest1.tmp' doesn't exist
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
ERROR 42S02: Table 'mysqltest1.tmp2' doesn't exist
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
COUNT(*)
|
||||
2
|
||||
FLUSH LOGS;
|
||||
-------- switch to master --------
|
||||
FLUSH LOGS;
|
||||
DROP DATABASE mysqltest1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -35,20 +35,20 @@ pk1 b c
|
|||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1
|
||||
master-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB
|
||||
master-bin.000001 # Query 1 # alter logfile group lg1
|
||||
master-bin.000001 # Query 1 # use `test`; alter logfile group lg1
|
||||
add undofile 'undofile02.dat'
|
||||
initial_size 4M engine=ndb
|
||||
master-bin.000001 # Query 1 # CREATE TABLESPACE ts1
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE NDB
|
||||
master-bin.000001 # Query 1 # alter tablespace ts1
|
||||
master-bin.000001 # Query 1 # use `test`; alter tablespace ts1
|
||||
add datafile 'datafile02.dat'
|
||||
initial_size 4M engine=ndb
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1
|
||||
|
|
|
@ -14,3 +14,23 @@ n
|
|||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int primary key);
|
||||
insert into t1 values (1),(2);
|
||||
delete from t1 where @@server_id=1;
|
||||
set sql_mode=strict_trans_tables;
|
||||
select @@server_id;
|
||||
@@server_id
|
||||
1
|
||||
insert into t1 values (1),(2),(3);
|
||||
select @@server_id;
|
||||
@@server_id
|
||||
2
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
|
||||
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 776 # # master-bin.000001 Yes Yes 0 0 776 # None 0 No # No
|
||||
drop table t1;
|
||||
|
|
|
@ -3468,6 +3468,30 @@ a1 c
|
|||
2 0
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
|
||||
CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
|
||||
SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
|
||||
b SUM(a)
|
||||
3 4
|
||||
EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
|
||||
a SUM(b)
|
||||
1 6
|
||||
2 3
|
||||
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
|
||||
SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
|
||||
a SUM(b)
|
||||
1 10
|
||||
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
DROP DATABASE IF EXISTS `d-1`;
|
||||
CREATE DATABASE `d-1`;
|
||||
|
|
|
@ -295,6 +295,22 @@ drop table t1;
|
|||
select cast(19999999999999999999 as signed);
|
||||
select cast(-19999999999999999999 as signed);
|
||||
|
||||
#
|
||||
# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
|
||||
#
|
||||
|
||||
# PS protocol gives different metadata for `Max length' column
|
||||
--disable_ps_protocol
|
||||
--enable_metadata
|
||||
select -9223372036854775808;
|
||||
select -(9223372036854775808);
|
||||
select -((9223372036854775808));
|
||||
select -(-(9223372036854775808));
|
||||
--disable_metadata
|
||||
--endble_ps_protocol
|
||||
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
|
||||
select -(-9223372036854775808), -(-(-9223372036854775808));
|
||||
|
||||
# Bug #28005 Partitions: can't use -9223372036854775808
|
||||
create table t1 select -9223372036854775808 bi;
|
||||
describe t1;
|
||||
|
|
|
@ -1183,4 +1183,52 @@ SELECT * FROM (SELECT * FROM v1) x;
|
|||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
|
||||
#
|
||||
# Bug #27932: LOCATE with argument evaluated to NULL
|
||||
#
|
||||
|
||||
SELECT LOCATE('foo', NULL) FROM DUAL;
|
||||
SELECT LOCATE(NULL, 'o') FROM DUAL;
|
||||
SELECT LOCATE(NULL, NULL) FROM DUAL;
|
||||
SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
|
||||
SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
|
||||
SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
|
||||
SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
|
||||
SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
|
||||
SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
|
||||
SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
|
||||
SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
|
||||
SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
|
||||
|
||||
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
|
||||
|
||||
INSERT INTO t1 VALUES (1, 'foo', 'o');
|
||||
INSERT INTO t1 VALUES (2, 'foo', NULL);
|
||||
INSERT INTO t1 VALUES (3, NULL, 'o');
|
||||
INSERT INTO t1 VALUES (4, NULL, NULL);
|
||||
|
||||
SELECT id, LOCATE(a,p) FROM t1;
|
||||
SELECT id, LOCATE(a,p) IS NULL FROM t1;
|
||||
SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
|
||||
SELECT id, LOCATE(a,p) <=> NULL FROM t1;
|
||||
SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
|
||||
SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument
|
||||
#
|
||||
|
||||
SELECT SUBSTR('foo',1,0) FROM DUAL;
|
||||
SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
|
||||
SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
|
||||
|
||||
CREATE TABLE t1 (a varchar(10), len int unsigned);
|
||||
INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
|
||||
|
||||
SELECT SUBSTR(a,1,len) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -233,7 +233,9 @@ drop table t1,t2;
|
|||
CREATE TABLE t1 (a int PRIMARY KEY);
|
||||
INSERT INTO t1 values (1), (2);
|
||||
|
||||
flush status;
|
||||
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
|
||||
show status like 'Handler_read%';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -319,3 +321,26 @@ INSERT INTO t2 (d)
|
|||
|
||||
SELECT * FROM t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Bug #29095: incorrect pushing of LIMIT into the temporary
|
||||
# table ignoring ORDER BY clause
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
prev_id INT,
|
||||
join_id INT DEFAULT 0);
|
||||
|
||||
INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
|
||||
SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t2 (join_id INT);
|
||||
INSERT INTO t2 (join_id) VALUES (0);
|
||||
|
||||
INSERT INTO t1 (prev_id) SELECT id
|
||||
FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
|
||||
ORDER BY id DESC LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -90,5 +90,26 @@ select a.* from (select 2147483648 as v_large) a;
|
|||
select a.* from (select 214748364 as v_small) a;
|
||||
--disable_metadata
|
||||
|
||||
#
|
||||
# Bug #28898: table alias and database name of VIEW columns is empty in the
|
||||
# metadata of # SELECT statement where join is executed via temporary table.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c1 CHAR(1));
|
||||
CREATE TABLE t2 (c2 CHAR(1));
|
||||
CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
|
||||
CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
|
||||
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
|
||||
INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
|
||||
|
||||
--enable_metadata
|
||||
SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
|
||||
--disable_metadata
|
||||
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -206,6 +206,19 @@ flush logs;
|
|||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
|
||||
|
||||
#
|
||||
# Bug#28293 missed '#' sign in the hex dump when the dump length
|
||||
# is divisible by 16.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c1 CHAR(10));
|
||||
# we need this for getting fixed timestamps inside of this test
|
||||
flush logs;
|
||||
INSERT INTO t1 VALUES ('0123456789');
|
||||
flush logs;
|
||||
DROP TABLE t1;
|
||||
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -213,7 +226,7 @@ flush logs;
|
|||
#
|
||||
flush logs;
|
||||
--error 1
|
||||
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
|
||||
--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
|
||||
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null
|
||||
--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000014 >/dev/null 2>/dev/null
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -44,5 +44,72 @@ connection master;
|
|||
DROP TABLE t4;
|
||||
--enable_query_log
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
|
||||
# on master
|
||||
#
|
||||
#Note Matthias: to be merged to rpl_ddl.test
|
||||
|
||||
--source include/not_ndb_default.inc
|
||||
|
||||
FLUSH LOGS;
|
||||
sync_slave_with_master;
|
||||
FLUSH LOGS;
|
||||
connection master;
|
||||
let $engine_type= "InnoDB";
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SHOW CREATE TABLE mysqltest1.t1;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 1;
|
||||
DROP TEMPORARY TABLE mysqltest1.tmp;
|
||||
ROLLBACK;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
INSERT INTO mysqltest1.t1 SET f1= 2;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# has two rows here : as the default is MyISAM and
|
||||
# it can't be rolled back by the master's ROLLBACK.
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
FLUSH LOGS;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
FLUSH LOGS;
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
-- source include/master-slave-end.inc
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -27,3 +27,25 @@ drop table t1;
|
|||
sync_slave_with_master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
|
||||
#
|
||||
connection master;
|
||||
create table t1(a int primary key);
|
||||
insert into t1 values (1),(2);
|
||||
delete from t1 where @@server_id=1;
|
||||
set sql_mode=strict_trans_tables;
|
||||
select @@server_id;
|
||||
insert into t1 values (1),(2),(3);
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select @@server_id;
|
||||
select * from t1;
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
show slave status;
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_with_master;
|
||||
# End of 5.0 tests
|
||||
|
|
|
@ -3316,6 +3316,30 @@ SELECT * FROM t1;
|
|||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
|
||||
#
|
||||
# Bug #29104: assertion abort for a query with a view column reference
|
||||
# in the GROUP BY list and a condition requiring the value
|
||||
# of another view column to be equal to a constant
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
|
||||
|
||||
CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
|
||||
|
||||
|
||||
SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
|
||||
EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
|
||||
|
||||
SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
|
||||
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
|
||||
|
||||
SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
|
||||
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
#
|
||||
|
|
|
@ -425,12 +425,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
event_queue->create_event(thd, new_element, &created);
|
||||
/* Binlog the create event. */
|
||||
DBUG_ASSERT(thd->query && thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||
|
@ -551,12 +546,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
new_element);
|
||||
/* Binlog the alter event. */
|
||||
DBUG_ASSERT(thd->query && thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||
|
@ -631,12 +621,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
|
|||
event_queue->drop_event(thd, dbname, name);
|
||||
/* Binlog the drop event. */
|
||||
DBUG_ASSERT(thd->query && thd->query_length);
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||
DBUG_RETURN(ret);
|
||||
|
|
25
sql/item.cc
25
sql/item.cc
|
@ -1974,10 +1974,11 @@ bool Item_field::val_bool_result()
|
|||
|
||||
bool Item_field::eq(const Item *item, bool binary_cmp) const
|
||||
{
|
||||
if (item->type() != FIELD_ITEM)
|
||||
Item *real_item= ((Item *) item)->real_item();
|
||||
if (real_item->type() != FIELD_ITEM)
|
||||
return 0;
|
||||
|
||||
Item_field *item_field= (Item_field*) item;
|
||||
Item_field *item_field= (Item_field*) real_item;
|
||||
if (item_field->field && field)
|
||||
return item_field->field == field;
|
||||
/*
|
||||
|
@ -5592,6 +5593,21 @@ void Item_ref::make_field(Send_field *field)
|
|||
}
|
||||
|
||||
|
||||
Item *Item_ref::get_tmp_table_item(THD *thd)
|
||||
{
|
||||
if (!result_field)
|
||||
return (*ref)->get_tmp_table_item(thd);
|
||||
|
||||
Item_field *item= new Item_field(result_field);
|
||||
if (item)
|
||||
{
|
||||
item->table_name= table_name;
|
||||
item->db_name= db_name;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
void Item_ref_null_helper::print(String *str)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("<ref_null_helper>("));
|
||||
|
@ -5718,8 +5734,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
|
|||
DESCRIPTION
|
||||
A view column reference is considered equal to another column
|
||||
reference if the second one is a view column and if both column
|
||||
references resolve to the same item. It is assumed that both
|
||||
items are of the same type.
|
||||
references resolve to the same item.
|
||||
|
||||
RETURN
|
||||
TRUE Referenced item is equal to given item
|
||||
|
@ -5735,8 +5750,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
|
|||
if (item_ref->ref_type() == VIEW_REF)
|
||||
{
|
||||
Item *item_ref_ref= *(item_ref->ref);
|
||||
DBUG_ASSERT((*ref)->real_item()->type() ==
|
||||
item_ref_ref->real_item()->type());
|
||||
return ((*ref)->real_item() == item_ref_ref->real_item());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2031,11 +2031,7 @@ public:
|
|||
enum_field_types field_type() const { return (*ref)->field_type(); }
|
||||
Field *get_tmp_table_field()
|
||||
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); }
|
||||
Item *get_tmp_table_item(THD *thd)
|
||||
{
|
||||
return (result_field ? new Item_field(result_field) :
|
||||
(*ref)->get_tmp_table_item(thd));
|
||||
}
|
||||
Item *get_tmp_table_item(THD *thd);
|
||||
table_map used_tables() const
|
||||
{
|
||||
return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
|
||||
|
|
|
@ -1520,16 +1520,20 @@ void Item_func_neg::fix_length_and_dec()
|
|||
Use val() to get value as arg_type doesn't mean that item is
|
||||
Item_int or Item_real due to existence of Item_param.
|
||||
*/
|
||||
if (hybrid_type == INT_RESULT &&
|
||||
args[0]->type() == INT_ITEM &&
|
||||
((ulonglong) args[0]->val_int() > (ulonglong) LONGLONG_MIN))
|
||||
if (hybrid_type == INT_RESULT && args[0]->const_item())
|
||||
{
|
||||
/*
|
||||
Ensure that result is converted to DECIMAL, as longlong can't hold
|
||||
the negated number
|
||||
*/
|
||||
hybrid_type= DECIMAL_RESULT;
|
||||
DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT"));
|
||||
longlong val= args[0]->val_int();
|
||||
if ((ulonglong) val >= (ulonglong) LONGLONG_MIN &&
|
||||
((ulonglong) val != (ulonglong) LONGLONG_MIN ||
|
||||
args[0]->type() != INT_ITEM))
|
||||
{
|
||||
/*
|
||||
Ensure that result is converted to DECIMAL, as longlong can't hold
|
||||
the negated number
|
||||
*/
|
||||
hybrid_type= DECIMAL_RESULT;
|
||||
DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT"));
|
||||
}
|
||||
}
|
||||
unsigned_flag= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2499,7 +2503,6 @@ longlong Item_func_coercibility::val_int()
|
|||
|
||||
void Item_func_locate::fix_length_and_dec()
|
||||
{
|
||||
maybe_null= 0;
|
||||
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
|
||||
agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
|
||||
}
|
||||
|
|
|
@ -1143,8 +1143,9 @@ String *Item_func_substr::val_str(String *str)
|
|||
(arg_count == 3 && args[2]->null_value))))
|
||||
return 0; /* purecov: inspected */
|
||||
|
||||
/* Negative length, will return empty string. */
|
||||
if ((arg_count == 3) && (length <= 0) && !args[2]->unsigned_flag)
|
||||
/* Negative or zero length, will return empty string. */
|
||||
if ((arg_count == 3) && (length <= 0) &&
|
||||
(length == 0 || !args[2]->unsigned_flag))
|
||||
return &my_empty_string;
|
||||
|
||||
/* Assumes that the maximum length of a String is < INT_MAX32. */
|
||||
|
|
|
@ -1132,7 +1132,6 @@ void Log_event::print_header(IO_CACHE* file,
|
|||
}
|
||||
*c= '\0';
|
||||
|
||||
/* Non-full last line */
|
||||
if (hex_string[0])
|
||||
{
|
||||
char emit_buf[256];
|
||||
|
@ -2138,6 +2137,7 @@ Default database: '%s'. Query: '%s'",
|
|||
{
|
||||
DBUG_PRINT("info",("error ignored"));
|
||||
clear_all_errors(thd, const_cast<RELAY_LOG_INFO*>(rli));
|
||||
thd->killed= THD::NOT_KILLED;
|
||||
}
|
||||
/*
|
||||
Other cases: mostly we expected no error and get one.
|
||||
|
|
|
@ -116,13 +116,13 @@ static my_bool net_write_buff(NET *net,const uchar *packet,ulong len);
|
|||
my_bool my_net_init(NET *net, Vio* vio)
|
||||
{
|
||||
DBUG_ENTER("my_net_init");
|
||||
net->vio = vio;
|
||||
my_net_local_init(net); /* Set some limits */
|
||||
if (!(net->buff=(uchar*) my_malloc((size_t) net->max_packet+
|
||||
NET_HEADER_SIZE + COMP_HEADER_SIZE,
|
||||
MYF(MY_WME))))
|
||||
DBUG_RETURN(1);
|
||||
net->buff_end=net->buff+net->max_packet;
|
||||
net->vio = vio;
|
||||
net->no_send_ok= net->no_send_eof= net->no_send_error= 0;
|
||||
net->error=0; net->return_errno=0; net->return_status=0;
|
||||
net->pkt_nr=net->compress_pkt_nr=0;
|
||||
|
|
16
sql/sp.cc
16
sql/sp.cc
|
@ -654,13 +654,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
|
|||
|
||||
if (ret == SP_OK)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
sp_cache_invalidate();
|
||||
}
|
||||
|
||||
|
@ -727,13 +721,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
|
|||
|
||||
if (ret == SP_OK)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
sp_cache_invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -3143,12 +3143,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
|||
|
||||
if (!result) /* success */
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
|
@ -3315,12 +3310,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
|||
pthread_mutex_unlock(&acl_cache->lock);
|
||||
if (!result && !no_error)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
|
@ -3435,12 +3425,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
|||
|
||||
if (!result)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
|
@ -5469,11 +5454,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
|||
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
|
@ -5545,11 +5526,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
|||
DBUG_PRINT("info", ("thd->net.last_errno: %d", thd->net.last_errno));
|
||||
DBUG_PRINT("info", ("thd->net.last_error: %s", thd->net.last_error));
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
|
@ -5626,11 +5603,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
|
|||
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
|
@ -5814,11 +5787,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
|||
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
|
||||
rw_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
|
|
|
@ -3076,15 +3076,6 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
|
|||
}
|
||||
|
||||
|
||||
void THD::binlog_delete_pending_rows_event()
|
||||
{
|
||||
if (Rows_log_event *pending= binlog_get_pending_rows_event())
|
||||
{
|
||||
delete pending;
|
||||
binlog_set_pending_rows_event(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Member function that will log query, either row-based or
|
||||
statement-based depending on the value of the 'current_stmt_binlog_row_based'
|
||||
|
|
|
@ -1096,7 +1096,6 @@ public:
|
|||
Rows_log_event* binlog_get_pending_rows_event() const;
|
||||
void binlog_set_pending_rows_event(Rows_log_event* ev);
|
||||
int binlog_flush_pending_rows_event(bool stmt_end);
|
||||
void binlog_delete_pending_rows_event();
|
||||
|
||||
private:
|
||||
uint binlog_table_maps; // Number of table maps currently in the binlog
|
||||
|
|
|
@ -987,16 +987,11 @@ end:
|
|||
{
|
||||
if (!error)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
/*
|
||||
TRUNCATE must always be statement-based binlogged (not row-based) so
|
||||
we don't test current_stmt_binlog_row_based.
|
||||
*/
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
/*
|
||||
TRUNCATE must always be statement-based binlogged (not row-based) so
|
||||
we don't test current_stmt_binlog_row_based.
|
||||
*/
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
send_ok(thd); // This should return record count
|
||||
}
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
|
|
@ -2507,12 +2507,7 @@ end_with_restore_list:
|
|||
/*
|
||||
Presumably, REPAIR and binlog writing doesn't require synchronization
|
||||
*/
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error(); // No binlog error generated
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, 0, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
|
@ -2542,12 +2537,7 @@ end_with_restore_list:
|
|||
/*
|
||||
Presumably, ANALYZE and binlog writing doesn't require synchronization
|
||||
*/
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error(); // No binlog error generated
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, 0, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
|
@ -2569,12 +2559,7 @@ end_with_restore_list:
|
|||
/*
|
||||
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
|
||||
*/
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error(); // No binlog error generated
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, 0, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
}
|
||||
select_lex->table_list.first= (uchar*) first_table;
|
||||
lex->query_tables=all_tables;
|
||||
|
@ -3474,11 +3459,7 @@ end_with_restore_list:
|
|||
*/
|
||||
if (!lex->no_write_to_binlog && write_to_binlog)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, 0, FALSE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
}
|
||||
send_ok(thd);
|
||||
}
|
||||
|
|
|
@ -174,12 +174,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
|
|||
/* Lets hope this doesn't fail as the result will be messy */
|
||||
if (!silent && !error)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
send_ok(thd);
|
||||
}
|
||||
|
||||
|
|
|
@ -1355,8 +1355,7 @@ JOIN::optimize()
|
|||
there are aggregate functions, because in all these cases we need
|
||||
all result rows.
|
||||
*/
|
||||
ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order ||
|
||||
test(select_options & OPTION_BUFFER_RESULT)) &&
|
||||
ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order) &&
|
||||
!tmp_group &&
|
||||
!thd->lex->current_select->with_sum_func) ?
|
||||
select_limit : HA_POS_ERROR;
|
||||
|
@ -14542,6 +14541,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
|||
if (!item_field)
|
||||
DBUG_RETURN(TRUE); // Fatal error
|
||||
item_field->name= item->name;
|
||||
if (item->type() == Item::REF_ITEM)
|
||||
{
|
||||
Item_field *ifield= (Item_field *) item_field;
|
||||
Item_ref *iref= (Item_ref *) item;
|
||||
ifield->table_name= iref->table_name;
|
||||
ifield->db_name= iref->db_name;
|
||||
}
|
||||
#ifndef DBUG_OFF
|
||||
if (!item_field->name)
|
||||
{
|
||||
|
|
|
@ -66,10 +66,6 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
|
|||
ha_resolve_storage_engine_name(hton),
|
||||
"TABLESPACE or LOGFILE GROUP");
|
||||
}
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, TRUE);
|
||||
}
|
||||
write_bin_log(thd, FALSE, thd->query, thd->query_length);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
|
|
@ -307,14 +307,7 @@ end:
|
|||
|
||||
if (!result)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
|
||||
/* Such a statement can always go directly to binlog, no trans cache. */
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
stmt_query.ptr(), stmt_query.length(), FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, stmt_query.ptr(), stmt_query.length());
|
||||
}
|
||||
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
|
|
|
@ -493,12 +493,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||
rw_unlock(&THR_LOCK_udf);
|
||||
|
||||
/* Binlog the create function. */
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
|
||||
|
@ -569,12 +564,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
|
|||
rw_unlock(&THR_LOCK_udf);
|
||||
|
||||
/* Binlog the drop function. */
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::MYSQL_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
|
|
|
@ -1467,12 +1467,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if (mysql_bin_log.is_open())
|
||||
{
|
||||
thd->clear_error();
|
||||
thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
thd->query, thd->query_length, FALSE, FALSE);
|
||||
}
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
|
||||
send_ok(thd);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
|
|
Loading…
Reference in a new issue