diff --git a/include/mysql.h b/include/mysql.h index 5672744729a..5441910efa9 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -565,6 +565,7 @@ typedef struct st_mysql_methods MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt); int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row); void (STDCALL *free_embedded_thd)(MYSQL *mysql); + const char *(STDCALL *read_statistic)(MYSQL *mysql); #endif } MYSQL_METHODS; diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 7646d3e7494..3c20202603f 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -256,8 +256,8 @@ #define ER_SLAVE_IGNORED_TABLE 1237 #define ER_WRONG_FK_DEF 1238 #define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1239 -#define ER_CARDINALITY_COL 1240 -#define ER_SUBSELECT_NO_1_ROW 1241 +#define ER_OPERAND_COLUMNS 1240 +#define ER_SUBQUERY_NO_1_ROW 1241 #define ER_UNKNOWN_STMT_HANDLER 1242 #define ER_CORRUPT_HELP_DB 1243 #define ER_CYCLIC_REFERENCE 1244 diff --git a/include/sql_state.h b/include/sql_state.h index 26568ac3e0d..c0b7cf97ea5 100644 --- a/include/sql_state.h +++ b/include/sql_state.h @@ -145,8 +145,8 @@ ER_WRONG_TYPE_FOR_VAR, "42000", "", ER_CANT_USE_OPTION_HERE, "42000", "", ER_NOT_SUPPORTED_YET, "42000", "", ER_WRONG_FK_DEF, "42000", "", -ER_CARDINALITY_COL, "21000", "", -ER_SUBSELECT_NO_1_ROW, "21000", "", +ER_OPERAND_COLUMNS, "21000", "", +ER_SUBQUERY_NO_1_ROW, "21000", "", ER_ILLEGAL_REFERENCE, "42S22", "", ER_DERIVED_MUST_HAVE_ALIAS, "42000", "", ER_SELECT_REDUCED, "01000", "", diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index d0432503ee9..b9c47c1dd55 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -57,3 +57,4 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, int STDCALL cli_stmt_execute(MYSQL_STMT *stmt); MYSQL_DATA *cli_read_binary_rows(MYSQL_STMT *stmt); int STDCALL cli_unbuffered_fetch(MYSQL *mysql, char **row); +const char * STDCALL cli_read_statistic(MYSQL *mysql); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3efce367cae..0e937a6e0c9 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1102,12 +1102,8 @@ mysql_dump_debug_info(MYSQL *mysql) DBUG_RETURN(simple_command(mysql,COM_DEBUG,0,0,0)); } -const char * STDCALL -mysql_stat(MYSQL *mysql) +const char * STDCALL cli_read_statistic(MYSQL *mysql) { - DBUG_ENTER("mysql_stat"); - if (simple_command(mysql,COM_STATISTICS,0,0,0)) - return mysql->net.last_error; mysql->net.read_pos[mysql->packet_length]=0; /* End of stat string */ if (!mysql->net.read_pos[0]) { @@ -1116,7 +1112,16 @@ mysql_stat(MYSQL *mysql) strmov(mysql->net.last_error, ER(mysql->net.last_errno)); return mysql->net.last_error; } - DBUG_RETURN((char*) mysql->net.read_pos); + return (char*) mysql->net.read_pos; +} + +const char * STDCALL +mysql_stat(MYSQL *mysql) +{ + DBUG_ENTER("mysql_stat"); + if (simple_command(mysql,COM_STATISTICS,0,0,0)) + return mysql->net.last_error; + DBUG_RETURN((*mysql->methods->read_statistic)(mysql)); } diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index ddfd05d64b6..c9f98a701ef 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -75,7 +75,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, client). So we have to call free_old_query here */ free_old_query(mysql); - if (!arg) + + thd->extra_length= arg_length; + thd->extra_data= (char *)arg; + if (header) { arg= header; arg_length= header_length; @@ -92,7 +95,10 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, memcpy(net->sqlstate, thd->net.sqlstate, sizeof(net->sqlstate)); } else + { net->last_error[0]= 0; + strmov(net->sqlstate, not_error_sqlstate); + } mysql->warning_count= ((THD*)mysql->thd)->total_warn_count; return result; } @@ -128,6 +134,8 @@ static MYSQL_FIELD * STDCALL emb_list_fields(MYSQL *mysql) static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) { THD *thd= (THD*)mysql->thd; + if (mysql->net.last_errno) + return 1; stmt->stmt_id= thd->client_stmt_id; stmt->param_count= thd->client_param_count; stmt->field_count= mysql->field_count; @@ -176,6 +184,11 @@ static int STDCALL emb_stmt_execute(MYSQL_STMT *stmt) THD *thd= (THD*)stmt->mysql->thd; thd->client_param_count= stmt->param_count; thd->client_params= stmt->params; + if (thd->data) + { + free_rows(thd->data); + thd->data= 0; + } if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0, (const char*)&stmt->stmt_id,sizeof(stmt->stmt_id),1) || emb_mysql_read_query_result(stmt->mysql)) @@ -217,9 +230,16 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql) THD *thd= (THD*)mysql->thd; if (thd->data) free_rows(thd->data); + thread_count--; delete thd; } +static const char * STDCALL emb_read_statistic(MYSQL *mysql) +{ + THD *thd= (THD*)mysql->thd; + return thd->net.last_error; +} + MYSQL_METHODS embedded_methods= { emb_mysql_read_query_result, @@ -232,7 +252,8 @@ MYSQL_METHODS embedded_methods= emb_stmt_execute, emb_read_binary_rows, emb_unbuffered_fetch, - emb_free_embedded_thd + emb_free_embedded_thd, + emb_read_statistic }; C_MODE_END @@ -431,6 +452,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag, char *db) { THD *thd = (THD *)mysql->thd; thd->mysql= mysql; + mysql->server_version= server_version; } void *create_embedded_thd(int client_flag, char *db) @@ -465,6 +487,7 @@ void *create_embedded_thd(int client_flag, char *db) thd->data= 0; + thread_count++; return thd; } diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 6932e0d5476..d24ac5e898a 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -196,13 +196,22 @@ drop table t1,t2; SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; x 1 -create table a1 select 1 as a; -select 2 as a from (select * from a1) b; +create table t1 select 1 as a; +select 2 as a from (select * from t1) b; ERROR 3D000: No Database Selected use test; -select 2 as a from (select * from a1) b; +select 2 as a from (select * from t1) b; a 2 -drop table a1; +drop table t1; select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id; 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 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1 +create table t1 (a int); +insert into t1 values (1),(2),(3); +update (select * from t1) as t1 set a = 5; +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 +delete from (select * from t1); +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 '(select * from t1)' at line 1 +insert into (select * from t1) values (5); +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 '(select * from t1) values (5)' at line 1 +drop table t1; diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 94186f254c4..ab60f714d82 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -36,7 +36,7 @@ select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))); (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))) 1 select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4)); -ERROR 21000: Cardinality error (more/less than 2 columns) +ERROR 21000: Operand should contain 2 column(s) select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))) NULL @@ -86,7 +86,7 @@ SELECT ROW('test',2,3.33)=ROW('test',2,3.33); ROW('test',2,3.33)=ROW('test',2,3.33) 1 SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4); -ERROR 21000: Cardinality error (more/less than 3 columns) +ERROR 21000: Operand should contain 3 column(s) SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33)); ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33)) 1 @@ -97,7 +97,7 @@ SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)) NULL SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); -ERROR 21000: Cardinality error (more/less than 2 columns) +ERROR 21000: Operand should contain 2 column(s) create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -135,14 +135,14 @@ ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) 1 drop table t1; select ROW(1,1); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) create table t1 (i int); select 1 from t1 where ROW(1,1); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) select count(*) from t1 order by ROW(1,1); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) select count(*) from t1 having (1,1) order by i; -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) drop table t1; create table t1 (a int, b int); insert into t1 values (1, 4); diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result index 0ad61a7687e..802be911ad7 100644 --- a/mysql-test/r/rpl_relayrotate.result +++ b/mysql-test/r/rpl_relayrotate.result @@ -10,9 +10,9 @@ reset slave; start slave; stop slave; start slave; -select master_pos_wait('master-bin.001',3000,120)=-1; -master_pos_wait('master-bin.001',3000,120)=-1 -0 +select master_pos_wait('master-bin.001',3000)>=0; +master_pos_wait('master-bin.001',3000)>=0 +1 select * from t1 where a=8000; a 8000 diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result index 3dc3de8802d..ee5ceb28bd8 100644 --- a/mysql-test/r/rpl_until.result +++ b/mysql-test/r/rpl_until.result @@ -69,4 +69,4 @@ ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL start slave sql_thread; start slave until master_log_file='master-bin.000001', master_log_pos=561; Warnings: -Note 1253 The slave was already running +Note 1253 Slave is already running diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index b715b750b68..71147772ac4 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -21,6 +21,7 @@ set @q:='abc'; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')); set @a:=5; insert into t1 values (@a),(@a); +insert into t1 values (@a),(@a),(@a*5); select * from t1; n 12345678901234 @@ -45,6 +46,36 @@ abcn1 abcn1n2 5 5 +NULL +NULL +NULL +select * from t1; +n +12345678901234 +-12345678901234 +0 +-1 +12.5 +-12.5 +This is a test + +abc'def +abc\def +abc'def +NULL +NULL +0 +1 +2 +5 +abc +abcn1 +abcn1n2 +5 +5 +NULL +NULL +NULL show binlog events from 141; Log_name Pos Event_type Server_id Orig_log_pos Info slave-bin.000001 141 User var 2 141 @i1=12345678901234 @@ -63,13 +94,16 @@ slave-bin.000001 719 User var 2 719 @s5='abc'def' slave-bin.000001 761 Query 1 761 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5) slave-bin.000001 851 User var 2 851 @n1=NULL slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1) -slave-bin.000001 939 Query 1 939 use `test`; insert into t1 values (@n2) -slave-bin.000001 1001 Query 1 1001 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1) -slave-bin.000001 1089 User var 2 1089 @a=2 -slave-bin.000001 1131 Query 1 1131 use `test`; insert into t1 values (@a+(@b:=@a+1)) -slave-bin.000001 1203 User var 2 1203 @q='abc' -slave-bin.000001 1240 Query 1 1240 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) -slave-bin.000001 1344 User var 2 1344 @a=5 -slave-bin.000001 1386 Query 1 1386 use `test`; insert into t1 values (@a),(@a) +slave-bin.000001 939 User var 2 939 @n2=NULL +slave-bin.000001 965 Query 1 965 use `test`; insert into t1 values (@n2) +slave-bin.000001 1027 Query 1 1027 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1) +slave-bin.000001 1115 User var 2 1115 @a=2 +slave-bin.000001 1157 Query 1 1157 use `test`; insert into t1 values (@a+(@b:=@a+1)) +slave-bin.000001 1229 User var 2 1229 @q='abc' +slave-bin.000001 1266 Query 1 1266 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) +slave-bin.000001 1370 User var 2 1370 @a=5 +slave-bin.000001 1412 Query 1 1412 use `test`; insert into t1 values (@a),(@a) +slave-bin.000001 1478 User var 2 1478 @a=NULL +slave-bin.000001 1503 Query 1 1503 use `test`; insert into t1 values (@a),(@a),(@a*5) drop table t1; stop slave; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index d29609f5f85..d5186dc9c44 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -59,7 +59,7 @@ SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c O id 1 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) SELECT 1 IN (SELECT 1); 1 IN (SELECT 1) 1 @@ -124,7 +124,7 @@ SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); (SELECT 1.5,'c','a') = ROW(1.5,2,'a') 0 SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) SELECT 1 as a,(SELECT a+a) b,(SELECT b); a b (SELECT b) 1 2 2 @@ -257,9 +257,9 @@ a 7 delete from t2 where a=100; select * from t3 where a in (select a,b from t2); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) select * from t3 where a in (select * from t2); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10); select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b); b ma @@ -295,7 +295,7 @@ Warnings: Note 1275 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1 Note 1275 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1 select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table t7( uq int primary key, name char(25)); insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta"); @@ -346,15 +346,15 @@ id select_type table type possible_keys key key_len ref rows Extra 3 SUBQUERY t8 const PRIMARY PRIMARY 35 1 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM t8 WHERE pseudo='joce'); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE pseudo='joce'); -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); pseudo joce SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%'); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; CREATE TABLE `t1` ( `topic` mediumint(8) unsigned NOT NULL default '0', @@ -384,7 +384,7 @@ SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; 1 1 SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index NULL topic 3 NULL 2 Using index @@ -471,9 +471,9 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`) ) TYPE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1); select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row drop table t1; create table t1 (a int); insert into t1 values (1),(2),(3); @@ -486,7 +486,7 @@ drop table t1; CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b'); INSERT INTO t1 VALUES (); SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b'); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row drop table t1; CREATE TABLE `t1` ( `numeropost` mediumint(8) unsigned NOT NULL default '0', @@ -504,7 +504,7 @@ SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT numreponse (SELECT numeropost FROM t1 HAVING numreponse=1) INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away @@ -531,7 +531,7 @@ a b update t1 set b= (select b from t1); ERROR HY000: You can't specify target table 't1' for update in FROM clause update t1 set b= (select b from t2); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row update t1 set b= (select b from t2 where t1.a = t2.a); select * from t1; a b @@ -554,7 +554,7 @@ a b delete from t1 where b = (select b from t1); ERROR HY000: You can't specify target table 't1' for update in FROM clause delete from t1 where b = (select b from t2); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row delete from t1 where b = (select b from t2 where t1.a = t2.a); select * from t1; a b @@ -580,7 +580,7 @@ a b delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); ERROR HY000: You can't specify target table 't12' for update in FROM clause delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); select * from t11; a b @@ -599,7 +599,7 @@ insert into t3 values (1),(2); INSERT INTO t1 (x) VALUES ((SELECT x FROM t1)); ERROR HY000: You can't specify target table 't1' for update in FROM clause INSERT INTO t1 (x) VALUES ((SELECT b FROM t3)); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row INSERT INTO t1 (x) VALUES ((SELECT a FROM t2)); select * from t1; x @@ -641,7 +641,7 @@ x y replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2)); ERROR HY000: You can't specify target table 't1' for update in FROM clause replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2)); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2)); select * from t1; x y @@ -712,7 +712,7 @@ id CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t1 values (1),(1); UPDATE t2 SET id=(SELECT * FROM t1); -ERROR 21000: Subquery returns more than 1 record +ERROR 21000: Subquery returns more than 1 row drop table t2, t1; create table t1 (a int); insert into t1 values (1),(2),(3); @@ -1186,7 +1186,7 @@ insert into t1 values (1,0), (2,0), (3,0); insert into t2 values (1,1), (2,1), (3,1), (2,2); update ignore t1 set b=(select b from t2 where t1.a=t2.a); Warnings: -Error 1241 Subquery returns more than 1 record +Error 1241 Subquery returns more than 1 row select * from t1; a b 1 1 @@ -1377,7 +1377,7 @@ userid pmtotal pmnew calc_total calc_new drop table t1, t2; create table t1 (s1 char(5)); select (select 'a','b' from t1 union select 'a','b' from t1) from t1; -ERROR 21000: Cardinality error (more/less than 1 columns) +ERROR 21000: Operand should contain 1 column(s) insert into t1 values ('tttt'); select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1); s1 diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 23253f60de9..b7c64551dc0 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -5,6 +5,10 @@ set @a := connection_id() + 3; select @a - connection_id(); @a - connection_id() 3 +set @b := 1; +select @b; +@b +1 CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 39e61b7caaa..a8583aa5ea3 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -99,13 +99,26 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1; # Test for select if database is not selected. # # Connect without a database -create table a1 select 1 as a; +create table t1 select 1 as a; connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); connection con1; --error 1046 -select 2 as a from (select * from a1) b; +select 2 as a from (select * from t1) b; use test; -select 2 as a from (select * from a1) b; -drop table a1; +select 2 as a from (select * from t1) b; +drop table t1; --error 1064 select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id; + +# +# UPDATE/DELETE/INSERT of derived tables +# +create table t1 (a int); +insert into t1 values (1),(2),(3); +-- error 1149 +update (select * from t1) as t1 set a = 5; +-- error 1064 +delete from (select * from t1); +-- error 1064 +insert into (select * from t1) values (5); +drop table t1; diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test index 3f315ba9365..7a572740b3a 100644 --- a/mysql-test/t/rpl_relayrotate.test +++ b/mysql-test/t/rpl_relayrotate.test @@ -40,6 +40,8 @@ start slave; # Usually it stops when the SQL thread is around the 15th relay log. # We cannot use MASTER_POS_WAIT() as master's position # increases only when the slave executes the COMMIT. +# Note that except when using Valgrind, 1 second is enough for the I/O slave +# thread to fetch the whole master's binlog. sleep 1; stop slave; # We suppose the SQL thread stopped before COMMIT. @@ -53,10 +55,7 @@ start slave; # We must wait for the transaction to commit before # reading, MASTER_POS_WAIT() will do it for sure # (the only statement with position>=3000 is COMMIT). -# Older versions of MySQL would hang forever in MASTER_POS_WAIT -# because COMMIT was said to be position 0 in the master's log (bug). -# Detect this with timeout. -select master_pos_wait('master-bin.001',3000,120)=-1; +select master_pos_wait('master-bin.001',3000)>=0; select * from t1 where a=8000; # The following DROP is a very important cleaning task: diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test index 7eeccaf64f2..35fbec72ac8 100644 --- a/mysql-test/t/rpl_user_variables.test +++ b/mysql-test/t/rpl_user_variables.test @@ -29,13 +29,16 @@ insert into t1 values (@i1), (@i2), (@i3), (@i4); insert into t1 values (@r1), (@r2); insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5); insert into t1 values (@n1); -insert into t1 values (@n2); +insert into t1 values (@n2); # not explicitely set before insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1); insert into t1 values (@a+(@b:=@a+1)); set @q:='abc'; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')); set @a:=5; insert into t1 values (@a),(@a); +connection master1; # see if variable is reset in binlog when thread changes +insert into t1 values (@a),(@a),(@a*5); +select * from t1; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 514eace25a3..947c944c79e 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -8,6 +8,9 @@ set @a := foo; set @a := connection_id() + 3; select @a - connection_id(); +set @b := 1; +select @b; + # Check using and setting variables with SELECT DISTINCT CREATE TABLE t1 ( i int not null, v int not null,index (i)); diff --git a/sql-common/client.c b/sql-common/client.c index 77aa733fe0c..cedfac67328 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1410,7 +1410,8 @@ static MYSQL_METHODS client_methods= cli_stmt_execute, cli_read_binary_rows, cli_unbuffered_fetch, - NULL + NULL, + cli_read_statistic #endif }; diff --git a/sql/item.cc b/sql/item.cc index 9d34f299a07..55df169965e 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -108,7 +108,7 @@ bool Item::check_cols(uint c) { if (c != 1) { - my_error(ER_CARDINALITY_COL, MYF(0), c); + my_error(ER_OPERAND_COLUMNS, MYF(0), c); return 1; } return 0; @@ -1784,7 +1784,7 @@ void Item_cache_row::illegal_method_call(const char *method) DBUG_ENTER("Item_cache_row::illegal_method_call"); DBUG_PRINT("error", ("!!! %s method was called for row item", method)); DBUG_ASSERT(0); - my_error(ER_CARDINALITY_COL, MYF(0), 1); + my_error(ER_OPERAND_COLUMNS, MYF(0), 1); DBUG_VOID_RETURN; } @@ -1792,7 +1792,7 @@ bool Item_cache_row::check_cols(uint c) { if (c != item_count) { - my_error(ER_CARDINALITY_COL, MYF(0), c); + my_error(ER_OPERAND_COLUMNS, MYF(0), c); return 1; } return 0; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index e7dc3933c10..3472f29850e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -229,7 +229,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) uint n= (*a)->cols(); if (n != (*b)->cols()) { - my_error(ER_CARDINALITY_COL, MYF(0), n); + my_error(ER_OPERAND_COLUMNS, MYF(0), n); comparators= 0; return 1; } @@ -239,7 +239,7 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type) { if ((*a)->el(i)->cols() != (*b)->el(i)->cols()) { - my_error(ER_CARDINALITY_COL, MYF(0), (*a)->el(i)->cols()); + my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->el(i)->cols()); return 1; } comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)); @@ -423,7 +423,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, Item_in_subselect * sub= (Item_in_subselect *)args[1]; if (args[0]->cols() != sub->engine->cols()) { - my_error(ER_CARDINALITY_COL, MYF(0), args[0]->cols()); + my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols()); return 1; } if (args[1]->maybe_null) @@ -1351,7 +1351,7 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item) cmp_item_row *tmpl= (cmp_item_row*) t; if (tmpl->n != item->cols()) { - my_error(ER_CARDINALITY_COL, MYF(0), tmpl->n); + my_error(ER_OPERAND_COLUMNS, MYF(0), tmpl->n); return; } n= tmpl->n; @@ -1378,7 +1378,7 @@ int cmp_item_row::cmp(Item *arg) arg->null_value= 0; if (arg->cols() != n) { - my_error(ER_CARDINALITY_COL, MYF(0), n); + my_error(ER_OPERAND_COLUMNS, MYF(0), n); return 1; } bool was_null= 0; diff --git a/sql/item_func.cc b/sql/item_func.cc index b7979e7909c..0f9ee512be1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2071,6 +2071,16 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->value=0; entry->length=0; entry->update_query_id=0; + /* + If we are here, we were called from a SET or a query which sets a + variable. Imagine it is this: + INSERT INTO t SELECT @a:=10, @a:=@a+1. + Then when we have a Item_func_get_user_var (because of the @a+1) so we + think we have to write the value of @a to the binlog. But before that, + we have a Item_func_set_user_var to create @a (@a:=10), in this we mark + the variable as "already logged" (line below) so that it won't be logged + by Item_func_get_user_var (because that's not necessary). + */ entry->used_query_id=current_thd->query_id; entry->type=STRING_RESULT; memcpy(entry->name.str, name.str, name.length+1); @@ -2083,7 +2093,10 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, return entry; } - +/* + When a user variable is updated (in a SET command or a query like SELECT @a:= + ). +*/ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) @@ -2093,6 +2106,11 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, !(entry= get_variable(&thd->user_vars, name, 1))) return 1; entry->type= cached_result_type; + /* + Remember the last query which updated it, this way a query can later know + if this variable is a constant item in the query (it is if update_query_id + is different from query_id). + */ entry->update_query_id=thd->query_id; return 0; } @@ -2315,53 +2333,92 @@ longlong Item_func_get_user_var::val_int() } +/* + When a user variable is invoked from an update query (INSERT, UPDATE etc), + stores this variable and its value in thd->user_var_events, so that it can be + written to the binlog (will be written just before the query is written, see + log.cc). +*/ + void Item_func_get_user_var::fix_length_and_dec() { - BINLOG_USER_VAR_EVENT *user_var_event; THD *thd=current_thd; + BINLOG_USER_VAR_EVENT *user_var_event; maybe_null=1; decimals=NOT_FIXED_DEC; max_length=MAX_BLOB_WIDTH; - if ((var_entry= get_variable(&thd->user_vars, name, 0))) - { - if (opt_bin_log && is_update_query(thd->lex.sql_command) && - var_entry->used_query_id != thd->query_id) - { - uint size; - /* - First we need to store value of var_entry, when the next situation - appers: - > set @a:=1; - > insert into t1 values (@a), (@a:=@a+1), (@a:=@a+1); - We have to write to binlog value @a= 1; - */ - size= ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)) + var_entry->length; - if (!(user_var_event= (BINLOG_USER_VAR_EVENT *) thd->alloc(size))) - goto err; + var_entry= get_variable(&thd->user_vars, name, 0); - user_var_event->value= (char*) user_var_event + - ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)); - user_var_event->user_var_event= var_entry; - user_var_event->type= var_entry->type; - user_var_event->charset_number= var_entry->collation.collation->number; - if (!var_entry->value) - { - /* NULL value*/ - user_var_event->length= 0; - user_var_event->value= 0; - } - else - { - user_var_event->length= var_entry->length; - memcpy(user_var_event->value, var_entry->value, - var_entry->length); - } - var_entry->used_query_id= thd->query_id; - if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event)) - goto err; - } + if (!(opt_bin_log && is_update_query(thd->lex.sql_command))) + return; + + if (!var_entry) + { + /* + If the variable does not exist, it's NULL, but we want to create it so + that it gets into the binlog (if it didn't, the slave could be + influenced by a variable of the same name previously set by another + thread). + We create it like if it had been explicitely set with SET before. + The 'new' mimicks what sql_yacc.yy does when 'SET @a=10;'. + sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION' + in dispatch_command()). Instead of building a one-element list to pass to + sql_set_variables(), we could instead manually call check() and update(); + this would save memory and time; but calling sql_set_variables() makes one + unique place to maintain (sql_set_variables()). + */ + + List tmp_var_list; + tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name, + new Item_null()))); + if (sql_set_variables(thd, &tmp_var_list)) /* this will create the variable */ + goto err; + if (!(var_entry= get_variable(&thd->user_vars, name, 0))) + goto err; } + /* + If this variable was already stored in user_var_events by this query + (because it's used in more than one place in the query), don't store + it. + */ + else if (var_entry->used_query_id == thd->query_id) + return; + + uint size; + /* + First we need to store value of var_entry, when the next situation + appers: + > set @a:=1; + > insert into t1 values (@a), (@a:=@a+1), (@a:=@a+1); + We have to write to binlog value @a= 1; + */ + size= ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)) + var_entry->length; + if (!(user_var_event= (BINLOG_USER_VAR_EVENT *) thd->alloc(size))) + goto err; + + user_var_event->value= (char*) user_var_event + + ALIGN_SIZE(sizeof(BINLOG_USER_VAR_EVENT)); + user_var_event->user_var_event= var_entry; + user_var_event->type= var_entry->type; + user_var_event->charset_number= var_entry->collation.collation->number; + if (!var_entry->value) + { + /* NULL value*/ + user_var_event->length= 0; + user_var_event->value= 0; + } + else + { + user_var_event->length= var_entry->length; + memcpy(user_var_event->value, var_entry->value, + var_entry->length); + } + /* Mark that this variable has been used by this query */ + var_entry->used_query_id= thd->query_id; + if (insert_dynamic(&thd->user_var_events, (gptr) &user_var_event)) + goto err; + return; err: diff --git a/sql/item_row.cc b/sql/item_row.cc index 43e38763aa6..fcc6e5192ec 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -49,7 +49,7 @@ void Item_row::illegal_method_call(const char *method) DBUG_ENTER("Item_row::illegal_method_call"); DBUG_PRINT("error", ("!!! %s method was called for row item", method)); DBUG_ASSERT(0); - my_error(ER_CARDINALITY_COL, MYF(0), 1); + my_error(ER_OPERAND_COLUMNS, MYF(0), 1); DBUG_VOID_RETURN; } @@ -112,7 +112,7 @@ bool Item_row::check_cols(uint c) { if (c != arg_count) { - my_error(ER_CARDINALITY_COL, MYF(0), c); + my_error(ER_OPERAND_COLUMNS, MYF(0), c); return 1; } return 0; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7c4fe8621a7..3daa7be6f43 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -105,7 +105,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref) // Is it one field subselect? if (engine->cols() > max_columns) { - my_error(ER_CARDINALITY_COL, MYF(0), 1); + my_error(ER_OPERAND_COLUMNS, MYF(0), 1); return 1; } fix_length_and_dec(); @@ -262,7 +262,7 @@ bool Item_singlerow_subselect::check_cols(uint c) { if (c != engine->cols()) { - my_error(ER_CARDINALITY_COL, MYF(0), c); + my_error(ER_OPERAND_COLUMNS, MYF(0), c); return 1; } return 0; @@ -527,7 +527,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, Item *item; if (select_lex->item_list.elements > 1) { - my_error(ER_CARDINALITY_COL, MYF(0), 1); + my_error(ER_OPERAND_COLUMNS, MYF(0), 1); DBUG_RETURN(RES_ERROR); } diff --git a/sql/item_sum.h b/sql/item_sum.h index 78d887782e2..c6fed46a338 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -387,7 +387,7 @@ class Item_sum_hybrid :public Item_sum Item_sum(thd, item), value(item.value), tmp_value(item.tmp_value), sum(item.sum), sum_int(item.sum_int), hybrid_type(item.hybrid_type), hybrid_field_type(item.hybrid_field_type),cmp_sign(item.cmp_sign), - used_table_cache(used_table_cache), cmp_charset(item.cmp_charset) {} + used_table_cache(item.used_table_cache), cmp_charset(item.cmp_charset) {} bool fix_fields(THD *, TABLE_LIST *, Item **); table_map used_tables() const { return used_table_cache; } bool const_item() const { return !used_table_cache; } diff --git a/sql/log_event.cc b/sql/log_event.cc index b6964c40422..b5fd78c06a9 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1086,6 +1086,23 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli) */ close_temporary_tables(thd); cleanup_load_tmpdir(); + /* + As a transaction NEVER spans on 2 or more binlogs: + if we have an active transaction at this point, the master died while + writing the transaction to the binary log, i.e. while flushing the binlog + cache to the binlog. As the write was started, the transaction had been + committed on the master, so we lack of information to replay this + transaction on the slave; all we can do is stop with error. + */ + if (thd->options & OPTION_BEGIN) + { + slave_print_error(rli, 0, + "there is an unfinished transaction in the relay log \ +(could find neither COMMIT nor ROLLBACK in the relay log); it could be that \ +the master died while writing the transaction to its binary log. Now the slave \ +is rolling back the transaction."); + return(1); + } break; /* @@ -1845,25 +1862,6 @@ int Rotate_log_event::write_data(IO_CACHE* file) We can't rotate the slave as this will cause infinitive rotations in a A -> B -> A setup. - NOTES - As a transaction NEVER spans on 2 or more binlogs: - if we have an active transaction at this point, the master died while - writing the transaction to the binary log, i.e. while flushing the binlog - cache to the binlog. As the write was started, the transaction had been - committed on the master, so we lack of information to replay this - transaction on the slave; all we can do is stop with error. - If we didn't detect it, then positions would start to become garbage (as we - are incrementing rli->relay_log_pos whereas we are in a transaction: the - new rli->relay_log_pos will be - relay_log_pos of the BEGIN + size of the Rotate event = garbage. - - Since MySQL 4.0.14, the master ALWAYS sends a Rotate event when it starts - sending the next binlog, so we are sure to receive a Rotate event just - after the end of the "dead master"'s binlog; so this exec_event() is the - right place to catch the problem. If we would wait until - Start_log_event::exec_event() it would be too late, rli->relay_log_pos - would already be garbage. - RETURN VALUES 0 ok */ @@ -1871,35 +1869,31 @@ int Rotate_log_event::write_data(IO_CACHE* file) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) int Rotate_log_event::exec_event(struct st_relay_log_info* rli) { - char* log_name = rli->group_master_log_name; DBUG_ENTER("Rotate_log_event::exec_event"); pthread_mutex_lock(&rli->data_lock); - - if (thd->options & OPTION_BEGIN) - { - slave_print_error(rli, 0, - opt_using_transactions ? - "\ -There is an unfinished transaction in the relay log (could find neither \ -COMMIT nor ROLLBACK in the relay log); It could be that the master died while \ -writing the transaction to its binary log. Now the slave is rolling back the \ -transaction." : - "\ -There is an unfinished transaction in the relay log (could find neither \ -COMMIT nor ROLLBACK in the relay log); It could be that the master died while \ -writing the transaction to its binary log."); - pthread_mutex_unlock(&rli->data_lock); - DBUG_RETURN(1); - } - - memcpy(log_name, new_log_ident, ident_len+1); - rli->notify_group_master_log_name_update(); - rli->group_master_log_pos = pos; rli->event_relay_log_pos += get_event_len(); - rli->group_relay_log_pos = rli->event_relay_log_pos; - DBUG_PRINT("info", ("group_master_log_pos: %lu", - (ulong) rli->group_master_log_pos)); + /* + If we are in a transaction: the only normal case is when the I/O thread was + copying a big transaction, then it was stopped and restarted: we have this + in the relay log: + BEGIN + ... + ROTATE (a fake one) + ... + COMMIT or ROLLBACK + In that case, we don't want to touch the coordinates which correspond to the + beginning of the transaction. + */ + if (!(thd->options & OPTION_BEGIN)) + { + memcpy(rli->group_master_log_name, new_log_ident, ident_len+1); + rli->notify_group_master_log_name_update(); + rli->group_master_log_pos = pos; + rli->group_relay_log_pos = rli->event_relay_log_pos; + DBUG_PRINT("info", ("group_master_log_pos: %lu", + (ulong) rli->group_master_log_pos)); + } pthread_mutex_unlock(&rli->data_lock); pthread_cond_broadcast(&rli->data_cond); flush_relay_log_info(rli); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 3d5ca148228..23ae551bde8 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -325,7 +325,9 @@ typedef compare_func_creator (*chooser_compare_func_creator)(bool invert); struct Query_cache_query_flags { unsigned int client_long_flag:1; - uint charset_num; + uint character_set_client_num; + uint character_set_results_num; + uint collation_connection_num; ha_rows limit; }; #define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index dc2405031fd..29d8b255251 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -252,8 +252,8 @@ character-set=latin2 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -265,8 +265,8 @@ character-set=latin2 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index e0b6abe8c94..d603555727b 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -246,8 +246,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -259,8 +259,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 0f16c7b1631..53a19464745 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -254,8 +254,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -267,8 +267,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index ad07fad58b2..c54f56b2529 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -243,8 +243,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -256,8 +256,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" -"The slave was already running" -"The slave was already stopped" +"Slave is already running" +"Slave has already been stopped" "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)" "Z_BUF_ERROR: Not enough memory available for zlib" "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index a1041b487f7..2997a4d4501 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -248,8 +248,8 @@ character-set=latin7 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -261,8 +261,8 @@ character-set=latin7 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 8e79d6f5067..cd346270ea8 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -243,8 +243,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -256,8 +256,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 20edc56f4c8..4fd38fdb6da 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -252,7 +252,7 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Falsche Foreign-Key Definition für '%-64s': %s", "Schlüssel- und Tabellenreferenz passen nicht zueinander.", -"Kardinalitäts-Fehler (mehr/oder weniger als %d Spalten).", +"Operand should contain %d column(s)", "Unterabfrage lieferte mehr als einen Datensatz zurück.", "Unbekannter prepared statement handler (%ld) für %s angegeben.", "Die Hilfedatenbank ist beschädigt oder existiert nicht.", @@ -265,8 +265,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 74c81bfb9a4..31259e9e02f 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -243,8 +243,8 @@ character-set=greek "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -256,8 +256,8 @@ character-set=greek "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 36b1027ee6e..52dfb702231 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -245,8 +245,8 @@ character-set=latin2 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -258,8 +258,8 @@ character-set=latin2 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index b9ad340f9f8..7efca542348 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -243,8 +243,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -256,8 +256,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 4a36dc7b54c..f7d6d7be29b 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -245,8 +245,8 @@ character-set=ujis "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -258,8 +258,8 @@ character-set=ujis "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index d6a2510ea09..654081c6895 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -243,8 +243,8 @@ character-set=euckr "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -256,8 +256,8 @@ character-set=euckr "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 1849e1e6595..76f725a9419 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -245,8 +245,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -258,8 +258,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 942ec7f3303..fe15f7c9b8b 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -245,8 +245,8 @@ character-set=latin1 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -258,8 +258,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 2db59ddae86..12e1d539e76 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -247,8 +247,8 @@ character-set=latin2 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -260,8 +260,8 @@ character-set=latin2 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index af4e210a5b7..49ca7ee5c56 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -244,7 +244,7 @@ character-set=latin1 "Slave SQL thread ignorado a consulta devido às normas de replicação-*-tabela" "Definição errada da chave estrangeira para '%-.64s': %s", "Referência da chave e referência da tabela não coincidem", -"Error de cardinalidade (mais/menos que %d colunas)", +"Operand should contain %d column(s)", "Subconsulta retorna mais que 1 registro", "Desconhecido manipulador de declaração preparado (%ld) determinado para %s", "Banco de dado de ajuda corrupto ou não existente", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 54f2b2db679..30e87fe3d0a 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -247,8 +247,8 @@ character-set=latin2 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -260,8 +260,8 @@ character-set=latin2 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index ea9b8265b77..b444348612f 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -245,7 +245,7 @@ character-set=koi8r "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"ïÛÉÂËÁ ÍÏÝØÎÏÓÔÉ ÍÎÏÖÅÓÔ×Á (ÂÏÌØÛÅ/ÍÅÎØÛÅ %d ËÏÌÏÎÏË)", +"ïÐÅÒÁÎÄ ÄÏÌÖÅÎ ÓÏÄÅÒÖÁÔØ %d ËÏÌÏÎÏË", "ðÏÄÚÁÐÒÏÓ ×ÏÚ×ÒÁÝÁÅÔ ÂÏÌÅÅ ÏÄÎÏÊ ÚÁÐÉÓÉ", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", @@ -258,8 +258,8 @@ character-set=koi8r "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index d57ef669050..32b94548bc5 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -238,8 +238,8 @@ character-set=cp1250 "User '%-.64s' has exceeded the '%s' resource (current value: %ld)", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -251,8 +251,8 @@ character-set=cp1250 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index f913ca3fbff..45e40caedee 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -251,8 +251,8 @@ character-set=latin2 "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -264,8 +264,8 @@ character-set=latin2 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index b69599cfa33..bce03456941 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -245,8 +245,8 @@ character-set=latin1 "Slave SQL thread ignorado el query debido a las reglas de replicación-*-tabla" "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (more/less than %d columns)", -"Subquery returns more than 1 record", +"Operand should contain %d column(s)", +"Subquery returns more than 1 row", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", "Cyclic reference on subqueries", @@ -258,8 +258,8 @@ character-set=latin1 "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index e0d0bea47d2..827419d76e7 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -243,7 +243,7 @@ character-set=latin1 "Slav SQL tråden ignorerade frågan pga en replicate-*-table regel", "Felaktig FOREIGN KEY-definition för '%-.64s': %s", "Nyckelreferensen och tabellreferensen stämmer inte överens", -"Kardinalitetsfel (fler/färre än %d kolumner)", +"Operand should contain %d column(s)", "Subquery returnerade mer än 1 rad", "Okänd PREPARED STATEMENT id (%ld) var given till %s", "Hjälpdatabasen finns inte eller är skadad", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 8bd060781bb..fcf0c695c29 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -248,7 +248,7 @@ character-set=koi8u "Slave SQL thread ignored the query because of replicate-*-table rules", "Wrong foreign key definition for '%-.64s': %s", "Key reference and table reference doesn't match", -"Cardinality error (Â¦ÌØÛÅ/ÍÅÎØÛÅ Î¦Ö %d ÓÔÏ×Âæ×)", +"ïÐÅÒÁÎÄ ÍÁ¤ ÓËÌÁÄÁÔÉÓÑ Ú %d ÓÔÏ×Âæ×", "ð¦ÄÚÁÐÉÔ ÐÏ×ÅÒÔÁ¤ Â¦ÌØÛ ÎiÖ 1 ÚÁÐÉÓ", "Unknown prepared statement handler (%ld) given to %s", "Help database is corrupt or does not exist", @@ -261,8 +261,8 @@ character-set=koi8u "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL", "COLLATION '%s' is not valid for CHARACTER SET '%s'", -"The slave was already running", -"The slave was already stopped", +"Slave is already running", +"Slave has already been stopped", "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)", "Z_BUF_ERROR: Not enough memory available for zlib", "Z_MEM_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)", diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 07df0f51600..069887e689e 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -770,7 +770,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) bzero(&flags, QUERY_CACHE_FLAGS_SIZE); flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ? 1 : 0); - flags.charset_num= thd->charset()->number; + flags.character_set_client_num= thd->variables.character_set_client->number; + flags.character_set_results_num= thd->variables.character_set_results->number; + flags.collation_connection_num= thd->variables.collation_connection->number; flags.limit= thd->variables.select_limit; STRUCT_LOCK(&structure_guard_mutex); @@ -950,7 +952,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) bzero(&flags, QUERY_CACHE_FLAGS_SIZE); flags.client_long_flag= (thd->client_capabilities & CLIENT_LONG_FLAG ? 1 : 0); - flags.charset_num= thd->charset()->number; + flags.character_set_client_num= thd->variables.character_set_client->number; + flags.character_set_results_num= thd->variables.character_set_results->number; + flags.collation_connection_num= thd->variables.collation_connection->number; flags.limit= thd->variables.select_limit; memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), &flags, QUERY_CACHE_FLAGS_SIZE); @@ -3105,7 +3109,7 @@ void Query_cache::queries_dump() str[len]= 0; // make zero ending DB name DBUG_PRINT("qcache", ("F:%u C:%u L:%lu (%u) '%s' '%s'", flags.client_long_flag, - flags.charset_num, (ulong)flags.limit, + flags.character_set_client_num, (ulong)flags.limit, len, str, strend(str)+1)); DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block, (ulong) block->next, (ulong) block->prev, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index de2da5a379b..968de304d67 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1023,7 +1023,7 @@ bool select_singlerow_subselect::send_data(List &items) Item_singlerow_subselect *it= (Item_singlerow_subselect *)item; if (it->assigned()) { - my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0)); + my_message(ER_SUBQUERY_NO_1_ROW, ER(ER_SUBQUERY_NO_1_ROW), MYF(0)); DBUG_RETURN(1); } if (unit->offset_limit_cnt) diff --git a/sql/sql_class.h b/sql/sql_class.h index da6aab8d266..3aa3932e98b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -430,6 +430,8 @@ public: unsigned long client_stmt_id; unsigned long client_param_count; struct st_mysql_bind *client_params; + char *extra_data; + ulong extra_length; #endif NET net; // client connection descriptor LEX lex; // parse tree descriptor diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 369f0411647..2c15362d9fa 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1473,12 +1473,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, error=TRUE; break; #endif -#ifndef EMBEDDED_LIBRARY case COM_STATISTICS: { mysql_log.write(thd,command,NullS); statistic_increment(com_stat[SQLCOM_SHOW_STATUS],&LOCK_status); +#ifndef EMBEDDED_LIBRARY char buff[200]; +#else + char *buff= thd->net.last_error; +#endif ulong uptime = (ulong) (thd->start_time - start_time); sprintf((char*) buff, "Uptime: %ld Threads: %d Questions: %lu Slow queries: %ld Opens: %ld Flush tables: %ld Open tables: %u Queries per second avg: %.3f", @@ -1491,12 +1494,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd, sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK", (sf_malloc_cur_memory+1023L)/1024L, (sf_malloc_max_memory+1023L)/1024L); - #endif +#endif +#ifndef EMBEDDED_LIBRARY VOID(my_net_write(net, buff,(uint) strlen(buff))); VOID(net_flush(net)); +#endif break; } -#endif case COM_PING: statistic_increment(com_other,&LOCK_status); send_ok(thd); // Tell client we are alive diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ff1a8f8f8e6..dd8d5613880 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -169,6 +169,7 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns __attribute__((unused)) thd->client_stmt_id= stmt->stmt_id; thd->client_param_count= stmt->param_count; + thd->net.last_errno= 0; return 0; } @@ -1087,16 +1088,17 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length) PREP_STMT *stmt; DBUG_ENTER("mysql_stmt_get_longdata"); +#ifndef EMBEDDED_LIBRARY /* The following should never happen */ if (packet_length < MYSQL_LONG_DATA_HEADER+1) { my_error(ER_WRONG_ARGUMENTS, MYF(0), "get_longdata"); DBUG_VOID_RETURN; } +#endif ulong stmt_id= uint4korr(pos); uint param_number= uint2korr(pos+4); - pos+= MYSQL_LONG_DATA_HEADER; // Point to data if (!(stmt=find_prepared_statement(thd, stmt_id, "get_longdata"))) { @@ -1108,6 +1110,7 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length) DBUG_VOID_RETURN; } +#ifndef EMBEDDED_LIBRARY if (param_number >= stmt->param_count) { /* Error will be sent in execute call */ @@ -1116,8 +1119,15 @@ void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length) sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS), "get_longdata"); DBUG_VOID_RETURN; } + pos+= MYSQL_LONG_DATA_HEADER; // Point to data +#endif + Item_param *param= *(stmt->param+param_number); +#ifndef EMBEDDED_LIBRARY param->set_longdata(pos, packet_length-MYSQL_LONG_DATA_HEADER-1); +#else + param->set_longdata(thd->extra_data, thd->extra_length); +#endif stmt->long_data_used= 1; DBUG_VOID_RETURN; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0205d69da00..cda22ae5337 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3060,6 +3060,13 @@ join_table: | '(' SELECT_SYM select_derived ')' opt_table_alias { LEX *lex=Lex; + if (lex->sql_command == SQLCOM_UPDATE && + &lex->select_lex == lex->current_select->outer_select()) + { + send_error(lex->thd, ER_SYNTAX_ERROR); + YYABORT; + } + SELECT_LEX_UNIT *unit= lex->current_select->master_unit(); lex->current_select= unit->outer_select(); if (!($$= lex->current_select->