summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-12-19 16:25:50 +0200
committerunknown <monty@mysql.com>2003-12-19 16:25:50 +0200
commit9c2a63e35eec7a1af94dde1f10331361124a69f4 (patch)
tree87e8ff9b43e2e71fc79bfa2e296018b89b08a9e1
parent0fb88806e44f48aba363bfda5ebedaaa3b05b975 (diff)
downloadmariadb-git-9c2a63e35eec7a1af94dde1f10331361124a69f4.tar.gz
Fixes after merge with 4.0
Cleaned up embedded library access and query cache handling Changed min stack size to 128K (to allow longer MyISAM keys) Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work) client/mysqldump.c: Fixed bugs found after merge include/mysql_embed.h: Disable query cache when using embedded version myisam/mi_check.c: Removed not used variable mysql-test/r/auto_increment.result: Fixed bugs found after merge mysql-test/r/bdb.result: Fixed bugs found after merge mysql-test/r/func_group.result: Fixed bugs found after merge mysql-test/r/func_str.result: Fixed bugs found after merge mysql-test/r/func_time.result: Fixed bugs found after merge mysql-test/r/group_by.result: Fixed bugs found after merge mysql-test/r/innodb.result: Fixed bugs found after merge mysql-test/r/insert.result: Fixed bugs found after merge mysql-test/r/join_outer.result: Fixed bugs found after merge mysql-test/r/loaddata.result: Fixed bugs found after merge mysql-test/r/multi_update.result: Fixed bugs found after merge mysql-test/r/mysqldump.result: Update results mysql-test/r/rpl_EE_error.result: Fixed bugs found after merge mysql-test/r/rpl_multi_update.result: Fixed bugs found after merge mysql-test/r/symlink.result: Update results mysql-test/r/type_blob.result: Update results mysql-test/r/type_datetime.result: Update results mysql-test/r/type_decimal.result: Update results mysql-test/r/type_enum.result: Fixed bugs found after merge mysql-test/r/type_timestamp.result: Update results mysql-test/r/union.result: Update results mysql-test/r/warnings.result: Update results mysql-test/t/bdb.test: Fix test for 4.1 mysql-test/t/innodb.test: Fix test for 4.1 mysql-test/t/multi_update.test: Fix test for 4.1 mysql-test/t/mysqldump.test: Fix test for 4.1 mysql-test/t/rpl_EE_error.test: Fix test for 4.1 mysql-test/t/rpl_multi_update.test: Fix test for 4.1 mysql-test/t/union.test: Cleanup mysys/charset.c: Check results from my_once_alloc() mysys/my_handler.c: part of 4.0 merge sql-common/client.c: Part of 4.0 merge sql/field.cc: After merge fixes sql/field.h: After merge fixes sql/ha_innodb.cc: Remove duplicate include files sql/item.cc: Changed automatic int conversion to be of type binary sql/item.h: After merge fixes sql/item_func.cc: Changed automatic int conversion to be of type binary sql/item_func.h: After merge fixes sql/item_strfunc.cc: Added comments sql/item_subselect.cc: Indentation fixes sql/item_sum.cc: Changed automatic int conversion to be of type binary sql/item_sum.h: After merge fixes sql/mysql_priv.h: Cleanup embedded library access checks sql/mysqld.cc: Changed min stack size to 128K (to allow longer MyISAM keys) sql/set_var.cc: Fixed compiler warnings sql/share/czech/errmsg.txt: Better error message sql/share/danish/errmsg.txt: Better error message sql/share/dutch/errmsg.txt: Better error message sql/share/english/errmsg.txt: Better error message sql/share/estonian/errmsg.txt: Better error message sql/share/french/errmsg.txt: Better error message sql/share/greek/errmsg.txt: Better error message sql/share/hungarian/errmsg.txt: Better error message sql/share/italian/errmsg.txt: Better error message sql/share/japanese/errmsg.txt: Better error message sql/share/korean/errmsg.txt: Better error message sql/share/norwegian-ny/errmsg.txt: Better error message sql/share/norwegian/errmsg.txt: Better error message sql/share/polish/errmsg.txt: Better error message sql/share/romanian/errmsg.txt: Better error message sql/share/russian/errmsg.txt: Better error message sql/share/serbian/errmsg.txt: Better error message sql/share/slovak/errmsg.txt: Better error message sql/share/spanish/errmsg.txt: Better error message sql/share/swedish/errmsg.txt: Better error message sql/share/ukrainian/errmsg.txt: Better error message sql/sql_acl.h: Cleaned up embedded library acccess checks sql/sql_base.cc: After merge fixes sql/sql_client.cc: After merge fixes sql/sql_parse.cc: After merge fixes Changed access check code for embedded library (needed to make code shorter and ensure that check_table_access() is called) Recoded create-table handling for CREATE TABLE ... SELECT to make code shorter and faster sql/sql_prepare.cc: Add missing arguments sql/sql_select.cc: After merge fixes sql/sql_update.cc: After merge fixes sql/sql_yacc.yy: Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work) sql/table.cc: After merge fixes
-rw-r--r--client/mysqldump.c25
-rw-r--r--include/mysql_embed.h2
-rw-r--r--myisam/mi_check.c5
-rw-r--r--mysql-test/r/auto_increment.result52
-rw-r--r--mysql-test/r/bdb.result4
-rw-r--r--mysql-test/r/func_group.result15
-rw-r--r--mysql-test/r/func_str.result337
-rw-r--r--mysql-test/r/func_time.result109
-rw-r--r--mysql-test/r/group_by.result11
-rw-r--r--mysql-test/r/innodb.result48
-rw-r--r--mysql-test/r/insert.result1
-rw-r--r--mysql-test/r/join_outer.result9
-rw-r--r--mysql-test/r/loaddata.result10
-rw-r--r--mysql-test/r/multi_update.result2
-rw-r--r--mysql-test/r/mysqldump.result48
-rw-r--r--mysql-test/r/rpl_EE_error.result10
-rw-r--r--mysql-test/r/rpl_multi_update.result9
-rw-r--r--mysql-test/r/symlink.result8
-rw-r--r--mysql-test/r/type_blob.result2
-rw-r--r--mysql-test/r/type_datetime.result6
-rw-r--r--mysql-test/r/type_decimal.result2
-rw-r--r--mysql-test/r/type_enum.result4
-rw-r--r--mysql-test/r/type_timestamp.result41
-rw-r--r--mysql-test/r/union.result3
-rw-r--r--mysql-test/r/warnings.result4
-rw-r--r--mysql-test/t/bdb.test4
-rw-r--r--mysql-test/t/innodb.test12
-rw-r--r--mysql-test/t/multi_update.test3
-rw-r--r--mysql-test/t/mysqldump.test8
-rw-r--r--mysql-test/t/rpl_EE_error.test4
-rw-r--r--mysql-test/t/rpl_multi_update.test5
-rw-r--r--mysql-test/t/union.test3
-rw-r--r--mysys/charset.c76
-rw-r--r--mysys/my_handler.c8
-rw-r--r--sql-common/client.c7
-rw-r--r--sql/field.cc7
-rw-r--r--sql/field.h11
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/item.cc4
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_func.cc31
-rw-r--r--sql/item_func.h3
-rw-r--r--sql/item_strfunc.cc8
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/item_sum.cc12
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc6
-rw-r--r--sql/share/czech/errmsg.txt4
-rw-r--r--sql/share/danish/errmsg.txt4
-rw-r--r--sql/share/dutch/errmsg.txt4
-rw-r--r--sql/share/english/errmsg.txt4
-rw-r--r--sql/share/estonian/errmsg.txt4
-rw-r--r--sql/share/french/errmsg.txt4
-rw-r--r--sql/share/greek/errmsg.txt4
-rw-r--r--sql/share/hungarian/errmsg.txt4
-rw-r--r--sql/share/italian/errmsg.txt4
-rw-r--r--sql/share/japanese/errmsg.txt4
-rw-r--r--sql/share/korean/errmsg.txt4
-rw-r--r--sql/share/norwegian-ny/errmsg.txt4
-rw-r--r--sql/share/norwegian/errmsg.txt4
-rw-r--r--sql/share/polish/errmsg.txt4
-rw-r--r--sql/share/romanian/errmsg.txt4
-rw-r--r--sql/share/russian/errmsg.txt4
-rw-r--r--sql/share/serbian/errmsg.txt4
-rw-r--r--sql/share/slovak/errmsg.txt4
-rw-r--r--sql/share/spanish/errmsg.txt4
-rw-r--r--sql/share/swedish/errmsg.txt4
-rw-r--r--sql/share/ukrainian/errmsg.txt4
-rw-r--r--sql/sql_acl.h12
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_client.cc3
-rw-r--r--sql/sql_parse.cc275
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_update.cc3
-rw-r--r--sql/sql_yacc.yy2
-rw-r--r--sql/table.cc3
79 files changed, 908 insertions, 494 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index d5c80b31141..99bca9d96a4 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1427,25 +1427,16 @@ static void dumpTable(uint numFields, char *table)
(*ptr == '-' && my_isalpha(charset_info, ptr[1])))
fputs("NULL", md_result_file);
else if (field->type == FIELD_TYPE_DECIMAL)
- {
- /* add " signs around */
- fputs("\"", md_result_file);
- fputs(ptr, md_result_file);
- fputs("\"", md_result_file);
- }
- else
- fputs(ptr, md_result_file);
- }
+ {
+ /* add " signs around */
+ fputs("\"", md_result_file);
+ fputs(ptr, md_result_file);
+ fputs("\"", md_result_file);
+ }
+ else
+ fputs(ptr, md_result_file);
}
}
- else
- {
- if (opt_xml)
- print_xml_tag1(md_result_file, "\t\t", "field name=",
- field->name, "NULL</field>\n");
- else
- fputs("NULL", md_result_file);
- }
}
}
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index 7a169d4133e..df358e29872 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -32,4 +32,6 @@
#undef MYSQL_SERVER_SUFFIX
#define MYSQL_SERVER_SUFFIX "-embedded"
+#undef HAVE_QUERY_CACHE /* Cache dosn't work yet */
+
#endif /* EMBEDDED_LIBRARY */
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 02bca2911b4..a55929805fa 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -512,6 +512,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
DBUG_RETURN(result);
} /* chk_key */
+
static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level)
@@ -553,7 +554,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
uint used_length,comp_flag,nod_flag,key_length,not_used;
uchar key[MI_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos;
my_off_t next_page,record;
- char llbuff[22],llbuff2[22];
+ char llbuff[22];
DBUG_ENTER("chk_index");
DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
@@ -651,7 +652,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (record >= info->state->data_file_length)
{
#ifndef DBUG_OFF
- char llbuff3[22];
+ char llbuff2[22], llbuff3[22];
#endif
mi_check_print_error(param,"Found key at page %s that points to record outside datafile",llstr(page,llbuff));
DBUG_PRINT("test",("page: %s record: %s filelength: %s",
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 1390141df51..89d07af6cf3 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -106,6 +106,32 @@ Table Op Msg_type Msg_text
test.t1 check warning Found row where the auto_increment column has the value 0
test.t1 check status OK
drop table t1;
+create table t1 (a int not null auto_increment primary key);
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+last_insert_id()
+1
+insert into t1 values (NULL);
+select * from t1;
+a
+-1
+1
+2
+drop table t1;
+create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
+insert into t1 values (NULL);
+insert into t1 values (-1);
+select last_insert_id();
+last_insert_id()
+1
+insert into t1 values (NULL);
+select * from t1;
+a
+-1
+1
+2
+drop table t1;
create table t1 (i tinyint unsigned not null auto_increment primary key);
insert into t1 set i = 254;
insert into t1 set i = null;
@@ -244,29 +270,3 @@ a b
0 13
500 14
drop table t1;
-create table t1 (a int not null auto_increment primary key);
-insert into t1 values (NULL);
-insert into t1 values (-1);
-select last_insert_id();
-last_insert_id()
-1
-insert into t1 values (NULL);
-select * from t1;
-a
--1
-1
-2
-drop table t1;
-create table t1 (a int not null auto_increment primary key) /*!41002 type=heap */;
-insert into t1 values (NULL);
-insert into t1 values (-1);
-select last_insert_id();
-last_insert_id()
-1
-insert into t1 values (NULL);
-select * from t1;
-a
--1
-1
-2
-drop table t1;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index dd5633af90d..b02574cf8a3 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -1145,14 +1145,14 @@ x
7
6
drop table t1;
-create table t1 ( c char(8) not null ) type=bdb;
+create table t1 ( c char(8) not null ) engine=bdb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index ec00c850197..6a704f2847d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -47,7 +47,7 @@ sum(all a) count(all a) avg(all a) std(all a) variance(all a) bit_or(all a) bit_
21 6 3.5000 1.7078 2.9167 7 0 1 6 E
select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
grp sum(a) count(a) avg(a) std(a) variance(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
-NULL NULL 0 NULL NULL NULL 0 1844674407379551615 NULL NULL
+NULL NULL 0 NULL NULL NULL 0 18446744073709551615 NULL NULL
1 1 1 1.0000 0.0000 0.0000 1 1 1 1 a a
2 5 2 2.5000 0.5000 0.2500 3 2 2 3 b c
3 15 3 5.0000 0.8165 0.6667 7 4 4 6 C E
@@ -576,8 +576,8 @@ insert into t1 values (1,null);
insert into t1 values (2,null);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 0 NULL NULL NULL NULL NULL 0 0
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
@@ -585,8 +585,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
insert into t1 values (2,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 1 1 1.0000 0.0000 1 1 0 1
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
@@ -594,8 +594,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
insert into t1 values (3,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
-1 0 NULL NULL NULL NULL NULL 0 0
-2 1 1 1.0000 0.0000 1 1 0 1
+1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
+2 1 1 1.0000 0.0000 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
@@ -643,4 +643,3 @@ bit_and(col) bit_or(col)
18446744073709551614 18446744073709551614
18446744073709551615 18446744073709551615
drop table t1;
-
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index aaebd33d010..c74feccfb7f 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -268,3 +268,340 @@ INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
1
DROP TABLE t1;
+select 1=_latin1'1';
+1=_latin1'1'
+1
+select _latin1'1'=1;
+_latin1'1'=1
+1
+select _latin2'1'=1;
+_latin2'1'=1
+1
+select 1=_latin2'1';
+1=_latin2'1'
+1
+select _latin1'1'=_latin2'1';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '='
+select row('a','b','c') = row('a','b','c');
+row('a','b','c') = row('a','b','c')
+1
+select row('A','b','c') = row('a','b','c');
+row('A','b','c') = row('a','b','c')
+1
+select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
+row('A' COLLATE latin1_bin,'b','c') = row('a','b','c')
+0
+select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
+row('A','b','c') = row('a' COLLATE latin1_bin,'b','c')
+0
+select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation '='
+select concat(_latin1'a',_latin2'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat'
+select concat(_latin1'a',_latin2'a',_latin5'a');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin5_turkish_ci,COERCIBLE) for operation 'concat'
+select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
+ERROR HY000: Illegal mix of collations for operation 'concat'
+select FIELD('b','A','B');
+FIELD('b','A','B')
+2
+select FIELD('B','A','B');
+FIELD('B','A','B')
+2
+select FIELD('b' COLLATE latin1_bin,'A','B');
+FIELD('b' COLLATE latin1_bin,'A','B')
+0
+select FIELD('b','A' COLLATE latin1_bin,'B');
+FIELD('b','A' COLLATE latin1_bin,'B')
+0
+select FIELD(_latin2'b','A','B');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
+select FIELD('b',_latin2'A','B');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'field'
+select FIELD('b',_latin2'A','B',1);
+FIELD('b',_latin2'A','B',1)
+1
+select POSITION(_latin1'B' IN _latin1'abcd');
+POSITION(_latin1'B' IN _latin1'abcd')
+2
+select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
+POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin)
+0
+select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
+POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd')
+0
+select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_general_ci,EXPLICIT) for operation 'locate'
+select POSITION(_latin1'B' IN _latin2'abcd');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'locate'
+select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d');
+FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')
+2
+select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'find_in_set'
+select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'find_in_set'
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
+SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2)
+abcdabc
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substr_index'
+select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substr_index'
+select _latin1'B' between _latin1'a' and _latin1'c';
+_latin1'B' between _latin1'a' and _latin1'c'
+1
+select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c';
+_latin1'B' collate latin1_bin between _latin1'a' and _latin1'c'
+0
+select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c';
+_latin1'B' between _latin1'a' collate latin1_bin and _latin1'c'
+0
+select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin;
+_latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin
+0
+select _latin2'B' between _latin1'a' and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' between _latin2'a' and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' between _latin1'a' and _latin2'b';
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation 'between'
+select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b';
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation 'between'
+select _latin1'B' in (_latin1'a',_latin1'b');
+_latin1'B' in (_latin1'a',_latin1'b')
+1
+select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
+_latin1'B' collate latin1_bin in (_latin1'a',_latin1'b')
+0
+select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
+_latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b')
+0
+select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
+_latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin)
+0
+select _latin2'B' in (_latin1'a',_latin1'b');
+ERROR HY000: Illegal mix of collations (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' in (_latin2'a',_latin1'b');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' in (_latin1'a',_latin2'b');
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE), (latin1_swedish_ci,COERCIBLE), (latin2_general_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_bin,EXPLICIT), (latin1_swedish_ci,COERCIBLE) for operation ' IN '
+select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_swedish_ci,COERCIBLE), (latin1_bin,EXPLICIT) for operation ' IN '
+select collation(bin(130)), coercibility(bin(130));
+collation(bin(130)) coercibility(bin(130))
+latin1_swedish_ci 3
+select collation(oct(130)), coercibility(oct(130));
+collation(oct(130)) coercibility(oct(130))
+latin1_swedish_ci 3
+select collation(conv(130,16,10)), coercibility(conv(130,16,10));
+collation(conv(130,16,10)) coercibility(conv(130,16,10))
+latin1_swedish_ci 3
+select collation(hex(130)), coercibility(hex(130));
+collation(hex(130)) coercibility(hex(130))
+latin1_swedish_ci 3
+select collation(char(130)), coercibility(hex(130));
+collation(char(130)) coercibility(hex(130))
+binary 3
+select collation(format(130,10)), coercibility(format(130,10));
+collation(format(130,10)) coercibility(format(130,10))
+latin1_swedish_ci 3
+select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
+collation(lcase(_latin2'a')) coercibility(lcase(_latin2'a'))
+latin2_general_ci 3
+select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
+collation(ucase(_latin2'a')) coercibility(ucase(_latin2'a'))
+latin2_general_ci 3
+select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
+collation(left(_latin2'a',1)) coercibility(left(_latin2'a',1))
+latin2_general_ci 3
+select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
+collation(right(_latin2'a',1)) coercibility(right(_latin2'a',1))
+latin2_general_ci 3
+select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
+collation(substring(_latin2'a',1,1)) coercibility(substring(_latin2'a',1,1))
+latin2_general_ci 3
+select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
+collation(concat(_latin2'a',_latin2'b')) coercibility(concat(_latin2'a',_latin2'b'))
+latin2_general_ci 3
+select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b'));
+collation(lpad(_latin2'a',4,_latin2'b')) coercibility(lpad(_latin2'a',4,_latin2'b'))
+latin2_general_ci 3
+select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b'));
+collation(rpad(_latin2'a',4,_latin2'b')) coercibility(rpad(_latin2'a',4,_latin2'b'))
+latin2_general_ci 3
+select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
+collation(concat_ws(_latin2'a',_latin2'b')) coercibility(concat_ws(_latin2'a',_latin2'b'))
+latin2_general_ci 3
+select collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')), coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'));
+collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')) coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'))
+latin2_general_ci 3
+select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')), coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '));
+collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')) coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '))
+binary 3
+select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a '));
+collation(trim(_latin2' a ')) coercibility(trim(_latin2' a '))
+latin2_general_ci 3
+select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a '));
+collation(ltrim(_latin2' a ')) coercibility(ltrim(_latin2' a '))
+latin2_general_ci 3
+select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a '));
+collation(rtrim(_latin2' a ')) coercibility(rtrim(_latin2' a '))
+latin2_general_ci 3
+select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a'));
+collation(trim(LEADING _latin2' ' FROM _latin2'a')) coercibility(trim(LEADING _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'));
+collation(trim(TRAILING _latin2' ' FROM _latin2'a')) coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
+collation(trim(BOTH _latin2' ' FROM _latin2'a')) coercibility(trim(BOTH _latin2'a' FROM _latin2'a'))
+latin2_general_ci 3
+select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
+collation(repeat(_latin2'a',10)) coercibility(repeat(_latin2'a',10))
+latin2_general_ci 3
+select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
+collation(reverse(_latin2'ab')) coercibility(reverse(_latin2'ab'))
+latin2_general_ci 3
+select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
+collation(quote(_latin2'ab')) coercibility(quote(_latin2'ab'))
+latin2_general_ci 3
+select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
+collation(soundex(_latin2'ab')) coercibility(soundex(_latin2'ab'))
+latin2_general_ci 3
+select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
+collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1))
+latin2_general_ci 3
+select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
+collation(insert(_latin2'abcd',2,3,_latin2'ef')) coercibility(insert(_latin2'abcd',2,3,_latin2'ef'))
+latin2_general_ci 3
+select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
+collation(replace(_latin2'abcd',_latin2'b',_latin2'B')) coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'))
+latin2_general_ci 3
+create table t1
+select
+bin(130),
+oct(130),
+conv(130,16,10),
+hex(130),
+char(130),
+format(130,10),
+left(_latin2'a',1),
+right(_latin2'a',1),
+lcase(_latin2'a'),
+ucase(_latin2'a'),
+substring(_latin2'a',1,1),
+concat(_latin2'a',_latin2'b'),
+lpad(_latin2'a',4,_latin2'b'),
+rpad(_latin2'a',4,_latin2'b'),
+concat_ws(_latin2'a',_latin2'b'),
+make_set(255,_latin2'a',_latin2'b',_latin2'c'),
+export_set(255,_latin2'y',_latin2'n',_latin2' '),
+trim(_latin2' a '),
+ltrim(_latin2' a '),
+rtrim(_latin2' a '),
+trim(LEADING _latin2' ' FROM _latin2' a '),
+trim(TRAILING _latin2' ' FROM _latin2' a '),
+trim(BOTH _latin2' ' FROM _latin2' a '),
+repeat(_latin2'a',10),
+reverse(_latin2'ab'),
+quote(_latin2'ab'),
+soundex(_latin2'ab'),
+substring(_latin2'ab',1),
+insert(_latin2'abcd',2,3,_latin2'ef'),
+replace(_latin2'abcd',_latin2'b',_latin2'B')
+;
+Warnings:
+Warning 1264 Data truncated for column 'format(130,10)' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `bin(130)` char(64) NOT NULL default '',
+ `oct(130)` char(64) NOT NULL default '',
+ `conv(130,16,10)` char(64) NOT NULL default '',
+ `hex(130)` char(6) NOT NULL default '',
+ `char(130)` char(1) NOT NULL default '',
+ `format(130,10)` char(4) NOT NULL default '',
+ `left(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
+ `right(_latin2'a',1)` char(1) character set latin2 NOT NULL default '',
+ `lcase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
+ `ucase(_latin2'a')` char(1) character set latin2 NOT NULL default '',
+ `substring(_latin2'a',1,1)` char(1) character set latin2 NOT NULL default '',
+ `concat(_latin2'a',_latin2'b')` char(2) character set latin2 NOT NULL default '',
+ `lpad(_latin2'a',4,_latin2'b')` char(4) character set latin2 NOT NULL default '',
+ `rpad(_latin2'a',4,_latin2'b')` char(4) character set latin2 NOT NULL default '',
+ `concat_ws(_latin2'a',_latin2'b')` char(1) character set latin2 NOT NULL default '',
+ `make_set(255,_latin2'a',_latin2'b',_latin2'c')` char(5) character set latin2 NOT NULL default '',
+ `export_set(255,_latin2'y',_latin2'n',_latin2' ')` char(127) character set latin2 NOT NULL default '',
+ `trim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `ltrim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `rtrim(_latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(LEADING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(TRAILING _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `trim(BOTH _latin2' ' FROM _latin2' a ')` char(3) character set latin2 NOT NULL default '',
+ `repeat(_latin2'a',10)` char(10) character set latin2 NOT NULL default '',
+ `reverse(_latin2'ab')` char(2) character set latin2 NOT NULL default '',
+ `quote(_latin2'ab')` char(6) character set latin2 NOT NULL default '',
+ `soundex(_latin2'ab')` char(4) character set latin2 NOT NULL default '',
+ `substring(_latin2'ab',1)` char(2) character set latin2 NOT NULL default '',
+ `insert(_latin2'abcd',2,3,_latin2'ef')` char(6) character set latin2 NOT NULL default '',
+ `replace(_latin2'abcd',_latin2'b',_latin2'B')` char(4) character set latin2 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select SUBSTR('abcdefg',3,2);
+SUBSTR('abcdefg',3,2)
+cd
+select SUBSTRING('abcdefg',3,2);
+SUBSTRING('abcdefg',3,2)
+cd
+select SUBSTR('abcdefg',-3,2) FROM DUAL;
+SUBSTR('abcdefg',-3,2)
+ef
+select SUBSTR('abcdefg',-1,5) FROM DUAL;
+SUBSTR('abcdefg',-1,5)
+g
+select SUBSTR('abcdefg',0,0) FROM DUAL;
+SUBSTR('abcdefg',0,0)
+
+select SUBSTR('abcdefg',-1,-1) FROM DUAL;
+SUBSTR('abcdefg',-1,-1)
+
+select SUBSTR('abcdefg',1,-1) FROM DUAL;
+SUBSTR('abcdefg',1,-1)
+
+create table t7 (s1 char);
+select * from t7
+where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
+ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat'
+drop table t7;
+CREATE TABLE t1 (
+wid int(10) unsigned NOT NULL auto_increment,
+data_podp date default NULL,
+status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy',
+PRIMARY KEY(wid),
+);
+INSERT INTO t1 VALUES (8,NULL,'real');
+INSERT INTO t1 VALUES (9,NULL,'nowy');
+SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid;
+elt(status_wnio,data_podp)
+NULL
+NULL
+DROP TABLE t1;
+CREATE TABLE t1 (title text) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
+INSERT INTO t1 VALUES ('House passes the CAREERS bill');
+SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
+CONCAT("</a>",RPAD("",(55 - LENGTH(title)),"."))
+NULL
+</a>..........................
+DROP TABLE t1;
+select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
+substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
+1abcd;2abcd 3abcd;4abcd
+explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select high_priority md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index c3f4b9475f9..0998f7b8bcf 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -431,3 +431,112 @@ select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
start ctime1 ctime2
2002-11-04 00:00:00 2002-10-29 16:51:06 2002-11-05 16:47:31
drop table t1,t2,t3;
+select @a:=FROM_UNIXTIME(1);
+@a:=FROM_UNIXTIME(1)
+1970-01-01 03:00:01
+select unix_timestamp(@a);
+unix_timestamp(@a)
+1
+select unix_timestamp('1969-12-01 19:00:01');
+unix_timestamp('1969-12-01 19:00:01')
+0
+CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
+INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
+SELECT * from t1;
+datetime timestamp date time
+2001-01-02 03:04:05 2002-01-02 03:04:05 2003-01-02 06:07:08
+select date_add("1997-12-31",INTERVAL 1 SECOND);
+date_add("1997-12-31",INTERVAL 1 SECOND)
+1997-12-31 00:00:01
+select date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH);
+date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH)
+1999-01-31
+select date_add(datetime, INTERVAL 1 SECOND) from t1;
+date_add(datetime, INTERVAL 1 SECOND)
+2001-01-02 03:04:06
+select date_add(datetime, INTERVAL 1 YEAR) from t1;
+date_add(datetime, INTERVAL 1 YEAR)
+2002-01-02 03:04:05
+select date_add(date,INTERVAL 1 SECOND) from t1;
+date_add(date,INTERVAL 1 SECOND)
+2003-01-02 00:00:01
+select date_add(date,INTERVAL 1 MINUTE) from t1;
+date_add(date,INTERVAL 1 MINUTE)
+2003-01-02 00:01:00
+select date_add(date,INTERVAL 1 HOUR) from t1;
+date_add(date,INTERVAL 1 HOUR)
+2003-01-02 01:00:00
+select date_add(date,INTERVAL 1 DAY) from t1;
+date_add(date,INTERVAL 1 DAY)
+2003-01-03
+select date_add(date,INTERVAL 1 MONTH) from t1;
+date_add(date,INTERVAL 1 MONTH)
+2003-02-02
+select date_add(date,INTERVAL 1 YEAR) from t1;
+date_add(date,INTERVAL 1 YEAR)
+2004-01-02
+select date_add(date,INTERVAL "1:1" MINUTE_SECOND) from t1;
+date_add(date,INTERVAL "1:1" MINUTE_SECOND)
+2003-01-02 00:01:01
+select date_add(date,INTERVAL "1:1" HOUR_MINUTE) from t1;
+date_add(date,INTERVAL "1:1" HOUR_MINUTE)
+2003-01-02 01:01:00
+select date_add(date,INTERVAL "1:1" DAY_HOUR) from t1;
+date_add(date,INTERVAL "1:1" DAY_HOUR)
+2003-01-03 01:00:00
+select date_add(date,INTERVAL "1 1" YEAR_MONTH) from t1;
+date_add(date,INTERVAL "1 1" YEAR_MONTH)
+2004-02-02
+select date_add(date,INTERVAL "1:1:1" HOUR_SECOND) from t1;
+date_add(date,INTERVAL "1:1:1" HOUR_SECOND)
+2003-01-02 01:01:01
+select date_add(date,INTERVAL "1 1:1" DAY_MINUTE) from t1;
+date_add(date,INTERVAL "1 1:1" DAY_MINUTE)
+2003-01-03 01:01:00
+select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
+date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
+2003-01-03 01:01:01
+select date_add(time,INTERVAL 1 SECOND) from t1;
+date_add(time,INTERVAL 1 SECOND)
+2006-07-08 00:00:01
+drop table t1;
+select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
+last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
+last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
+last_day('2001-02-12');
+f1 f2 f3 f4 f5 last_day(NULL) last_day('2001-02-12')
+2000-02-29 2002-12-31 NULL 2003-04-30 2001-01-31 NULL 2001-02-28
+create table t1 select last_day('2000-02-05') as a;
+describe t1;
+Field Type Null Key Default Extra
+a date 0000-00-00
+select * from t1;
+a
+2000-02-29
+drop table t1;
+select last_day('2000-02-05');
+last_day('2000-02-05')
+2000-02-29
+select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
+strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
+1
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
+strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0
+1
+select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
+strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0
+1
+select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
+strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0
+1
+select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
+strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0
+1
+select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
+strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0
+1
+explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select high_priority no_cache period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(to_days(curdate())) - weekday(to_days(now()))) AS `weekday(curdate())-weekday(now())`,dayname(to_days(_latin1'1962-03-03')) AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 98a4f9a390d..bbe3326fd34 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -284,13 +284,14 @@ select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
spid count(*)
2 2
1 1
+explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
Warnings:
Note 1003 select high_priority big_result test.t1.spID AS `spid`,sum(test.t1.userID) AS `sum(userid)` from test.t1 group by test.t1.spID desc
explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 8
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid)
7 3
@@ -611,8 +612,8 @@ userid count(*)
2 1
1 2
EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
DROP TABLE t1;
CREATE TABLE t1 (
i int(11) default NULL,
@@ -625,6 +626,6 @@ i COUNT(DISTINCT(i))
2 1
4 4
explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index d7bcea22dbf..eb0b9af8e38 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1312,17 +1312,41 @@ a b
111 100
111 100
drop table t1;
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
+drop table t1;
CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
(stamp))ENGINE=InnoDB;
insert into t1 values (1),(2),(3);
-insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 );
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1264 Data truncated for column 'stamp' at row 3
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
'20020204120000' GROUP BY col1;
col1
1
2
3
+4
drop table t1,t2;
CREATE TABLE t1 (
`id` int(10) unsigned NOT NULL auto_increment,
@@ -1352,7 +1376,6 @@ id label
1822 Test 3
3524 Societe Test
3525 Fournisseur Test
-drop table t1;
drop table t1,t2;
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1;
@@ -1391,24 +1414,3 @@ test.t2 968604391
test.t3 968604391
test.t4 NULL
drop table t1,t2,t3;
-create table t1 ( c char(8) not null ) type=innodb;
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
-insert into t2 select * from t1;
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-drop table t1,t2;
-SET AUTOCOMMIT=1;
-create table t1 (a integer auto_increment primary key) type=innodb;
-insert into t1 (a) values (NULL),(NULL);
-truncate table t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-a
-3
-4
-drop table t1;
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 5af46e7db04..ff5111c552e 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -61,7 +61,6 @@ drop table t1;
create table t1 (id int NOT NULL DEFAULT 8);
insert into t1 values(NULL);
ERROR 23000: Column 'id' cannot be null
-ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2);
Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'id' at row 2
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 19368ace977..c40f86827f8 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -4,7 +4,6 @@ grp int(11) default NULL,
a bigint(20) unsigned default NULL,
c char(10) NOT NULL default ''
) ENGINE=MyISAM;
-) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
@@ -678,8 +677,8 @@ a1 a2 b1 b2 c1 c2
2 2 2 3 NULL NULL
3 2 NULL NULL 3 4
explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 2
-t3 ALL NULL NULL NULL NULL 2
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2
drop table t1, t2, t3;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d90ebb4cd79..0547596dfbd 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -31,7 +31,7 @@ drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
-Warning 1260 Record count is fewer than the column count at row 3
+Warning 1260 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
|Field A| |Field B|
@@ -42,6 +42,11 @@ Field 3,'Field 4|
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 3
+Warning 1261 Row 3 was truncated; It contained more data than there where input columns
+Warning 1264 Data truncated for column 'a' at row 5
+Warning 1261 Row 5 was truncated; It contained more data than there where input columns
select * from t1;
a b
1 row 1
@@ -51,6 +56,9 @@ a b
0 1234567890
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 4
+Warning 1260 Row 4 doesn't contain data for all columns
select * from t1;
a b
1 row 1
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 2e561452b8b..d335c9c1d10 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -351,7 +351,6 @@ a b
3 4
4 5
drop table t1;
-drop table if exists t1, t2;
create table t1(id1 smallint(5), field char(5));
create table t2(id2 smallint(5), field char(5));
insert into t1 values (1, 'a'), (2, 'aa');
@@ -396,3 +395,4 @@ t2 rows after big delete 1900001
select 't1 rows after big delete', count(*) from t1;
t1 rows after big delete count(*)
t1 rows after big delete 1900001
+drop table t1,t2;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 706a4d11241..04effdfef7c 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -21,21 +21,42 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a decimal(240,20) default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000");
-INSERT INTO t1 VALUES ("0987654321098765432109876543210987654321.00000000000000000000");
+
+/*!40000 ALTER TABLE t1 DISABLE KEYS */;
+LOCK TABLES t1 WRITE;
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
+UNLOCK TABLES;
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a double default NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+/*!40000 ALTER TABLE t1 DISABLE KEYS */;
+LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES (RES);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
@@ -84,30 +105,11 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
--- MySQL dump 10.3
---
--- Host: localhost Database: test
--- ------------------------------------------------------
--- Server version 4.1.2-alpha-debug-log
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
-
---
--- Table structure for table `t1`
---
-
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
---
--- Dumping data for table `t1`
---
-
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
diff --git a/mysql-test/r/rpl_EE_error.result b/mysql-test/r/rpl_EE_error.result
index a5043250df6..49ad4832c81 100644
--- a/mysql-test/r/rpl_EE_error.result
+++ b/mysql-test/r/rpl_EE_error.result
@@ -1,16 +1,16 @@
-slave stop;
+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;
-slave start;
-create table t1 (a int) type=myisam;
+start slave;
+create table t1 (a int) engine=myisam;
flush tables;
drop table t1;
-create table t1 (a int, unique(a)) type=myisam;
+create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
insert into t1 values(1),(2);
-Duplicate entry '2' for key 1
+ERROR 23000: Duplicate entry '2' for key 1
drop table t1;
diff --git a/mysql-test/r/rpl_multi_update.result b/mysql-test/r/rpl_multi_update.result
index 1fa1dd104d2..65587d25f63 100644
--- a/mysql-test/r/rpl_multi_update.result
+++ b/mysql-test/r/rpl_multi_update.result
@@ -1,18 +1,17 @@
-slave stop;
+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;
-slave start;
-drop table if exists t1,t2;
+start slave;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 5f726476d96..4ba0ca0eac4 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -65,22 +65,24 @@ t9 CREATE TABLE `t9` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='TEST_DIR/var/tmp/' INDEX DIRECTORY='TEST_DIR/var/run/'
drop database mysqltest;
create table t1 (a int not null) type=myisam;
+Warnings:
+Warning 1286 'TYPE=database_engine' is deprecated. Use 'ENGINE=database_engine' instead.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 add b int;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` int(11) default NULL
-) TYPE=MyISAM
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index f069114f752..255b7f0d942 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -585,9 +585,9 @@ create table t1 (id integer primary key auto_increment, txt text, unique index t
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL;
id txt
-3 NULL
1 Chevy
2 Chevy
+3 NULL
select * from t1 where txt='Chevy ';
id txt
1 Chevy
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index a32c97f1d49..c1ee621697d 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -1,6 +1,12 @@
drop table if exists t1;
create table t1 (t datetime);
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+Warnings:
+Warning 1264 Data truncated for column 't' at row 13
+Warning 1264 Data truncated for column 't' at row 14
+Warning 1264 Data truncated for column 't' at row 15
+Warning 1264 Data truncated for column 't' at row 16
+Warning 1264 Data truncated for column 't' at row 17
select * from t1;
t
2000-01-01 00:00:00
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index ee7d6583d64..3d3e5082b8a 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -446,6 +446,8 @@ CREATE TABLE t1 (a_dec DECIMAL(-1,1));
ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-1,1))' at line 1
create table t1(a decimal(10,4));
insert into t1 values ("+0000100000000");
+Warnings:
+Warning 1263 Data truncated, out of range for column 'a' at row 1
select * from t1;
a
9999999.9999
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index e13a93a4156..8a7c15f7da9 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1638,10 +1638,14 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (a enum ('0','1'));
insert into t1 set a='foobar';
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 1
select * from t1;
a
update t1 set a = replace(a,'x','y');
+Warnings:
+Warning 1264 Data truncated for column 'a' at row 1
select * from t1;
a
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index a5d3abcdefc..172ccc440f4 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -24,15 +24,6 @@ a t
7 2002-03-05 00:00:00
8 0000-00-00 00:00:00
9 1970-01-01 03:20:38
-1 1970-01-01 03:20:34
-2 2002-03-03 00:00:00
-3 1970-01-01 03:20:35
-4 1970-01-01 03:20:36
-5 2002-03-04 00:00:00
-6 1970-01-01 03:20:37
-7 2002-03-05 00:00:00
-8 0000-00-00 00:00:00
-9 1970-01-01 03:20:38
drop table t1,t2;
SET TIMESTAMP=1234;
CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp, PRIMARY KEY (id));
@@ -53,6 +44,12 @@ date_format(a,"%Y %y") year(a) year(now())
drop table t1;
create table t1 (ix timestamp);
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
+Warnings:
+Warning 1264 Data truncated for column 'ix' at row 10
+Warning 1264 Data truncated for column 'ix' at row 11
+Warning 1264 Data truncated for column 'ix' at row 12
+Warning 1264 Data truncated for column 'ix' at row 13
+Warning 1264 Data truncated for column 'ix' at row 14
select ix+0 from t1;
ix+0
19991101000000
@@ -64,24 +61,24 @@ ix+0
19990501000000
19991101000000
19990501000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
+0
+0
+0
+0
+0
delete from t1;
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
-select * from t1;
-ix
+select ix+0 from t1;
+ix+0
19991101000000
19990102030405
19990630232922
19990601000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
-00000000000000
+0
+0
+0
+0
+0
drop table t1;
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
@@ -132,4 +129,4 @@ t2 t4 t6 t8 t10 t12 t14
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
drop table t1;
create table t1 (a timestamp default 1);
-Invalid default value for 'a'
+ERROR 42000: Invalid default value for 'a'
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 1cfc6eedbaf..4a514e3dd18 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -435,8 +435,9 @@ a
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
ERROR 42000: Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
create temporary table t1 select a from t1 union select a from t2;
+drop temporary table t1;
create table t1 select a from t1 union select a from t2;
-INSERT TABLE 't1' isn't allowed in FROM table list
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2;
*
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 2769e284a95..fce2ddfd57a 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -49,9 +49,9 @@ Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
Warning 1264 Data truncated for column 'd' at row 3
Warning 1264 Data truncated for column 'c' at row 4
-Warning 1260 Record count is fewer than the column count at row 5
+Warning 1260 Row 5 doesn't contain data for all columns
Warning 1264 Data truncated for column 'b' at row 6
-Warning 1261 Record count is more than the column count at row 7
+Warning 1261 Row 7 was truncated; It contained more data than there where input columns
Warning 1263 Data truncated, out of range for column 'a' at row 8
select @@warning_count;
@@warning_count
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 835253e3134..12b81f27147 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -794,7 +794,7 @@ drop table t1;
# Test of multi-table-updates (bug #1980).
#
-create table t1 ( c char(8) not null ) type=bdb;
+create table t1 ( c char(8) not null ) engine=bdb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
@@ -803,7 +803,7 @@ alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=bdb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 5add6247eaa..b227614e7ae 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -906,7 +906,7 @@ drop table t1;
# Test of multi-table-updates (bug #1980).
#
-create table t1 ( c char(8) not null ) type=innodb;
+create table t1 ( c char(8) not null ) engine=innodb;
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
@@ -915,7 +915,7 @@ alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
-create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
@@ -926,19 +926,23 @@ drop table t1,t2;
#
SET AUTOCOMMIT=1;
-create table t1 (a integer auto_increment primary key) type=innodb;
+create table t1 (a integer auto_increment primary key) engine=innodb;
insert into t1 (a) values (NULL),(NULL);
truncate table t1;
insert into t1 (a) values (NULL),(NULL);
SELECT * from t1;
drop table t1;
+#
+# Test timestamps
+#
CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
(stamp))ENGINE=InnoDB;
insert into t1 values (1),(2),(3);
-insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 );
+# Note that timestamp 3 is wrong
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
'20020204120000' GROUP BY col1;
drop table t1,t2;
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 4b69b002342..6f012801972 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -60,8 +60,8 @@ delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3
select count(*) from t1 where id1;
select count(*) from t2 where id2;
select count(*) from t3 where id3;
-
drop table t1,t2,t3;
+
create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
disable_query_log;
@@ -288,7 +288,6 @@ drop table t1;
# Test multi-update and multi-delete with impossible where
-drop table if exists t1, t2;
create table t1(id1 smallint(5), field char(5));
create table t2(id2 smallint(5), field char(5));
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index c926c8e0b0d..1299d73eb99 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -6,7 +6,7 @@ DROP TABLE IF EXISTS t1, `"t"1`;
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-comments -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
DROP TABLE t1;
#
@@ -33,7 +33,7 @@ DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
---exec $MYSQL_DUMP --skip-all -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
DROP TABLE t1;
#
@@ -42,7 +42,7 @@ DROP TABLE t1;
CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
---exec $MYSQL_DUMP --skip-all -X test t1
+--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
DROP TABLE t1;
#
@@ -51,5 +51,5 @@ DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
---exec $MYSQL_DUMP test t1
+--exec $MYSQL_DUMP --skip-comments test t1
DROP TABLE t1;
diff --git a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
index de69c4897c3..1a1572b48b0 100644
--- a/mysql-test/t/rpl_EE_error.test
+++ b/mysql-test/t/rpl_EE_error.test
@@ -6,7 +6,7 @@
source include/master-slave.inc;
-create table t1 (a int) type=myisam;
+create table t1 (a int) engine=myisam;
flush tables;
system rm ./var/master-data/test/t1.MYI ;
drop table t1;
@@ -17,7 +17,7 @@ sync_with_master;
# Now a real error.
connection master;
-create table t1 (a int, unique(a)) type=myisam;
+create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
diff --git a/mysql-test/t/rpl_multi_update.test b/mysql-test/t/rpl_multi_update.test
index c44239594dd..98a199ae412 100644
--- a/mysql-test/t/rpl_multi_update.test
+++ b/mysql-test/t/rpl_multi_update.test
@@ -1,15 +1,14 @@
source include/master-slave.inc;
-drop table if exists t1,t2;
CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
CREATE TABLE t2 (
a int unsigned not null auto_increment primary key,
b int unsigned
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL, 0);
INSERT INTO t1 SELECT NULL, 0 FROM t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index fc986b05fa4..8ce4aa997fc 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -248,6 +248,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
create temporary table t1 select a from t1 union select a from t2;
+drop temporary table t1;
--error 1093
create table t1 select a from t1 union select a from t2;
drop table t1,t2;
@@ -258,7 +259,6 @@ drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2;
-
#
# Test for another bug with UNION and LEFT JOIN
#
@@ -465,4 +465,3 @@ show status like 'Slow_queries';
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
show status like 'Slow_queries';
drop table t1;
-
diff --git a/mysys/charset.c b/mysys/charset.c
index 4111dd246cb..1fe926a51d6 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -188,9 +188,11 @@ static my_bool create_fromuni(CHARSET_INFO *cs)
break;
numchars=idx[i].uidx.to-idx[i].uidx.from+1;
- idx[i].uidx.tab=(unsigned char*)my_once_alloc(numchars *
- sizeof(*idx[i].uidx.tab),
- MYF(MY_WME));
+ if (!(idx[i].uidx.tab=(uchar*) my_once_alloc(numchars *
+ sizeof(*idx[i].uidx.tab),
+ MYF(MY_WME))))
+ return TRUE;
+
bzero(idx[i].uidx.tab,numchars*sizeof(*idx[i].uidx.tab));
for (ch=1; ch < PLANE_SIZE; ch++)
@@ -206,8 +208,10 @@ static my_bool create_fromuni(CHARSET_INFO *cs)
/* Allocate and fill reverse table for each plane */
n=i;
- cs->tab_from_uni= (MY_UNI_IDX*) my_once_alloc(sizeof(MY_UNI_IDX)*(n+1),
- MYF(MY_WME));
+ if (!(cs->tab_from_uni= (MY_UNI_IDX*) my_once_alloc(sizeof(MY_UNI_IDX)*(n+1),
+ MYF(MY_WME))))
+ return TRUE;
+
for (i=0; i< n; i++)
cs->tab_from_uni[i]= idx[i].uidx;
@@ -217,46 +221,64 @@ static my_bool create_fromuni(CHARSET_INFO *cs)
}
-static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
+static int simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from)
{
to->number= from->number ? from->number : to->number;
if (from->csname)
- to->csname= my_once_strdup(from->csname,MYF(MY_WME));
+ if (!(to->csname= my_once_strdup(from->csname,MYF(MY_WME))))
+ goto err;
if (from->name)
- to->name= my_once_strdup(from->name,MYF(MY_WME));
+ if (!(to->name= my_once_strdup(from->name,MYF(MY_WME))))
+ goto err;
if (from->comment)
- to->comment= my_once_strdup(from->comment,MYF(MY_WME));
+ if (!(to->comment= my_once_strdup(from->comment,MYF(MY_WME))))
+ goto err;
if (from->ctype)
{
- to->ctype= (uchar*) my_once_memdup((char*) from->ctype,
- MY_CS_CTYPE_TABLE_SIZE, MYF(MY_WME));
+ if (!(to->ctype= (uchar*) my_once_memdup((char*) from->ctype,
+ MY_CS_CTYPE_TABLE_SIZE,
+ MYF(MY_WME))))
+ goto err;
init_state_maps(to);
}
if (from->to_lower)
- to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower,
- MY_CS_TO_LOWER_TABLE_SIZE, MYF(MY_WME));
+ if (!(to->to_lower= (uchar*) my_once_memdup((char*) from->to_lower,
+ MY_CS_TO_LOWER_TABLE_SIZE,
+ MYF(MY_WME))))
+ goto err;
+
if (from->to_upper)
- to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper,
- MY_CS_TO_UPPER_TABLE_SIZE, MYF(MY_WME));
+ if (!(to->to_upper= (uchar*) my_once_memdup((char*) from->to_upper,
+ MY_CS_TO_UPPER_TABLE_SIZE,
+ MYF(MY_WME))))
+ goto err;
if (from->sort_order)
{
- to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order,
- MY_CS_SORT_ORDER_TABLE_SIZE,
- MYF(MY_WME));
+ if (!(to->sort_order= (uchar*) my_once_memdup((char*) from->sort_order,
+ MY_CS_SORT_ORDER_TABLE_SIZE,
+ MYF(MY_WME))))
+ goto err;
set_max_sort_char(to);
}
if (from->tab_to_uni)
{
uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16);
- to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni, sz,
- MYF(MY_WME));
- create_fromuni(to);
+ if (!(to->tab_to_uni= (uint16*) my_once_memdup((char*)from->tab_to_uni,
+ sz, MYF(MY_WME))))
+ goto err;
+ if (create_fromuni(to))
+ goto err;
}
to->mbmaxlen= 1;
+
+ return 0;
+
+err:
+ return 1;
}
@@ -292,7 +314,8 @@ static int add_collation(CHARSET_INFO *cs)
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
simple_cs_init_functions(all_charsets[cs->number]);
- simple_cs_copy_data(all_charsets[cs->number],cs);
+ if (simple_cs_copy_data(all_charsets[cs->number],cs))
+ return MY_XML_ERROR;
if (simple_cs_is_full(all_charsets[cs->number]))
{
all_charsets[cs->number]->state |= MY_CS_LOADED;
@@ -313,11 +336,14 @@ static int add_collation(CHARSET_INFO *cs)
CHARSET_INFO *dst= all_charsets[cs->number];
dst->number= cs->number;
if (cs->comment)
- dst->comment= my_once_strdup(cs->comment,MYF(MY_WME));
+ if (!(dst->comment= my_once_strdup(cs->comment,MYF(MY_WME))))
+ return MY_XML_ERROR;
if (cs->csname)
- dst->csname= my_once_strdup(cs->csname,MYF(MY_WME));
+ if (!(dst->csname= my_once_strdup(cs->csname,MYF(MY_WME))))
+ return MY_XML_ERROR;
if (cs->name)
- dst->name= my_once_strdup(cs->name,MYF(MY_WME));
+ if (!(dst->name= my_once_strdup(cs->name,MYF(MY_WME))))
+ return MY_XML_ERROR;
}
cs->number= 0;
cs->primary_number= 0;
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index 2fd7f1fcdee..6ee6167d3c1 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -189,6 +189,14 @@ int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
get_key_pack_length(b_length,pack_length,b);
next_key_length=key_length-b_length-pack_length;
+ if (!(nextflag & (SEARCH_PREFIX | SEARCH_UPDATE)))
+ {
+ while (a_length && a[a_length-1] == ' ')
+ a_length--;
+ while (b_length && b[b_length-1] == ' ')
+ b_length--;
+ }
+
if (piks &&
(flag= mi_compare_text(keyseg->charset,a,a_length,b,b_length,
(my_bool) ((nextflag & SEARCH_PREFIX) &&
diff --git a/sql-common/client.c b/sql-common/client.c
index 374cbb29112..5b702f0e966 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -967,7 +967,8 @@ void mysql_read_default_options(struct st_mysql_options *options,
#endif
break;
case 27:
- options->max_allowed_packet= atoi(opt_arg);
+ if (opt_arg)
+ options->max_allowed_packet= atoi(opt_arg);
break;
case 28: /* protocol */
if ((options->protocol = find_type(opt_arg,
@@ -1310,7 +1311,9 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
MYSQL * STDCALL
mysql_init(MYSQL *mysql)
{
- mysql_once_init();
+ if (mysql_once_init())
+ return 0;
+
if (!mysql)
{
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
diff --git a/sql/field.cc b/sql/field.cc
index c54e27360b5..4c7e219ab43 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2910,6 +2910,7 @@ static longlong fix_datetime(longlong nr, TIME *time_res,
return nr;
err:
+ THD *thd= current_thd;
if (thd->count_cuted_fields)
{
thd->cuted_fields++;
@@ -2948,9 +2949,7 @@ int Field_timestamp::store(longlong nr)
err:
longstore(ptr,(uint32) 0);
- if (current_thd->count_cuted_fields)
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED,
- field_name, 0);
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
return 1;
}
@@ -5189,7 +5188,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
{
uint tmp=(uint) Field_enum::val_int();
if (!tmp || tmp > typelib->count)
- val_ptr->set((char*)"",0);
+ val_ptr->set("", 0, field_charset);
else
val_ptr->set((const char*) typelib->type_names[tmp-1],
(uint) strlen(typelib->type_names[tmp-1]),
diff --git a/sql/field.h b/sql/field.h
index 223ff4135d4..e3b4bf29fb8 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -874,7 +874,9 @@ public:
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, cs)
{}
- Field_varstring(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ Field_varstring(uint32 len_arg,bool maybe_null_arg,
+ const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, cs)
{}
@@ -925,10 +927,9 @@ public:
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, cs),
geom_flag(true), packlength(4)
- {
- flags|= BLOB_FLAG;
- }
- }
+ {
+ flags|= BLOB_FLAG;
+ }
enum_field_types type() const { return FIELD_TYPE_BLOB;}
enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; }
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 4e42d629a0f..419eac6d1c3 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -33,11 +33,9 @@ InnoDB */
#include "mysql_priv.h"
#include "slave.h"
-#include "sql_cache.h"
#ifdef HAVE_INNOBASE_DB
#include <m_ctype.h>
-#include <assert.h>
#include <hash.h>
#include <myisampack.h>
diff --git a/sql/item.cc b/sql/item.cc
index 9a9b8fe26a8..301d2990e0b 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -654,10 +654,10 @@ String *Item_param::val_str(String* str)
{
switch (item_result_type) {
case INT_RESULT:
- str->set(int_value, default_charset());
+ str->set(int_value, &my_charset_bin);
return str;
case REAL_RESULT:
- str->set(real_value, 2, default_charset());
+ str->set(real_value, 2, &my_charset_bin);
return str;
default:
return (String*) &str_value;
diff --git a/sql/item.h b/sql/item.h
index 90a0a706073..c6258518213 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -240,6 +240,7 @@ public:
st_select_lex *depended_from;
Item_ident(const char *db_name_par,const char *table_name_par,
const char *field_name_par);
+ Item_ident::Item_ident(THD *thd, Item_ident &item);
const char *full_name() const;
bool remove_dependence_processor(byte * arg);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7495987856a..b9cbb38db1a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -317,6 +317,7 @@ void Item_func::print_op(String *str)
str->append(')');
}
+
bool Item_func::eq(const Item *item, bool binary_cmp) const
{
/* Assume we don't have rtti */
@@ -372,7 +373,7 @@ String *Item_real_func::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -385,16 +386,16 @@ String *Item_num_func::val_str(String *str)
if (null_value)
return 0; /* purecov: inspected */
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
}
else
{
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
}
return str;
}
@@ -421,9 +422,9 @@ String *Item_int_func::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
@@ -450,16 +451,16 @@ String *Item_num_op::val_str(String *str)
if (null_value)
return 0; /* purecov: inspected */
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
}
else
{
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
}
return str;
}
@@ -1030,9 +1031,9 @@ String *Item_func_min_max::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
case REAL_RESULT:
@@ -1040,7 +1041,7 @@ String *Item_func_min_max::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
return str;
}
case STRING_RESULT:
@@ -1668,7 +1669,7 @@ String *Item_func_udf_float::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
return str;
}
@@ -1689,9 +1690,9 @@ String *Item_func_udf_int::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 739110fd81f..ac67b5a4065 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -717,9 +717,10 @@ public:
Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
longlong val_int();
const char *func_name() const { return "~"; }
- void print(String *str) { Item_func_int::print(str); }
+ void print(String *str) { Item_func::print(str); }
};
+
class Item_func_set_last_insert_id :public Item_int_func
{
public:
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 16c886b558e..3cb03d7ea49 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1582,6 +1582,11 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org)
}
+/*
+ TODO: This needs to be fixed for multi-byte character set where numbers
+ are stored in more than one byte
+*/
+
String *Item_func_format::val_str(String *str)
{
double nr =args[0]->val();
@@ -1590,7 +1595,8 @@ String *Item_func_format::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
dec= decimals ? decimals+1 : 0;
- str->set(nr,decimals,default_charset());
+ /* Here default_charset() is right as this is not an automatic conversion */
+ str->set(nr,decimals, default_charset());
#ifdef HAVE_ISNAN
if (isnan(nr))
return str;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 7b401b50d4c..bc16fe87c2a 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -344,7 +344,7 @@ void Item_singlerow_subselect::bring_value()
exec();
}
-double Item_singlerow_subselect::val ()
+double Item_singlerow_subselect::val()
{
if (!exec() && !value->null_value)
{
@@ -358,7 +358,7 @@ double Item_singlerow_subselect::val ()
}
}
-longlong Item_singlerow_subselect::val_int ()
+longlong Item_singlerow_subselect::val_int()
{
if (!exec() && !value->null_value)
{
@@ -466,7 +466,7 @@ void Item_exists_subselect::fix_length_and_dec()
max_columns= engine->cols();
}
-double Item_exists_subselect::val ()
+double Item_exists_subselect::val()
{
if (exec())
{
@@ -476,7 +476,7 @@ double Item_exists_subselect::val ()
return (double) value;
}
-longlong Item_exists_subselect::val_int ()
+longlong Item_exists_subselect::val_int()
{
if (exec())
{
@@ -493,11 +493,11 @@ String *Item_exists_subselect::val_str(String *str)
reset();
return 0;
}
- str->set(value,default_charset());
+ str->set(value,&my_charset_bin);
return str;
}
-double Item_in_subselect::val ()
+double Item_in_subselect::val()
{
if (exec())
{
@@ -510,7 +510,7 @@ double Item_in_subselect::val ()
return (double) value;
}
-longlong Item_in_subselect::val_int ()
+longlong Item_in_subselect::val_int()
{
if (exec())
{
@@ -536,7 +536,7 @@ String *Item_in_subselect::val_str(String *str)
null_value= 1;
return 0;
}
- str->set(value,default_charset());
+ str->set(value, &my_charset_bin);
return str;
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 8d9973e78f8..a31374a3fc3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -140,7 +140,7 @@ Item_sum_num::val_str(String *str)
double nr=val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -477,13 +477,13 @@ Item_sum_hybrid::val_str(String *str)
case STRING_RESULT:
return &value;
case REAL_RESULT:
- str->set(sum,decimals,default_charset());
+ str->set(sum,decimals, &my_charset_bin);
break;
case INT_RESULT:
if (unsigned_flag)
- str->set((ulonglong) sum_int,default_charset());
+ str->set((ulonglong) sum_int, &my_charset_bin);
else
- str->set((longlong) sum_int,default_charset());
+ str->set((longlong) sum_int, &my_charset_bin);
break;
case ROW_RESULT:
default:
@@ -958,7 +958,7 @@ String *Item_avg_field::val_str(String *str)
double nr=Item_avg_field::val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -1006,7 +1006,7 @@ String *Item_variance_field::val_str(String *str)
double nr=val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 3fe40ca4c68..8065218df97 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -468,6 +468,7 @@ public:
void clear();
longlong val_int();
void reset_field();
+ void update_field();
void fix_length_and_dec()
{ decimals=0; max_length=21; unsigned_flag=1; maybe_null=null_value=0; }
};
@@ -500,7 +501,6 @@ class Item_sum_xor :public Item_sum_bit
Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
Item_sum_xor(THD *thd, Item_sum_xor &item) :Item_sum_bit(thd, item) {}
bool add();
- void update_field();
const char *func_name() const { return "bit_xor"; }
Item *copy_or_same(THD* thd);
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index bff9ed94a23..8aa59b4d5d0 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -437,17 +437,11 @@ void kill_mysql(void);
void close_connection(THD *thd, uint errcode, bool lock);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
bool no_grant, bool no_errors);
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors);
bool check_global_access(THD *thd, ulong want_access);
-#else
-#define check_access(thd, access, db, save_priv, no_grant, no_errors) false
-#define check_table_access(thd, want_access, tables, no_errors) false
-#define check_global_access(thd, want_access) false
-#endif
int mysql_backup_table(THD* thd, TABLE_LIST* table_list);
int mysql_restore_table(THD* thd, TABLE_LIST* table_list);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 36fa744e328..2bebec0d3db 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4595,7 +4595,7 @@ The minimum value for this variable is 4096.",
{"thread_stack", OPT_THREAD_STACK,
"The stack size for each thread.", (gptr*) &thread_stack,
(gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
- 1024*32, ~0L, 0, 1024, 0},
+ 1024L*128L, ~0L, 0, 1024, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log",
(gptr*) &global_system_variables.trans_alloc_block_size,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 66f8c3327a2..88b5d7bfdf0 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -787,9 +787,8 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
/* If the string is "", delete old init command */
if (var && (new_length= var->value->str_value.length()))
{
- if (!(res= my_strdup_with_length(var->value->str_value.ptr(),
- new_length,
- MYF(0))))
+ if (!(res= my_strdup_with_length((byte*) var->value->str_value.ptr(),
+ new_length, MYF(0))))
return 1;
}
/*
@@ -2501,6 +2500,7 @@ bool sys_var_thd_table_type::check(THD *thd, set_var *var)
}
return 0;
}
+ value= "unknown";
err:
my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value);
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index d6a0c51bdff..4470739cbdd 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -272,8 +272,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 1d889e6258e..d005150cb89 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -266,8 +266,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 4798ea55b42..3fd44f9ec69 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -274,8 +274,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 920ec433da0..6400093a6cf 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"ZLIB: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 0c9b5c96308..eb7e6d0508b 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -268,8 +268,8 @@ character-set=latin7
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index a9d3f9b049a..d5a4874a49d 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 5dfd1173467..5472e824e61 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -263,8 +263,8 @@ character-set=greek
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index d454c51caba..463aaed5760 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 18715b4930b..204e1f980cc 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index b034c8f657f..b8b9688fd38 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -265,8 +265,8 @@ character-set=ujis
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index df15d77c075..055d1a0a2c7 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -263,8 +263,8 @@ character-set=euckr
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index b46a52ae2de..735a2583685 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 3727e49d2ad..2c434da271e 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 1cb5b384e4b..78fcb2a7993 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -267,8 +267,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 519f86e284c..528a0d081ff 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -267,8 +267,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index ae186929898..5224f19b001 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=koi8r
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 0719b88bec0..904c8f0c8b9 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -258,8 +258,8 @@ character-set=cp1250
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index cb5957fb892..0f5a70fa2c6 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -271,8 +271,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 0e95efff5aa..845a7da36eb 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 5edf41e0202..9da0a511ddb 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d rad(er) kapades av group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 8dbc2b582c9..7186e0550b2 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -268,8 +268,8 @@ character-set=koi8u
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 8b8115b10db..7b66a851d33 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -58,8 +58,6 @@
#define EXTRA_ACL (1L << 29)
#define NO_ACCESS (1L << 30)
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-
/*
Defines to change the above bits to how things are stored in tables
This is needed as the 'host' and 'db' table is missing a few privileges
@@ -127,8 +125,6 @@ public:
char *user,*db;
};
-
-
/* prototypes */
bool hostname_requires_resolving(const char *hostname);
@@ -152,7 +148,7 @@ my_bool grant_init(THD *thd);
void grant_free(void);
void grant_reload(THD *thd);
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
- uint show_command=0, bool dont_print_error=0);
+ uint show_command, bool dont_print_error);
bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length,
uint show_command=0);
bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table);
@@ -165,5 +161,7 @@ void get_mqh(const char *user, const char *host, USER_CONN *uc);
int mysql_drop_user(THD *thd, List <LEX_USER> &list);
int mysql_revoke_all(THD *thd, List <LEX_USER> &list);
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
-
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+#define check_grant(A,B,C,D,E) 0
+#define check_grant_db(A,B) 0
+#endif
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index ebb94e11d9d..0101037da85 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1762,7 +1762,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
'name' of the item which may be used in the select list
*/
strmake(name_buff, db, sizeof(name_buff)-1);
- casedn_str(name_buff);
+ my_casedn_str(files_charset_info, name_buff);
db= name_buff;
}
diff --git a/sql/sql_client.cc b/sql/sql_client.cc
index 1ae9a23a924..905c32a42d9 100644
--- a/sql/sql_client.cc
+++ b/sql/sql_client.cc
@@ -39,7 +39,8 @@ void my_net_local_init(NET *net)
}
extern "C" {
-void mysql_once_init(void)
+int mysql_once_init(void)
{
+ return 0;
}
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6e6ec025a1f..f6a3308efb7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -51,14 +51,9 @@ extern "C" int gethostname(char *name, int namelen);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables);
static bool single_table_command_access(THD *thd, ulong privilege,
TABLE_LIST *tables, int *res);
-#else
-#define check_merge_table_access(thd, db, tables) false
-#define single_table_command_access(thd, privilege, tables, res) false
-#endif
static void remove_escape(char *name);
static void refresh_status(void);
static bool append_file_to_dir(THD *thd, char **filename_ptr,
@@ -177,7 +172,6 @@ end:
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if user exist and password supplied is correct.
@@ -210,6 +204,11 @@ int check_user(THD *thd, enum enum_server_command command,
{
DBUG_ENTER("check_user");
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ thd->master_access= GLOBAL_ACLS; // Full rights
+ return 0;
+#else
+
my_bool opt_secure_auth_local;
pthread_mutex_lock(&LOCK_global_system_variables);
opt_secure_auth_local= opt_secure_auth;
@@ -333,7 +332,8 @@ int check_user(THD *thd, enum enum_server_command command,
DBUG_RETURN(-1);
}
}
- send_ok(thd);
+ else
+ send_ok(thd);
thd->password= test(passwd_len); // remember for error messages
/* Ready to handle queries */
DBUG_RETURN(0);
@@ -354,11 +354,9 @@ int check_user(THD *thd, enum enum_server_command command,
thd->host_or_ip,
passwd_len ? ER(ER_YES) : ER(ER_NO));
DBUG_RETURN(-1);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
-
-
/*
Check for maximum allowable user connections, if the mysqld server is
started with corresponding variable that is greater then 0.
@@ -509,7 +507,6 @@ bool is_update_query(enum enum_sql_command command)
return uc_update_queries[command];
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if maximum queries per hour limit has been reached
returns 0 if OK.
@@ -528,6 +525,9 @@ static bool check_mqh(THD *thd, uint check_command)
DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0);
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ DBUG_RETURN(0);
+#else
/* If more than a hour since last check, reset resource checking */
if (check_time - uc->intime >= 3600)
{
@@ -561,12 +561,13 @@ static bool check_mqh(THD *thd, uint check_command)
}
end:
DBUG_RETURN(error);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
{
-
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
(void) pthread_mutex_lock(&LOCK_user_conn);
if (lu) // for GRANT
{
@@ -590,7 +591,8 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
{
for (uint idx=0;idx < hash_user_connections.records; idx++)
{
- USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections, idx);
+ USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections,
+ idx);
if (get_them)
get_mqh(uc->user,uc->host,uc);
uc->questions=0;
@@ -599,8 +601,8 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
}
}
(void) pthread_mutex_unlock(&LOCK_user_conn);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
/*
Perform handshake, authorize client and update thd ACL variables.
@@ -1065,7 +1067,6 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
thd->query[length] = '\0';
thd->query_id=query_id++;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
{
thd->net.error = 0;
@@ -1073,7 +1074,6 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
-#endif
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
if (thd->is_fatal_error)
@@ -1137,12 +1137,10 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT)))
DBUG_RETURN(1);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege,0,0))
goto err;
- if (grant_option && check_grant(thd, SELECT_ACL, table_list))
+ if (grant_option && check_grant(thd, SELECT_ACL, table_list, 0, 0))
goto err;
-#endif
thd->free_list = 0;
thd->query_length=(uint) strlen(tbl_name);
thd->query = tbl_name;
@@ -1446,13 +1444,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_casedn_str(files_charset_info, table_list.real_name);
remove_escape(table_list.real_name); // This can't have wildcards
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access,0,0))
break;
table_list.grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,&table_list,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,&table_list,2,0))
break;
-#endif /*DONT_ALLOW_SHOW_COMMANDS*/
mysqld_list_fields(thd,&table_list,fields);
free_items(thd->free_list);
break;
@@ -1598,19 +1594,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
case COM_PROCESS_INFO:
statistic_increment(com_stat[SQLCOM_SHOW_PROCESSLIST],&LOCK_status);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
-#endif
mysql_log.write(thd,command,NullS);
mysqld_list_processes(thd,
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access & PROCESS_ACL ?
- NullS : thd->priv_user
-#else
- NullS
-#endif
- ,0);
+ NullS : thd->priv_user, 0);
break;
case COM_PROCESS_KILL:
{
@@ -1814,29 +1803,17 @@ mysql_execute_command(THD *thd)
}
}
}
- if (&lex->select_lex != lex->all_selects_list)
- {
- byte *save= lex->select_lex.table_list.first;
- if (lex->sql_command == SQLCOM_CREATE_TABLE)
- {
- /* Skip first table, which is the table we are creating */
- lex->select_lex.table_list.first= (byte*) (((TABLE_LIST *) save)->next);
- }
- if (lex->unit.create_total_list(thd, lex, &tables, 0))
- DBUG_VOID_RETURN;
- lex->select_lex.table_list.first= save;
- }
+ if (&lex->select_lex != lex->all_selects_list &&
+ lex->sql_command != SQLCOM_CREATE_TABLE &&
+ lex->unit.create_total_list(thd, lex, &tables, 0))
+ DBUG_VOID_RETURN;
/*
When option readonly is set deny operations which change tables.
Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
- !(thd->slave_thread
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- || (thd->master_access & SUPER_ACL)
-#endif
- ) &&
+ !(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
(uc_update_queries[lex->sql_command] > 0))
{
send_error(thd, ER_CANT_UPDATE_WITH_READLOCK);
@@ -1848,7 +1825,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_SELECT:
{
select_result *result=lex->result;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (tables)
{
res=check_table_access(thd,
@@ -1864,7 +1840,6 @@ mysql_execute_command(THD *thd)
res=0;
break; // Error message is given
}
-#endif
/*
In case of single SELECT unit->global_parameters points on first SELECT
TODO: move counters to SELECT_LEX
@@ -2101,7 +2076,6 @@ mysql_execute_command(THD *thd)
{
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,CREATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option)
@@ -2109,12 +2083,11 @@ mysql_execute_command(THD *thd)
/* Check that the first table has CREATE privilege */
TABLE_LIST *tmp_table_list=tables->next;
tables->next=0;
- bool error=check_grant(thd,CREATE_ACL,tables);
+ bool error=check_grant(thd,CREATE_ACL,tables,0,0);
tables->next=tmp_table_list;
if (error)
goto error;
}
-#endif
if (strlen(tables->real_name) > NAME_LEN)
{
net_printf(thd,ER_WRONG_TABLE_NAME, tables->real_name);
@@ -2137,43 +2110,34 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_TABLE:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ /* Skip first table, which is the table we are creating */
+ TABLE_LIST *create_table= tables;
+ tables= tables->next;
+ lex->select_lex.table_list.first= (byte*) (tables);
+ create_table->next= 0;
+ if (&lex->select_lex != lex->all_selects_list &&
+ lex->unit.create_total_list(thd, lex, &tables, 0))
+ DBUG_VOID_RETURN;
+
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
CREATE_TMP_ACL : CREATE_ACL);
-#endif
- if (!tables->db)
- tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (check_access(thd,want_priv,tables->db,&tables->grant.privilege,0,0) ||
- check_merge_table_access(thd, tables->db,
+ if (check_access(thd, want_priv, create_table->db,
+ &create_table->grant.privilege, 0, 0) ||
+ check_merge_table_access(thd, create_table->db,
(TABLE_LIST *)
lex->create_info.merge_list.first))
goto error; /* purecov: inspected */
- if (grant_option && want_priv != CREATE_TMP_ACL)
- {
- /* Check that the first table has CREATE privilege */
- TABLE_LIST *tmp_table_list=tables->next;
- tables->next=0;
- bool error=check_grant(thd, want_priv, tables);
- tables->next=tmp_table_list;
- if (error)
+ if (grant_option && want_priv != CREATE_TMP_ACL &&
+ check_grant(thd, want_priv, create_table,0,0))
goto error;
- }
-#endif
- if (strlen(tables->real_name) > NAME_LEN)
- {
- net_printf(thd, ER_WRONG_TABLE_NAME, tables->alias);
- res=0;
- break;
- }
#ifndef HAVE_READLINK
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
#else
/* Fix names if symlinked tables */
if (append_file_to_dir(thd, &lex->create_info.data_file_name,
- tables->real_name) ||
+ create_table->real_name) ||
append_file_to_dir(thd,&lex->create_info.index_file_name,
- tables->real_name))
+ create_table->real_name))
{
res=-1;
break;
@@ -2197,49 +2161,42 @@ mysql_execute_command(THD *thd)
select_result *result;
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
- find_real_table_in_list(tables->next, tables->db, tables->real_name))
+ find_real_table_in_list(tables, create_table->db,
+ create_table->real_name))
{
- net_printf(thd,ER_UPDATE_TABLE_USED,tables->real_name);
+ net_printf(thd,ER_UPDATE_TABLE_USED, create_table->real_name);
DBUG_VOID_RETURN;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (tables->next)
- {
- if (check_table_access(thd, SELECT_ACL, tables->next,0))
- goto error; // Error message is given
- }
-#endif
+ if (tables && check_table_access(thd, SELECT_ACL, tables,0))
+ goto error; // Error message is given
select_lex->options|= SELECT_NO_UNLOCK;
unit->offset_limit_cnt= select_lex->offset_limit;
unit->select_limit_cnt= select_lex->select_limit+
select_lex->offset_limit;
if (unit->select_limit_cnt < select_lex->select_limit)
- unit->select_limit_cnt= HA_POS_ERROR; // No limit
+ unit->select_limit_cnt= HA_POS_ERROR; // No limit
- /* Skip first table, which is the table we are creating */
- lex->select_lex.table_list.first=
- (byte*) (((TABLE_LIST *) lex->select_lex.table_list.first)->next);
- if (!(res=open_and_lock_tables(thd,tables->next)))
+ if (!(res=open_and_lock_tables(thd,tables)))
{
- if ((result=new select_create(tables->db ? tables->db : thd->db,
- tables->real_name, &lex->create_info,
+ res= -1; // If error
+ if ((result=new select_create(create_table->db,
+ create_table->real_name,
+ &lex->create_info,
lex->create_list,
lex->key_list,
select_lex->item_list,lex->duplicates)))
res=handle_select(thd, lex, result);
- else
- res= -1;
}
}
else // regular create
{
if (lex->name)
- res= mysql_create_like_table(thd, tables, &lex->create_info,
+ res= mysql_create_like_table(thd, create_table, &lex->create_info,
(Table_ident *)lex->name);
else
{
- res= mysql_create_table(thd,tables->db ? tables->db : thd->db,
- tables->real_name, &lex->create_info,
+ res= mysql_create_table(thd,create_table->db,
+ create_table->real_name, &lex->create_info,
lex->create_list,
lex->key_list,0,0,0); // do logging
}
@@ -2251,12 +2208,10 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_INDEX:
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,INDEX_ACL,tables))
+ if (grant_option && check_grant(thd,INDEX_ACL,tables,0,0))
goto error;
-#endif
thd->slow_command=TRUE;
if (end_active_trans(thd))
res= -1;
@@ -2324,10 +2279,9 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option)
{
- if (check_grant(thd,ALTER_ACL,tables))
+ if (check_grant(thd,ALTER_ACL,tables,0,0))
goto error;
if (lex->name && !test_all_bits(priv,INSERT_ACL | CREATE_ACL))
{ // Rename of table
@@ -2336,11 +2290,10 @@ mysql_execute_command(THD *thd)
tmp_table.real_name=lex->name;
tmp_table.db=select_lex->db;
tmp_table.grant.privilege=priv;
- if (check_grant(thd,INSERT_ACL | CREATE_ACL,tables))
+ if (check_grant(thd,INSERT_ACL | CREATE_ACL,tables,0,0))
goto error;
}
}
-#endif
/* Don't yet allow changing of symlinks with ALTER TABLE */
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
/* ALTER TABLE ends previous transaction */
@@ -2368,7 +2321,6 @@ mysql_execute_command(THD *thd)
TABLE_LIST *table;
if (check_db_used(thd,tables))
goto error;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
for (table=tables ; table ; table=table->next->next)
{
if (check_access(thd, ALTER_ACL | DROP_ACL, table->db,
@@ -2382,14 +2334,13 @@ mysql_execute_command(THD *thd)
old_list=table[0];
new_list=table->next[0];
old_list.next=new_list.next=0;
- if (check_grant(thd,ALTER_ACL,&old_list) ||
+ if (check_grant(thd,ALTER_ACL,&old_list,0,0) ||
(!test_all_bits(table->next->grant.privilege,
INSERT_ACL | CREATE_ACL) &&
- check_grant(thd,INSERT_ACL | CREATE_ACL, &new_list)))
+ check_grant(thd,INSERT_ACL | CREATE_ACL, &new_list,0,0)))
goto error;
}
}
-#endif
query_cache_invalidate3(thd, tables, 0);
if (end_active_trans(thd))
res= -1;
@@ -2543,12 +2494,10 @@ mysql_execute_command(THD *thd)
res= -1;
break;
case SQLCOM_UPDATE_MULTI:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error;
- if (grant_option && check_grant(thd,UPDATE_ACL,tables))
+ if (grant_option && check_grant(thd,UPDATE_ACL,tables,0,0))
goto error;
-#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2578,16 +2527,12 @@ mysql_execute_command(THD *thd)
case SQLCOM_REPLACE:
case SQLCOM_INSERT:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (single_table_command_access(thd, privilege, tables, &res))
goto error;
-#else
- my_bool update=(lex->value_list.elements ? 1 : 0);
-#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2607,7 +2552,6 @@ mysql_execute_command(THD *thd)
Check that we have modify privileges for the first table and
select privileges for the rest
*/
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
{
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
@@ -2615,18 +2559,17 @@ mysql_execute_command(THD *thd)
tables->next=0;
if (check_access(thd, privilege,
tables->db,&tables->grant.privilege,0,0) ||
- (grant_option && check_grant(thd, privilege, tables)))
+ (grant_option && check_grant(thd, privilege, tables,0,0)))
goto error;
tables->next=save_next;
if ((res=check_table_access(thd, SELECT_ACL, save_next,0)))
goto error;
}
-#endif
/* Fix lock for first table */
if (tables->lock_type == TL_WRITE_DELAYED)
- tables->lock_type == TL_WRITE;
+ tables->lock_type = TL_WRITE;
/* Don't unlock tables until command is written to binary log */
select_lex->options|= SELECT_NO_UNLOCK;
@@ -2661,12 +2604,10 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_TRUNCATE:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,DELETE_ACL,tables))
+ if (grant_option && check_grant(thd,DELETE_ACL,tables,0,0))
goto error;
-#endif
/*
Don't allow this within a transaction because we want to use
re-generate table
@@ -2680,12 +2621,10 @@ mysql_execute_command(THD *thd)
break;
case SQLCOM_DELETE:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (single_table_command_access(thd, DELETE_ACL, tables, &res))
goto error;
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
-#endif
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, select_lex->options);
@@ -2807,12 +2746,10 @@ mysql_execute_command(THD *thd)
case SQLCOM_DROP_INDEX:
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,INDEX_ACL,tables))
+ if (grant_option && check_grant(thd,INDEX_ACL,tables,0,0))
goto error;
-#endif
if (end_active_trans(thd))
res= -1;
else
@@ -2830,18 +2767,11 @@ mysql_execute_command(THD *thd)
break;
#endif
case SQLCOM_SHOW_PROCESSLIST:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
-#endif
mysqld_list_processes(thd,
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access & PROCESS_ACL ? NullS :
- thd->priv_user
-#else
- NullS
-#endif
- ,lex->verbose);
+ thd->priv_user,lex->verbose);
break;
case SQLCOM_SHOW_TABLE_TYPES:
res= mysqld_show_table_types(thd);
@@ -2867,10 +2797,8 @@ mysql_execute_command(THD *thd)
DBUG_VOID_RETURN;
#else
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option && check_access(thd, FILE_ACL, any_db,0,0,0))
goto error;
-#endif
res= mysqld_show_logs(thd);
break;
}
@@ -2894,7 +2822,6 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_WRONG_DB_NAME, db);
goto error;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db))
@@ -2905,7 +2832,6 @@ mysql_execute_command(THD *thd)
db);
goto error;
}
-#endif
/* grant is checked in mysqld_show_tables */
if (select_lex->options & SELECT_DESCRIBE)
res= mysqld_extend_show_tables(thd,db,
@@ -2939,13 +2865,11 @@ mysql_execute_command(THD *thd)
}
remove_escape(db); // Fix escaped '_'
remove_escape(tables->real_name);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,tables,2,0))
goto error;
-#endif
res= mysqld_show_fields(thd,tables,
(lex->wild ? lex->wild->ptr() : NullS),
lex->verbose);
@@ -2968,13 +2892,11 @@ mysql_execute_command(THD *thd)
remove_escape(tables->real_name);
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,tables,2,0))
goto error;
-#endif
res= mysqld_show_keys(thd,tables);
break;
}
@@ -2985,7 +2907,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_LOAD:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
@@ -3002,11 +2923,11 @@ mysql_execute_command(THD *thd)
send_error(thd,ER_NOT_ALLOWED_COMMAND);
goto error;
}
- if (check_access(thd,privilege,tables->db,&tables->grant.privilege,0,0) ||
- grant_option && check_grant(thd,privilege,tables))
+ if (check_access(thd,privilege,tables->db,&tables->grant.privilege,0,
+ 0) ||
+ grant_option && check_grant(thd,privilege,tables,0,0))
goto error;
}
-#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
res=mysql_load(thd, lex->exchange, tables, lex->field_list,
lex->duplicates, (bool) lex->local_file, lex->lock_option);
break;
@@ -3250,7 +3171,7 @@ mysql_execute_command(THD *thd)
if (grant_option && check_grant(thd,
(lex->grant | lex->grant_tot_col |
GRANT_ACL),
- tables))
+ tables,0,0))
goto error;
if (!(res = mysql_table_grant(thd,tables,lex->users_list, lex->columns,
lex->grant,
@@ -3458,7 +3379,6 @@ error:
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check grants for commands which work only with one table and all other
tables belong to subselects.
@@ -3479,23 +3399,23 @@ static bool single_table_command_access(THD *thd, ulong privilege,
TABLE_LIST *tables, int *res)
{
- if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
- return 1;
+ if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
+ return 1;
- // Show only 1 table for check_grant
- TABLE_LIST *subselects_tables= tables->next;
- tables->next= 0;
- if (grant_option && check_grant(thd, privilege, tables))
- return 1;
+ // Show only 1 table for check_grant
+ TABLE_LIST *subselects_tables= tables->next;
+ tables->next= 0;
+ if (grant_option && check_grant(thd, privilege, tables, 0, 0))
+ return 1;
- // check rights on tables of subselect (if exists)
- if (subselects_tables)
- {
- tables->next= subselects_tables;
- if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables,0)))
- return 1;
- }
- return 0;
+ // check rights on tables of subselect (if exists)
+ if (subselects_tables)
+ {
+ tables->next= subselects_tables;
+ if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables,0)))
+ return 1;
+ }
+ return 0;
}
@@ -3538,6 +3458,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_RETURN(TRUE); /* purecov: tested */
}
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ DBUG_RETURN(0);
+#else
if ((thd->master_access & want_access) == want_access)
{
/*
@@ -3587,6 +3510,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
thd->priv_host,
db ? db : thd->db ? thd->db : "unknown"); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
@@ -3611,6 +3535,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool check_global_access(THD *thd, ulong want_access)
{
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ return 0;
+#else
char command[128];
if ((thd->master_access & want_access))
return 0;
@@ -3618,6 +3545,7 @@ bool check_global_access(THD *thd, ulong want_access)
net_printf(thd,ER_SPECIFIC_ACCESS_DENIED_ERROR,
command);
return 1;
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
@@ -3682,7 +3610,6 @@ static bool check_merge_table_access(THD *thd, char *db,
return error;
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
static bool check_db_used(THD *thd,TABLE_LIST *tables)
{
@@ -3941,9 +3868,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
else
{
mysql_execute_command(thd);
-#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_end_of_result(&thd->net);
-#endif
}
}
}
@@ -3951,9 +3876,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error));
-#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(&thd->net);
-#endif
}
thd->proc_info="freeing items";
free_items(thd->free_list); /* Free strings used by items */
@@ -4005,7 +3928,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
{
if (type == FIELD_TYPE_TIMESTAMP)
{
- net_printf(&thd->net, ER_INVALID_DEFAULT, field_name);
+ net_printf(thd, ER_INVALID_DEFAULT, field_name);
DBUG_RETURN(1);
}
else if (default_value->type() == Item::NULL_ITEM)
@@ -4674,10 +4597,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
UNLOCK_ACTIVE_MI;
}
#endif
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL);
-#endif
if (write_to_binlog)
*write_to_binlog= tmp_write_to_binlog;
return result;
@@ -4712,18 +4633,14 @@ void kill_one_thread(THD *thd, ulong id)
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (tmp)
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if ((thd->master_access & SUPER_ACL) ||
!strcmp(thd->user,tmp->user))
-#endif
{
tmp->awake(1 /*prepare to die*/);
error=0;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
else
error=ER_KILL_DENIED_ERROR;
-#endif
pthread_mutex_unlock(&tmp->LOCK_delete);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 790b80eb127..58e6dbff1ed 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -544,7 +544,7 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
if (check_access(thd,privilege,table_list->db,
&table_list->grant.privilege,0,0) ||
- (grant_option && check_grant(thd,privilege,table_list)))
+ (grant_option && check_grant(thd,privilege,table_list,0,0)))
DBUG_RETURN(1);
#endif
if (open_and_lock_tables(thd, table_list))
@@ -599,7 +599,7 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,UPDATE_ACL,table_list->db,
&table_list->grant.privilege,0,0) ||
- (grant_option && check_grant(thd,UPDATE_ACL,table_list)))
+ (grant_option && check_grant(thd,UPDATE_ACL,table_list,0,0)))
DBUG_RETURN(1);
#endif
if (open_and_lock_tables(thd, table_list))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b2224d3ca9d..16b9a341ee5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1134,8 +1134,6 @@ JOIN::exec()
simple_order= simple_group;
skip_sort_order= 0;
}
- if (!order && !no_order)
- order=group_list;
if (order &&
(const_tables == tables ||
((simple_order || skip_sort_order) &&
@@ -2487,8 +2485,6 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
join_tab[i].table->map);
}
}
- if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64))
- return TRUE;
/* fill keyuse with found key parts */
for ( ; field != end ; field++)
add_key_part(keyuse,field);
@@ -3255,7 +3251,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
if (j->type == JT_CONST)
j->table->const_table= 1;
else if (((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY |
- HA_END_SPACE_KEY)) != HA_NOSAME) ||
+ HA_END_SPACE_KEY)) != HA_NOSAME) ||
keyparts != keyinfo->key_parts || null_ref_key)
{
/* Must read with repeat */
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 9f54b838e41..7dc537768f3 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -596,7 +596,8 @@ int multi_update::prepare(List<Item> &not_used_values,
{
TABLE *table=table_ref->table;
if (!(tables_to_update & table->map) &&
- check_dup(table_ref->db, table_ref->real_name, update_tables))
+ find_real_table_in_list(update_tables, table_ref->db,
+ table_ref->real_name))
table->no_cache= 1; // Disable row cache
}
DBUG_RETURN(thd->is_fatal_error != 0);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ef71036206a..c847c6958a0 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -579,9 +579,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%left SHIFT_LEFT SHIFT_RIGHT
%left '-' '+'
%left '*' '/' '%' DIV_SYM MOD_SYM
-%left NEG '~'
%left XOR
%left '^'
+%left NEG '~'
%right NOT
%right BINARY COLLATE_SYM
diff --git a/sql/table.cc b/sql/table.cc
index fc1b8a13497..bc437f250b9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1234,11 +1234,12 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
char *get_field(MEM_ROOT *mem, Field *field)
{
- char buff[MAX_FIELD_WIDTH] *to;
+ char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
uint length;
field->val_str(&str,&str);
+ length= str.length();
if (!length || !(to= (char*) alloc_root(mem,length+1)))
return NullS;
memcpy(to,str.ptr(),(uint) length);