Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1962 05/06/18 23:50:50 evgen@stripped +4 -0
Fix bug#11298 insert into select from VIEW produces incorrect result
when using ORDER BY
Insert were inserting data from last record fetched instead of inserting from
temporary table.
Force Item_ref to save data from result_field if it's available rather then
from *ref on save_in_field() call.
mysql-test/t/view.test
1.71 05/06/18 22:56:20 evgen@stripped +13 -1
Test case for bug#11298 insert into select from VIEW produces incorrect result when
using ORDER BY
mysql-test/r/view.result
1.82 05/06/18 22:55:30 evgen@stripped +14 -0
Test case for bug#11298 insert into select from VIEW produces incorrect result when
using ORDER BY
sql/item.cc
1.137 05/06/18 22:55:04 evgen@stripped +19 -0
Fix bug#11298 insert into select from VIEW produces incorrect result when using ORDER
BY
sql/item.h
1.139 05/06/18 22:54:27 evgen@stripped +1 -2
Fix bug#11298 insert into select from VIEW produces incorrect result when using ORDER
BY.
# 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: evgen
# Host: moonbone.local
# Root: /work/mysql-5.0-bug-11298
--- 1.136/sql/item.cc 2005-06-15 17:58:52 +04:00
+++ 1.137/sql/item.cc 2005-06-18 22:55:04 +04:00
@@ -4360,6 +4360,25 @@
return val;
}
+int Item_ref::save_in_field(Field *to, bool no_conversions)
+{
+ if(result_field){
+ if (result_field->is_null())
+ {
+ null_value=1;
+ return set_field_to_null_with_conversions(to, no_conversions);
+ }
+ else
+ {
+ to->set_notnull();
+ field_conv(to,result_field);
+ null_value=0;
+ }
+ return 0;
+ }
+ return (*ref)->save_in_field(to, no_conversions);
+}
+
void Item_ref_null_helper::print(String *str)
{
--- 1.138/sql/item.h 2005-06-15 17:58:54 +04:00
+++ 1.139/sql/item.h 2005-06-18 22:54:27 +04:00
@@ -1335,8 +1335,7 @@
bool send(Protocol *prot, String *tmp);
void make_field(Send_field *field) { (*ref)->make_field(field); }
bool fix_fields(THD *, struct st_table_list *, Item **);
- int save_in_field(Field *field, bool no_conversions)
- { return (*ref)->save_in_field(field, no_conversions); }
+ int save_in_field(Field *field, bool no_conversions);
void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
enum Item_result result_type () const { return (*ref)->result_type(); }
enum_field_types field_type() const { return (*ref)->field_type(); }
--- 1.81/mysql-test/r/view.result 2005-05-17 19:05:06 +04:00
+++ 1.82/mysql-test/r/view.result 2005-06-18 22:55:30 +04:00
@@ -1726,3 +1726,17 @@
drop procedure p1;
drop view v1;
drop table t1;
+create table t1(f1 int);
+create table t2(f2 int);
+insert into t1 values(1),(2),(3);
+insert into t2 values(1),(2),(3);
+create view v1 as select * from t1,t2 where f1=f2;
+create table t3 (f1 int, f2 int);
+insert into t3 select * from v1 order by 1;
+select * from t3;
+f1 f2
+1 1
+2 2
+3 3
+drop view v1;
+drop table t1,t2,t3;
--- 1.70/mysql-test/t/view.test 2005-05-17 19:05:06 +04:00
+++ 1.71/mysql-test/t/view.test 2005-06-18 22:56:20 +04:00
@@ -1568,4 +1568,16 @@
drop procedure p1;
drop view v1;
drop table t1;
-
+#
+# Bug#11298 insert into select from VIEW produces incorrect result when
+# using ORDER BY
+create table t1(f1 int);
+create table t2(f2 int);
+insert into t1 values(1),(2),(3);
+insert into t2 values(1),(2),(3);
+create view v1 as select * from t1,t2 where f1=f2;
+create table t3 (f1 int, f2 int);
+insert into t3 select * from v1 order by 1;
+select * from t3;
+drop view v1;
+drop table t1,t2,t3;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1962) BUG#11298 | eugene | 18 Jun |