summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorgkodinov/kgeorge@macbook.gmz <>2006-07-25 18:42:49 +0300
committergkodinov/kgeorge@macbook.gmz <>2006-07-25 18:42:49 +0300
commitf5b0dd6a002846a5c3d3bdc1651e51aad1ce2ddc (patch)
tree53a892a7220b9a860eccf699b7f47e576276c1d6 /sql/sql_base.cc
parent9e9fb3e4e494bad69ce0ce668645e08d224809ee (diff)
downloadmariadb-git-f5b0dd6a002846a5c3d3bdc1651e51aad1ce2ddc.tar.gz
Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called
When executing INSERT over a view with calculated columns it was assuming all elements of the fields collection are actually Item_field instances. This may not be true when inserting into a view and that view has columns that are such expressions that allow updating (like setting a collation for example). Corrected to access field information through the filed_for_view_update() function and retrieve correctly the field info even for "update-friendly" non-Item_field items.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 7f9076bb46e..28edee5c729 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4959,12 +4959,17 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
bool ignore_errors)
{
List_iterator_fast<Item> f(fields),v(values);
- Item *value;
+ Item *value, *fld;
Item_field *field;
DBUG_ENTER("fill_record");
- while ((field=(Item_field*) f++))
+ while ((fld= f++))
{
+ if (!(field= fld->filed_for_view_update()))
+ {
+ my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name);
+ DBUG_RETURN(TRUE);
+ }
value=v++;
Field *rfield= field->field;
TABLE *table= rfield->table;