Commit 350ec8b1 authored by unknown's avatar unknown

Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-4.1

into  mysql.com:/home/svoj/devel/mysql/merge/mysql-4.1-engines


mysql-test/r/myisam.result:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
sql/table.cc:
  Auto merged
parents 41773604 b8fe6206
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
#define USERNAME_LENGTH 16 #define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60 #define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5 #define SQLSTATE_LENGTH 5
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_BYTE_LEN NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN
#define LOCAL_HOST "localhost" #define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "." #define LOCAL_HOST_NAMEDPIPE "."
......
...@@ -1153,9 +1153,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -1153,9 +1153,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
/* We don't need to lock the key tree here as we don't allow /* We don't need to lock the key tree here as we don't allow
concurrent threads when running myisamchk concurrent threads when running myisamchk
*/ */
int search_result= (keyinfo->flag & HA_SPATIAL) ? int search_result=
#ifdef HAVE_RTREE_KEYS
(keyinfo->flag & HA_SPATIAL) ?
rtree_find_first(info, key, info->lastkey, key_length, rtree_find_first(info, key, info->lastkey, key_length,
MBR_EQUAL | MBR_DATA) : MBR_EQUAL | MBR_DATA) :
#endif
_mi_search(info,keyinfo,info->lastkey,key_length, _mi_search(info,keyinfo,info->lastkey,key_length,
SEARCH_SAME, info->s->state.key_root[key]); SEARCH_SAME, info->s->state.key_root[key]);
if (search_result) if (search_result)
...@@ -1366,7 +1369,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1366,7 +1369,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
param->temp_filename); param->temp_filename);
goto err; goto err;
} }
if (filecopy(param,new_file,info->dfile,0L,new_header_length, if (new_header_length &&
filecopy(param,new_file,info->dfile,0L,new_header_length,
"datafile-header")) "datafile-header"))
goto err; goto err;
info->s->state.dellink= HA_OFFSET_ERROR; info->s->state.dellink= HA_OFFSET_ERROR;
...@@ -2063,7 +2067,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, ...@@ -2063,7 +2067,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
param->temp_filename); param->temp_filename);
goto err; goto err;
} }
if (filecopy(param, new_file,info->dfile,0L,new_header_length, if (new_header_length &&
filecopy(param, new_file,info->dfile,0L,new_header_length,
"datafile-header")) "datafile-header"))
goto err; goto err;
if (param->testflag & T_UNPACK) if (param->testflag & T_UNPACK)
...@@ -2431,7 +2436,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, ...@@ -2431,7 +2436,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
param->temp_filename); param->temp_filename);
goto err; goto err;
} }
if (filecopy(param, new_file,info->dfile,0L,new_header_length, if (new_header_length &&
filecopy(param, new_file,info->dfile,0L,new_header_length,
"datafile-header")) "datafile-header"))
goto err; goto err;
if (param->testflag & T_UNPACK) if (param->testflag & T_UNPACK)
......
...@@ -747,6 +747,27 @@ select export_set(5, name, upper(name), ",", 5) from bug20536; ...@@ -747,6 +747,27 @@ select export_set(5, name, upper(name), ",", 5) from bug20536;
export_set(5, name, upper(name), ",", 5) export_set(5, name, upper(name), ",", 5)
test1,TEST1,test1,TEST1,TEST1 test1,TEST1,test1,TEST1,TEST1
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2' 'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
CREATE TABLE t1 (
status enum('active','passive') collate latin1_general_ci
NOT NULL default 'passive'
);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`status` enum('active','passive') character set latin1 collate latin1_general_ci NOT NULL default 'passive'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t1 ADD a int NOT NULL AFTER status;
CREATE TABLE t2 (
status enum('active','passive') collate ucs2_turkish_ci
NOT NULL default 'passive'
);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`status` enum('active','passive') character set ucs2 collate ucs2_turkish_ci NOT NULL default 'passive'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
ALTER TABLE t2 ADD a int NOT NULL AFTER status;
DROP TABLE t1,t2;
select password(name) from bug20536; select password(name) from bug20536;
password(name) password(name)
???????????????????? ????????????????????
......
...@@ -1340,15 +1340,3 @@ select a from t1 group by a; ...@@ -1340,15 +1340,3 @@ select a from t1 group by a;
a a
e e
drop table t1; drop table t1;
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
database()
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
...@@ -889,3 +889,50 @@ create temporary table if not exists t1 (a1 int); ...@@ -889,3 +889,50 @@ create temporary table if not exists t1 (a1 int);
execute stmt; execute stmt;
drop temporary table t1; drop temporary table t1;
deallocate prepare stmt; deallocate prepare stmt;
CREATE TABLE t1(
ID int(10) unsigned NOT NULL auto_increment,
Member_ID varchar(15) NOT NULL default '',
Action varchar(12) NOT NULL,
Action_Date datetime NOT NULL,
Track varchar(15) default NULL,
User varchar(12) default NULL,
Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
PRIMARY KEY (ID),
KEY Action (Action),
KEY Action_Date (Action_Date)
);
INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES
('111111', 'Disenrolled', '2006-03-01', 'CAD' ),
('111111', 'Enrolled', '2006-03-01', 'CAD' ),
('111111', 'Disenrolled', '2006-07-03', 'CAD' ),
('222222', 'Enrolled', '2006-03-07', 'CAD' ),
('222222', 'Enrolled', '2006-03-07', 'CHF' ),
('222222', 'Disenrolled', '2006-08-02', 'CHF' ),
('333333', 'Enrolled', '2006-03-01', 'CAD' ),
('333333', 'Disenrolled', '2006-03-01', 'CAD' ),
('444444', 'Enrolled', '2006-03-01', 'CAD' ),
('555555', 'Disenrolled', '2006-03-01', 'CAD' ),
('555555', 'Enrolled', '2006-07-21', 'CAD' ),
('555555', 'Disenrolled', '2006-03-01', 'CHF' ),
('666666', 'Enrolled', '2006-02-09', 'CAD' ),
('666666', 'Enrolled', '2006-05-12', 'CHF' ),
('666666', 'Disenrolled', '2006-06-01', 'CAD' );
PREPARE STMT FROM
"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1
WHERE Member_ID=? AND Action='Enrolled' AND
(Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1
WHERE Member_ID=?
GROUP BY Track
HAVING Track>='CAD' AND
MAX(Action_Date)>'2006-03-01')";
SET @id='111111';
EXECUTE STMT USING @id,@id;
GROUP_CONCAT(Track SEPARATOR ', ')
NULL
SET @id='222222';
EXECUTE STMT USING @id,@id;
GROUP_CONCAT(Track SEPARATOR ', ')
CAD
DEALLOCATE PREPARE STMT;
DROP TABLE t1;
#
# Setup
#
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
use test;
drop table if exists t1, t2, t3;
#
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
#
# We also check how the foreign_key_check variable is replicated
#
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
...@@ -38,6 +49,9 @@ select * from t2; ...@@ -38,6 +49,9 @@ select * from t2;
b c b c
5 0 5 0
6 11 6 11
#
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
#
drop table t2; drop table t2;
drop table t1; drop table t1;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
...@@ -68,11 +82,18 @@ b c ...@@ -68,11 +82,18 @@ b c
9 13 9 13
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS
#
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
SET FOREIGN_KEY_CHECKS=0; SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
#
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
#
drop table t1; drop table t1;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(a int); create table t2(a int);
...@@ -87,3 +108,6 @@ a ...@@ -87,3 +108,6 @@ a
1 1
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# End of 4.1 tests
#
...@@ -5,9 +5,15 @@ reset slave; ...@@ -5,9 +5,15 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
stop slave; stop slave;
#
# Generate a big enough master's binlog to cause relay log rotations
#
create table t1 (a int); create table t1 (a int);
drop table t1; drop table t1;
reset slave; reset slave;
#
# Test 1
#
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; set global max_relay_log_size=8192-1;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
...@@ -15,47 +21,248 @@ select @@global.max_relay_log_size; ...@@ -15,47 +21,248 @@ select @@global.max_relay_log_size;
4096 4096
start slave; start slave;
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 None 0 No # 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 50477
Relay_Log_File slave-relay-bin.000014
Relay_Log_Pos 1221
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 50477
Relay_Log_Space 1221
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 #
#
# Test 2
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 20480
20480
start slave; start slave;
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 None 0 No # 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 50477
Relay_Log_File slave-relay-bin.000004
Relay_Log_Pos 9457
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 50477
Relay_Log_Space 9457
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 #
#
# Test 3: max_relay_log_size = 0
#
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
@@global.max_relay_log_size @@global.max_relay_log_size 0
0
start slave; start slave;
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 None 0 No # 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 50477
Relay_Log_File slave-relay-bin.000008
Relay_Log_Pos 1283
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 50477
Relay_Log_Space 1283
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 #
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
stop slave; stop slave;
reset slave; reset slave;
flush logs; flush logs;
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File slave-relay-bin.000001
Relay_Log_Pos 4
Relay_Master_Log_File
Slave_IO_Running No
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 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space 4
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 #
#
# Test 5
#
reset slave; reset slave;
start slave; start slave;
flush logs; flush logs;
create table t1 (a int); create table t1 (a int);
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 None 0 No # 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 50535
Relay_Log_File slave-relay-bin.000009
Relay_Log_Pos 62
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 50535
Relay_Log_Space 62
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 #
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
flush logs; flush logs;
drop table t1; drop table t1;
show slave status; 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 Slave_IO_State #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 None 0 No # 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 50583
Relay_Log_File slave-relay-bin.000010
Relay_Log_Pos 52
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 50583
Relay_Log_Space 52
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 #
flush logs; flush logs;
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File master-bin.000002
master-bin.000002 4 Position 4
Binlog_Do_DB
Binlog_Ignore_DB
...@@ -2946,3 +2946,39 @@ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; ...@@ -2946,3 +2946,39 @@ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
a a b a a b
10 1 359 10 1 359
drop table t1,t2; drop table t1,t2;
CREATE TABLE t1 (
field1 int NOT NULL,
field2 int NOT NULL,
field3 int NOT NULL,
PRIMARY KEY (field1,field2,field3)
);
CREATE TABLE t2 (
fieldA int NOT NULL,
fieldB int NOT NULL,
PRIMARY KEY (fieldA,fieldB)
);
INSERT INTO t1 VALUES
(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
SELECT field1, field2, COUNT(*)
FROM t1 GROUP BY field1, field2;
field1 field2 COUNT(*)
1 1 2
1 2 3
1 3 1
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) >= ALL (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 2
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) < ANY (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 1
1 3
DROP TABLE t1, t2;
...@@ -482,6 +482,27 @@ select make_set(3, name, upper(name)) from bug20536; ...@@ -482,6 +482,27 @@ select make_set(3, name, upper(name)) from bug20536;
select export_set(5, name, upper(name)) from bug20536; select export_set(5, name, upper(name)) from bug20536;
select export_set(5, name, upper(name), ",", 5) from bug20536; select export_set(5, name, upper(name), ",", 5) from bug20536;
#
# Bug #20108: corrupted default enum value for a ucs2 field
#
CREATE TABLE t1 (
status enum('active','passive') collate latin1_general_ci
NOT NULL default 'passive'
);
SHOW CREATE TABLE t1;
ALTER TABLE t1 ADD a int NOT NULL AFTER status;
CREATE TABLE t2 (
status enum('active','passive') collate ucs2_turkish_ci
NOT NULL default 'passive'
);
SHOW CREATE TABLE t2;
ALTER TABLE t2 ADD a int NOT NULL AFTER status;
DROP TABLE t1,t2;
# Some broken functions: add these tests just to document current behavior. # Some broken functions: add these tests just to document current behavior.
# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would # PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
......
...@@ -1072,20 +1072,4 @@ explain select a from t1 group by a; ...@@ -1072,20 +1072,4 @@ explain select a from t1 group by a;
select a from t1 group by a; select a from t1 group by a;
drop table t1; drop table t1;
#
# Bug#20393: User name truncation in mysql client
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set names utf8;
#create user юзер_юзер@localhost;
grant select on test.* to юзер_юзер@localhost;
--exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
# End of 4.1 tests # End of 4.1 tests
...@@ -951,4 +951,56 @@ execute stmt; ...@@ -951,4 +951,56 @@ execute stmt;
drop temporary table t1; drop temporary table t1;
deallocate prepare stmt; deallocate prepare stmt;
#
# BUG#22085: Crash on the execution of a prepared statement that
# uses an IN subquery with aggregate functions in HAVING
#
CREATE TABLE t1(
ID int(10) unsigned NOT NULL auto_increment,
Member_ID varchar(15) NOT NULL default '',
Action varchar(12) NOT NULL,
Action_Date datetime NOT NULL,
Track varchar(15) default NULL,
User varchar(12) default NULL,
Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
PRIMARY KEY (ID),
KEY Action (Action),
KEY Action_Date (Action_Date)
);
INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES
('111111', 'Disenrolled', '2006-03-01', 'CAD' ),
('111111', 'Enrolled', '2006-03-01', 'CAD' ),
('111111', 'Disenrolled', '2006-07-03', 'CAD' ),
('222222', 'Enrolled', '2006-03-07', 'CAD' ),
('222222', 'Enrolled', '2006-03-07', 'CHF' ),
('222222', 'Disenrolled', '2006-08-02', 'CHF' ),
('333333', 'Enrolled', '2006-03-01', 'CAD' ),
('333333', 'Disenrolled', '2006-03-01', 'CAD' ),
('444444', 'Enrolled', '2006-03-01', 'CAD' ),
('555555', 'Disenrolled', '2006-03-01', 'CAD' ),
('555555', 'Enrolled', '2006-07-21', 'CAD' ),
('555555', 'Disenrolled', '2006-03-01', 'CHF' ),
('666666', 'Enrolled', '2006-02-09', 'CAD' ),
('666666', 'Enrolled', '2006-05-12', 'CHF' ),
('666666', 'Disenrolled', '2006-06-01', 'CAD' );
PREPARE STMT FROM
"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1
WHERE Member_ID=? AND Action='Enrolled' AND
(Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1
WHERE Member_ID=?
GROUP BY Track
HAVING Track>='CAD' AND
MAX(Action_Date)>'2006-03-01')";
SET @id='111111';
EXECUTE STMT USING @id,@id;
SET @id='222222';
EXECUTE STMT USING @id,@id;
DEALLOCATE PREPARE STMT;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
# See if queries that use both auto_increment and LAST_INSERT_ID() --echo #
# are replicated well --echo # Setup
--echo #
# We also check how the foreign_key_check variable is replicated
source include/master-slave.inc; source include/master-slave.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
use test;
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
--echo #
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
--echo # are replicated well
--echo #
--echo # We also check how the foreign_key_check variable is replicated
--echo #
connection master; connection master;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
create table t2(b int auto_increment, c int, key(b)); create table t2(b int auto_increment, c int, key(b));
...@@ -39,7 +50,9 @@ select * from t1; ...@@ -39,7 +50,9 @@ select * from t1;
select * from t2; select * from t2;
connection master; connection master;
# check if INSERT SELECT in auto_increment is well replicated (bug #490) --echo #
--echo # check if INSERT SELECT in auto_increment is well replicated (bug #490)
--echo #
drop table t2; drop table t2;
drop table t1; drop table t1;
...@@ -62,10 +75,11 @@ save_master_pos; ...@@ -62,10 +75,11 @@ save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
# --echo #
# Bug#8412: Error codes reported in binary log for CHARACTER SET, --echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
# FOREIGN_KEY_CHECKS --echo # FOREIGN_KEY_CHECKS
# --echo #
connection master; connection master;
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
CREATE TABLE t1 ( a INT UNIQUE ); CREATE TABLE t1 ( a INT UNIQUE );
...@@ -74,9 +88,10 @@ SET FOREIGN_KEY_CHECKS=0; ...@@ -74,9 +88,10 @@ SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (1),(1); INSERT INTO t1 VALUES (1),(1);
sync_slave_with_master; sync_slave_with_master;
# --echo #
# Bug#14553: NULL in WHERE resets LAST_INSERT_ID --echo # Bug#14553: NULL in WHERE resets LAST_INSERT_ID
# --echo #
connection master; connection master;
drop table t1; drop table t1;
create table t1(a int auto_increment, key(a)); create table t1(a int auto_increment, key(a));
...@@ -92,4 +107,7 @@ connection master; ...@@ -92,4 +107,7 @@ connection master;
drop table t1; drop table t1;
drop table t2; drop table t2;
sync_slave_with_master; sync_slave_with_master;
# End of 4.1 tests
--echo #
--echo # End of 4.1 tests
--echo #
...@@ -7,7 +7,11 @@ source include/master-slave.inc; ...@@ -7,7 +7,11 @@ source include/master-slave.inc;
connection slave; connection slave;
stop slave; stop slave;
connection master; connection master;
# Generate a big enough master's binlog to cause relay log rotations
--echo #
--echo # Generate a big enough master's binlog to cause relay log rotations
--echo #
create table t1 (a int); create table t1 (a int);
let $1=800; let $1=800;
disable_query_log; disable_query_log;
...@@ -23,6 +27,11 @@ drop table t1; ...@@ -23,6 +27,11 @@ drop table t1;
save_master_pos; save_master_pos;
connection slave; connection slave;
reset slave; reset slave;
--echo #
--echo # Test 1
--echo #
set global max_binlog_size=8192; set global max_binlog_size=8192;
set global max_relay_log_size=8192-1; # mapped to 4096 set global max_relay_log_size=8192-1; # mapped to 4096
select @@global.max_relay_log_size; select @@global.max_relay_log_size;
...@@ -30,7 +39,13 @@ start slave; ...@@ -30,7 +39,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 2
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=(5*4096); set global max_relay_log_size=(5*4096);
...@@ -39,7 +54,13 @@ start slave; ...@@ -39,7 +54,13 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 3: max_relay_log_size = 0
--echo #
stop slave; stop slave;
reset slave; reset slave;
set global max_relay_log_size=0; set global max_relay_log_size=0;
...@@ -48,9 +69,12 @@ start slave; ...@@ -48,9 +69,12 @@ start slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
# Tests below are mainly to ensure that we have not coded with wrong assumptions --echo #
--echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
--echo #
stop slave; stop slave;
reset slave; reset slave;
...@@ -59,8 +83,13 @@ reset slave; ...@@ -59,8 +83,13 @@ reset slave;
flush logs; flush logs;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
--echo #
--echo # Test 5
--echo #
reset slave; reset slave;
start slave; start slave;
sync_with_master; sync_with_master;
...@@ -75,8 +104,13 @@ connection slave; ...@@ -75,8 +104,13 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
# one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
--echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
--echo #
flush logs; flush logs;
connection master; connection master;
drop table t1; drop table t1;
...@@ -85,6 +119,7 @@ connection slave; ...@@ -85,6 +119,7 @@ connection slave;
sync_with_master; sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 33 # --replace_column 1 # 33 #
--vertical_results
show slave status; show slave status;
connection master; connection master;
......
...@@ -1911,4 +1911,41 @@ SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ...@@ -1911,4 +1911,41 @@ SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
drop table t1,t2; drop table t1,t2;
#
# Bug #21853: assert failure for a grouping query with
# an ALL/ANY quantified subquery in HAVING
#
CREATE TABLE t1 (
field1 int NOT NULL,
field2 int NOT NULL,
field3 int NOT NULL,
PRIMARY KEY (field1,field2,field3)
);
CREATE TABLE t2 (
fieldA int NOT NULL,
fieldB int NOT NULL,
PRIMARY KEY (fieldA,fieldB)
);
INSERT INTO t1 VALUES
(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
SELECT field1, field2, COUNT(*)
FROM t1 GROUP BY field1, field2;
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) >= ALL (SELECT fieldB
FROM t2 WHERE fieldA = field1);
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) < ANY (SELECT fieldB
FROM t2 WHERE fieldA = field1);
DROP TABLE t1, t2;
# End of 4.1 tests # End of 4.1 tests
...@@ -44,7 +44,9 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags) ...@@ -44,7 +44,9 @@ int my_chsize(File fd, my_off_t newlength, int filler, myf MyFlags)
DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength, DBUG_PRINT("my",("fd: %d length: %lu MyFlags: %d",fd,(ulong) newlength,
MyFlags)); MyFlags));
oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE)); if ((oldsize = my_seek(fd, 0L, MY_SEEK_END, MYF(MY_WME+MY_FAE))) == newlength)
DBUG_RETURN(0);
DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize)); DBUG_PRINT("info",("old_size: %ld", (ulong) oldsize));
if (oldsize > newlength) if (oldsize > newlength)
......
...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@' ...@@ -97,11 +97,11 @@ port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
# Create options # Create options
# We intentionally add a space to the beginning of lib strings, simplifies replace later # We intentionally add a space to the beginning and end of lib strings, simplifies replace later
libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@"
libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@" libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ "
libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@" libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ "
embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@" embedded_libs=" $ldflags -L$pkglibdir -lmysqld @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ "
cflags="-I$pkgincludedir @CFLAGS@ " #note: end space! cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
...@@ -111,8 +111,9 @@ include="-I$pkgincludedir" ...@@ -111,8 +111,9 @@ include="-I$pkgincludedir"
# and -xstrconst to make --cflags usable for Sun Forte C++ # and -xstrconst to make --cflags usable for Sun Forte C++
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \ for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*' \ DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
Xa xstrconst "xc99=none" Xa xstrconst "xc99=none" \
unroll2 ip mp restrict
do do
# The first option we might strip will always have a space before it because # The first option we might strip will always have a space before it because
# we set -I$pkgincludedir as the first option # we set -I$pkgincludedir as the first option
...@@ -121,7 +122,7 @@ done ...@@ -121,7 +122,7 @@ done
cflags=`echo "$cflags"|sed -e 's/ *\$//'` cflags=`echo "$cflags"|sed -e 's/ *\$//'`
# Same for --libs(_r) # Same for --libs(_r)
for remove in lmtmalloc for remove in lmtmalloc static-libcxa i-static
do do
# We know the strings starts with a space # We know the strings starts with a space
libs=`echo "$libs"|sed -e "s/ -$remove */ /g"` libs=`echo "$libs"|sed -e "s/ -$remove */ /g"`
......
...@@ -1618,7 +1618,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -1618,7 +1618,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const char *passwd, const char *db, const char *passwd, const char *db,
uint port, const char *unix_socket,ulong client_flag) uint port, const char *unix_socket,ulong client_flag)
{ {
char buff[NAME_BYTE_LEN+USERNAME_BYTE_LENGTH+100]; char buff[NAME_LEN+USERNAME_LENGTH+100];
char *end,*host_info; char *end,*host_info;
my_socket sock; my_socket sock;
in_addr_t ip_addr; in_addr_t ip_addr;
...@@ -2063,7 +2063,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2063,7 +2063,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql->server_status, client_flag)); mysql->server_status, client_flag));
/* This needs to be changed as it's not useful with big packets */ /* This needs to be changed as it's not useful with big packets */
if (user && user[0]) if (user && user[0])
strmake(end,user,USERNAME_BYTE_LENGTH); /* Max user name */ strmake(end,user,USERNAME_LENGTH); /* Max user name */
else else
read_user_name((char*) end); read_user_name((char*) end);
...@@ -2093,7 +2093,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, ...@@ -2093,7 +2093,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Add database if needed */ /* Add database if needed */
if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) if (db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
{ {
end= strmake(end, db, NAME_BYTE_LEN) + 1; end= strmake(end, db, NAME_LEN) + 1;
mysql->db= my_strdup(db,MYF(MY_WME)); mysql->db= my_strdup(db,MYF(MY_WME));
db= 0; db= 0;
} }
......
...@@ -1192,6 +1192,8 @@ public: ...@@ -1192,6 +1192,8 @@ public:
uint decimals,flags,pack_length; uint decimals,flags,pack_length;
Field::utype unireg_check; Field::utype unireg_check;
TYPELIB *interval; // Which interval to use TYPELIB *interval; // Which interval to use
TYPELIB *save_interval; // Temporary copy for the above
// Used only for UCS2 intervals
List<String> interval_list; List<String> interval_list;
CHARSET_INFO *charset; CHARSET_INFO *charset;
Field::geometry_type geom_type; Field::geometry_type geom_type;
......
...@@ -387,6 +387,7 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array, ...@@ -387,6 +387,7 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
} }
else if ((type() == SUM_FUNC_ITEM || else if ((type() == SUM_FUNC_ITEM ||
(used_tables() & ~PARAM_TABLE_BIT)) && (used_tables() & ~PARAM_TABLE_BIT)) &&
type() != SUBSELECT_ITEM &&
type() != REF_ITEM) type() != REF_ITEM)
{ {
/* /*
......
...@@ -2640,11 +2640,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, ...@@ -2640,11 +2640,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
while ((Str = str_list++)) while ((Str = str_list++))
{ {
if (Str->host.length > HOSTNAME_LENGTH || if (Str->host.length > HOSTNAME_LENGTH ||
system_charset_info->cset->charpos(system_charset_info, Str->user.length > USERNAME_LENGTH)
Str->user.str,
Str->user.str +
Str->user.length,
USERNAME_LENGTH) < Str->user.length)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1; result= -1;
......
...@@ -902,8 +902,8 @@ static int check_connection(THD *thd) ...@@ -902,8 +902,8 @@ static int check_connection(THD *thd)
char *user= end; char *user= end;
char *passwd= strend(user)+1; char *passwd= strend(user)+1;
char *db= passwd; char *db= passwd;
char db_buff[NAME_BYTE_LEN + 1]; // buffer to store db in utf8 char db_buff[NAME_LEN + 1]; // buffer to store db in utf8
char user_buff[USERNAME_BYTE_LENGTH + 1]; // buffer to store user in utf8 char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors; uint dummy_errors;
/* /*
......
...@@ -290,8 +290,6 @@ JOIN::prepare(Item ***rref_pointer_array, ...@@ -290,8 +290,6 @@ JOIN::prepare(Item ***rref_pointer_array,
select_lex->having_fix_field= 0; select_lex->having_fix_field= 0;
if (having_fix_rc || thd->net.report_error) if (having_fix_rc || thd->net.report_error)
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(-1); /* purecov: inspected */
if (having->with_sum_func)
having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
} }
// Is it subselect // Is it subselect
...@@ -306,6 +304,9 @@ JOIN::prepare(Item ***rref_pointer_array, ...@@ -306,6 +304,9 @@ JOIN::prepare(Item ***rref_pointer_array,
} }
} }
if (having && having->with_sum_func)
having->split_sum_func2(thd, ref_pointer_array, all_fields, &having);
if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */ if (setup_ftfuncs(select_lex)) /* should be after having->fix_fields */
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -4803,14 +4803,16 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING_sys ...@@ -4803,14 +4803,16 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING_sys
LOAD TABLE_SYM table_ident FROM MASTER_SYM LOAD TABLE_SYM table_ident FROM MASTER_SYM
{ {
Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER", "mysqldump or future BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT; YYABORT;
} }
| |
LOAD DATA_SYM FROM MASTER_SYM LOAD DATA_SYM FROM MASTER_SYM
{ {
Lex->sql_command = SQLCOM_LOAD_MASTER_DATA; Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
WARN_DEPRECATED("LOAD DATA FROM MASTER", "mysqldump or future BACKUP/RESTORE DATABASE facility");
}; };
opt_local: opt_local:
......
...@@ -1420,7 +1420,7 @@ char *get_field(MEM_ROOT *mem, Field *field) ...@@ -1420,7 +1420,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool check_db_name(char *name) bool check_db_name(char *name)
{ {
uint name_length= 0; // name length in symbols char *start= name;
/* Used to catch empty names and names with end space */ /* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE; bool last_char_is_space= TRUE;
...@@ -1437,7 +1437,6 @@ bool check_db_name(char *name) ...@@ -1437,7 +1437,6 @@ bool check_db_name(char *name)
name+system_charset_info->mbmaxlen); name+system_charset_info->mbmaxlen);
if (len) if (len)
{ {
name_length++;
name += len; name += len;
continue; continue;
} }
...@@ -1445,13 +1444,12 @@ bool check_db_name(char *name) ...@@ -1445,13 +1444,12 @@ bool check_db_name(char *name)
#else #else
last_char_is_space= *name==' '; last_char_is_space= *name==' ';
#endif #endif
name_length++;
if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR || if (*name == '/' || *name == '\\' || *name == FN_LIBCHAR ||
*name == FN_EXTCHAR) *name == FN_EXTCHAR)
return 1; return 1;
name++; name++;
} }
return (last_char_is_space || name_length > NAME_LEN); return last_char_is_space || (uint) (name - start) > NAME_LEN;
} }
......
...@@ -190,13 +190,19 @@ bool mysql_create_frm(THD *thd, my_string file_name, ...@@ -190,13 +190,19 @@ bool mysql_create_frm(THD *thd, my_string file_name,
goto err3; goto err3;
{ {
/* Unescape all UCS2 intervals: were escaped in pack_headers */ /*
Restore all UCS2 intervals.
HEX representation of them is not needed anymore.
*/
List_iterator<create_field> it(create_fields); List_iterator<create_field> it(create_fields);
create_field *field; create_field *field;
while ((field=it++)) while ((field=it++))
{ {
if (field->interval && field->charset->mbminlen > 1) if (field->save_interval)
unhex_type2(field->interval); {
field->interval= field->save_interval;
field->save_interval= 0;
}
} }
} }
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -452,18 +458,36 @@ static bool pack_header(uchar *forminfo, enum db_type table_type, ...@@ -452,18 +458,36 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
reclength=(uint) (field->offset+ data_offset + length); reclength=(uint) (field->offset+ data_offset + length);
n_length+= (ulong) strlen(field->field_name)+1; n_length+= (ulong) strlen(field->field_name)+1;
field->interval_id=0; field->interval_id=0;
field->save_interval= 0;
if (field->interval) if (field->interval)
{ {
uint old_int_count=int_count; uint old_int_count=int_count;
if (field->charset->mbminlen > 1) if (field->charset->mbminlen > 1)
{ {
/* Escape UCS2 intervals using HEX notation */ /*
Escape UCS2 intervals using HEX notation to avoid
problems with delimiters between enum elements.
As the original representation is still needed in
the function make_empty_rec to create a record of
filled with default values it is saved in save_interval
The HEX representation is created from this copy.
*/
field->save_interval= field->interval;
field->interval= (TYPELIB*) sql_alloc(sizeof(TYPELIB));
*field->interval= *field->save_interval;
field->interval->type_names=
(const char **) sql_alloc(sizeof(char*) *
(field->interval->count+1));
field->interval->type_names[field->interval->count]= 0;
field->interval->type_lengths=
(uint *) sql_alloc(sizeof(uint) * field->interval->count);
for (uint pos= 0; pos < field->interval->count; pos++) for (uint pos= 0; pos < field->interval->count; pos++)
{ {
char *dst; char *dst;
uint length= field->interval->type_lengths[pos], hex_length; uint length= field->save_interval->type_lengths[pos], hex_length;
const char *src= field->interval->type_names[pos]; const char *src= field->save_interval->type_names[pos];
const char *srcend= src + length; const char *srcend= src + length;
hex_length= length * 2; hex_length= length * 2;
field->interval->type_lengths[pos]= hex_length; field->interval->type_lengths[pos]= hex_length;
...@@ -715,7 +739,8 @@ static bool make_empty_rec(File file,enum db_type table_type, ...@@ -715,7 +739,8 @@ static bool make_empty_rec(File file,enum db_type table_type,
field->charset, field->charset,
field->geom_type, field->geom_type,
field->unireg_check, field->unireg_check,
field->interval, field->save_interval ? field->save_interval :
field->interval,
field->field_name, field->field_name,
&table); &table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment