[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql-internals
Subject: bk commit into 4.1 tree
From: sanja () mysql ! com
Date: 2002-11-30 22:11:23
[Download RAW message or body]
Below is the list of changes that have just been committed into a local
4.1 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.1407 02/12/01 00:11:22 bell@sanja.is.com.ua +7 -0
fix of error handling
sql/sql_update.cc
1.68 02/12/01 00:11:20 bell@sanja.is.com.ua +9 -6
fix of error handling
sql/sql_union.cc
1.50 02/12/01 00:11:20 bell@sanja.is.com.ua +1 -1
fix of error handling
sql/sql_parse.cc
1.268 02/12/01 00:11:20 bell@sanja.is.com.ua +12 -0
fix of error handling
sql/sql_insert.cc
1.76 02/12/01 00:11:20 bell@sanja.is.com.ua +7 -6
fix of error handling
sql/sql_delete.cc
1.92 02/12/01 00:11:20 bell@sanja.is.com.ua +5 -3
fix of error handling
mysql-test/t/subselect.test
1.33 02/12/01 00:11:20 bell@sanja.is.com.ua +20 -2
test of error handling with subselect
mysql-test/r/subselect.result
1.35 02/12/01 00:11:20 bell@sanja.is.com.ua +20 -2
test of error handling with subselect
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bell
# Host: sanja.is.com.ua
# Root: /home/bell/mysql/work-crash-4.1
--- 1.91/sql/sql_delete.cc Sat Nov 30 19:26:16 2002
+++ 1.92/sql/sql_delete.cc Sun Dec 1 00:11:20 2002
@@ -140,9 +140,11 @@
deleted=0L;
init_ftfuncs(thd, &thd->lex.select_lex, 1);
thd->proc_info="updating";
- while (!(error=info.read_record(&info)) && !thd->killed)
+ while (!(error=info.read_record(&info)) && !thd->killed &&
+ !thd->net.report_error)
{
- if (!(select && select->skipp_record()))
+ // thd->net.report_error is tested to disallow delete row on error
+ if (!(select && select->skipp_record())&& !thd->net.report_error )
{
if (!(error=table->file->delete_row(table->record[0])))
{
@@ -205,7 +207,7 @@
thd->lock=0;
}
delete select;
- if (error >= 0) // Fatal error
+ if (error >= 0 || thd->net.report_error)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0);
else
{
--- 1.75/sql/sql_insert.cc Sat Nov 30 19:26:16 2002
+++ 1.76/sql/sql_insert.cc Sun Dec 1 00:11:20 2002
@@ -235,9 +235,10 @@
if (fields.elements || !value_count)
{
restore_record(table,2); // Get empty record
- if (fill_record(fields,*values) || check_null_fields(thd,table))
+ if (fill_record(fields,*values)|| thd->net.report_error ||
+ check_null_fields(thd,table))
{
- if (values_list.elements != 1)
+ if (values_list.elements != 1 && !thd->net.report_error)
{
info.records++;
continue;
@@ -252,9 +253,9 @@
restore_record(table,2); // Get empty record
else
table->record[0][0]=table->record[2][0]; // Fix delete marker
- if (fill_record(table->field,*values))
+ if (fill_record(table->field,*values) || thd->net.report_error)
{
- if (values_list.elements != 1)
+ if (values_list.elements != 1 && ! thd->net.report_error)
{
info.records++;
continue;
@@ -1349,7 +1350,7 @@
fill_record(*fields,values);
else
fill_record(table->field,values);
- if (write_record(table,&info))
+ if (thd->net.report_error || write_record(table,&info))
return 1;
if (table->next_number_field) // Clear for next record
{
@@ -1463,7 +1464,7 @@
return 0;
}
fill_record(field,values);
- if (write_record(table,&info))
+ if (thd->net.report_error ||write_record(table,&info))
return 1;
if (table->next_number_field) // Clear for next record
{
--- 1.267/sql/sql_parse.cc Sat Nov 30 19:26:16 2002
+++ 1.268/sql/sql_parse.cc Sun Dec 1 00:11:20 2002
@@ -1900,6 +1900,8 @@
(ORDER *) select_lex->order_list.first,
select_lex->select_limit,
lex->duplicates);
+ if (thd->net.report_error)
+ res= -1;
break;
case SQLCOM_UPDATE_MULTI:
if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege))
@@ -1959,6 +1961,8 @@
SELECT_NO_JOIN_CACHE,
result, unit, select_lex, 0);
delete result;
+ if (thd->net.report_error)
+ res= -1;
}
else
res= -1; // Error is not sent
@@ -1976,6 +1980,8 @@
goto error;
res = mysql_insert(thd,tables,lex->field_list,lex->many_values,
lex->duplicates);
+ if (thd->net.report_error)
+ res= -1;
break;
}
case SQLCOM_REPLACE_SELECT:
@@ -2020,6 +2026,8 @@
if ((result=new select_insert(tables->table,&lex->field_list,
lex->duplicates)))
res=handle_select(thd,lex,result);
+ if (thd->net.report_error)
+ res= -1;
}
else
res= -1;
@@ -2050,6 +2058,8 @@
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, select_lex->options);
+ if (thd->net.report_error)
+ res= -1;
break;
}
case SQLCOM_DELETE_MULTI:
@@ -2122,6 +2132,8 @@
select_lex->options | thd->options |
SELECT_NO_JOIN_CACHE,
result, unit, select_lex, 0);
+ if (thd->net.report_error)
+ res= -1;
delete result;
}
else
--- 1.67/sql/sql_update.cc Sat Nov 30 19:26:16 2002
+++ 1.68/sql/sql_update.cc Sun Dec 1 00:11:20 2002
@@ -281,7 +281,7 @@
if (!(select && select->skipp_record()))
{
store_record(table,1);
- if (fill_record(fields,values))
+ if (fill_record(fields,values) || thd->net.report_error)
break; /* purecov: inspected */
found++;
if (compare_record(table, query_id))
@@ -605,7 +605,7 @@
// Only one table being updated receives a completely different treatment
table->status|= STATUS_UPDATED;
store_record(table,1);
- if (fill_record(fields,real_values))
+ if (fill_record(fields,real_values) || thd->net.report_error)
return 1;
found++;
if (/* compare_record(table, query_id) && */
@@ -644,7 +644,8 @@
{
table->status|= STATUS_UPDATED;
store_record(table,1);
- if (fill_record(*fields_by_tables[0],values_by_table))
+ if (fill_record(*fields_by_tables[0], values_by_table) ||
+ thd->net.report_error)
return 1;
found++;
if (/*compare_record(table, query_id) && */
@@ -667,8 +668,8 @@
table->file->ref_length,
system_charset_info));
fill_record(tmp_tables[secure_counter]->field,values_by_table);
- error= write_record(tmp_tables[secure_counter],
- &(infos[secure_counter]));
+ error= thd->net.report_error ||
+ write_record(tmp_tables[secure_counter], &(infos[secure_counter]));
if (error)
{
error=-1;
@@ -774,8 +775,10 @@
table->status|= STATUS_UPDATED;
store_record(table,1);
local_error= (fill_record(*fields_by_tables[counter + 1],list) ||
+ thd->net.report_error ||
/* compare_record(table, query_id) || */
- table->file->update_row(table->record[1],table->record[0]));
+ table->file->update_row(table->record[1],
+ table->record[0]));
if (local_error)
{
table->file->print_error(local_error,MYF(0));
--- 1.49/sql/sql_union.cc Thu Nov 28 19:29:19 2002
+++ 1.50/sql/sql_union.cc Sun Dec 1 00:11:20 2002
@@ -76,7 +76,7 @@
return 0;
}
fill_record(table->field,values);
- if ((write_record(table,&info)))
+ if (thd->net.report_error || write_record(table,&info))
{
if (thd->net.last_errno == ER_RECORD_FILE_FULL)
{
--- 1.34/mysql-test/r/subselect.result Sat Nov 30 19:26:16 2002
+++ 1.35/mysql-test/r/subselect.result Sun Dec 1 00:11:20 2002
@@ -413,6 +413,8 @@
2 12
update t1 set b= (select b from t1);
INSERT TABLE 't1' isn't allowed in FROM table list
+update t1 set b= (select b from t2);
+Subselect returns more than 1 record
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
a b
@@ -434,6 +436,8 @@
2 12
delete from t1 where b = (select b from t1);
INSERT TABLE 't1' isn't allowed in FROM table list
+delete from t1 where b = (select b from t2);
+Subselect returns more than 1 record
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
a b
@@ -459,6 +463,8 @@
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 \
where t11.a = t12.a); INSERT TABLE 't12' isn't allowed in FROM table list
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
+Subselect returns more than 1 record
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
@@ -471,9 +477,13 @@
drop table t11, t12, t2;
CREATE TABLE t1 (x int);
create table t2 (a int);
+create table t3 (a int);
insert into t2 values (1);
+insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
INSERT TABLE 't1' isn't allowed in FROM table list
+INSERT INTO t1 (x) VALUES ((SELECT a FROM t3));
+Subselect returns more than 1 record
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
@@ -501,14 +511,18 @@
3
3
0
-drop table t1, t2;
+drop table t1, t2, t3;
CREATE TABLE t1 (x int not null, y int, primary key (x));
create table t2 (a int);
+create table t3 (a int);
insert into t2 values (1);
+insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
INSERT TABLE 't1' isn't allowed in FROM table list
+replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
+Subselect returns more than 1 record
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
x y
@@ -533,7 +547,7 @@
1 3
4 2
2 1
-drop table t1, t2;
+drop table t1, t2, t3;
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT *);
No tables used
drop table if exists t;
@@ -575,4 +589,8 @@
id
1
2
+CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
+INSERT INTO t1 values (1),(1);
+UPDATE t SET id=(SELECT * FROM t1);
+Subselect returns more than 1 record
drop table t;
--- 1.32/mysql-test/t/subselect.test Sat Nov 30 19:26:16 2002
+++ 1.33/mysql-test/t/subselect.test Sun Dec 1 00:11:20 2002
@@ -247,6 +247,8 @@
select * from t1;
-- error 1093
update t1 set b= (select b from t1);
+-- error 1240
+update t1 set b= (select b from t2);
update t1 set b= (select b from t2 where t1.a = t2.a);
select * from t1;
drop table t1, t2;
@@ -260,6 +262,8 @@
select * from t1 where b = (select b from t2 where t1.a = t2.a);
-- error 1093
delete from t1 where b = (select b from t1);
+-- error 1240
+delete from t1 where b = (select b from t2);
delete from t1 where b = (select b from t2 where t1.a = t2.a);
select * from t1;
drop table t1, t2;
@@ -276,6 +280,8 @@
select * from t12;
-- error 1093
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 \
where t11.a = t12.a); +-- error 1240
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
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;
select * from t12;
@@ -284,9 +290,13 @@
#insert with subselects
CREATE TABLE t1 (x int);
create table t2 (a int);
+create table t3 (a int);
insert into t2 values (1);
+insert into t3 values (1),(2);
-- error 1093
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
+-- error 1240
+INSERT INTO t1 (x) VALUES ((SELECT a FROM t3));
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
insert into t2 values (1);
@@ -300,15 +310,19 @@
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
-- sleep 1
select * from t1;
-drop table t1, t2;
+drop table t1, t2, t3;
#replace with subselects
CREATE TABLE t1 (x int not null, y int, primary key (x));
create table t2 (a int);
+create table t3 (a int);
insert into t2 values (1);
+insert into t3 values (1),(2);
select * from t1;
-- error 1093
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
+-- error 1240
+replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
select * from t1;
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
@@ -321,7 +335,7 @@
select * from t1;
replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM \
t2)); select * from t1;
-drop table t1, t2;
+drop table t1, t2, t3;
-- error 1096
SELECT * FROM (SELECT 1) WHERE 1 IN (SELECT *);
@@ -339,4 +353,8 @@
-- error 1093
INSERT INTO t VALUES ((SELECT * FROM t));
SELECT * FROM t;
+CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1;
+INSERT INTO t1 values (1),(1);
+-- error 1240
+UPDATE t SET id=(SELECT * FROM t1);
drop table t;
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail internals-thread5859@lists.mysql.com
To unsubscribe, e-mail <internals-unsubscribe@lists.mysql.com>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic