diff options
author | unknown <evgen@moonbone.local> | 2005-06-22 04:45:10 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-06-22 04:45:10 +0400 |
commit | 401fa3cb4b47e2eee663058905a4430104c9b75f (patch) | |
tree | 8250cd82d602c34a867dd2c7154f4429f3aa4f29 /sql/item.cc | |
parent | 04f6f63dd8bdcb4e0d5e7cc6b2200a87eff037fe (diff) | |
download | mariadb-git-401fa3cb4b47e2eee663058905a4430104c9b75f.tar.gz |
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.
Make Item_ref to save data from result_field if it's available rather then
from *ref on save_in_field() call.
sql/item.h:
Fix bug#11298 insert into select from VIEW produces incorrect result when using ORDER BY
sql/item.cc:
Fix bug#11298 insert into select from VIEW produces incorrect result when using ORDER BY
mysql-test/r/view.result:
Test case for bug#11298 insert into select from VIEW produces incorrect result when using ORDER BY
mysql-test/t/view.test:
Test case for bug#11298 insert into select from VIEW produces incorrect result when using ORDER BY
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 8a7d00e2841..20e411afceb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4360,6 +4360,28 @@ my_decimal *Item_ref::val_decimal(my_decimal *decimal_value) return val; } +int Item_ref::save_in_field(Field *to, bool no_conversions) +{ + int res; + 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; + } + res= (*ref)->save_in_field(to, no_conversions); + null_value= (*ref)->null_value; + return res; +} + void Item_ref_null_helper::print(String *str) { |