summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2004-09-25 15:07:50 +0300
committerbell@sanja.is.com.ua <>2004-09-25 15:07:50 +0300
commitf3e6405ff18bc045ab0963e9c6b0dd09769eda66 (patch)
tree6bd4bba629b8b0435aa6a79d0bd511568abfef60 /sql/item.cc
parentf11bcefae18a93cabf4c23e3939731cf86ba9b15 (diff)
downloadmariadb-git-f3e6405ff18bc045ab0963e9c6b0dd09769eda66.tar.gz
postreview fixes (BUG#5618 & BUG#5590)
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc35
1 files changed, 12 insertions, 23 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 457360e63d3..ea095df3aaa 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2517,38 +2517,29 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
if (field_example && item->type() == Item::FIELD_ITEM)
{
Field *field= ((Item_field *)item)->field;
- Field::field_cast_enum field_type= field->field_cast_type();
-
- if (field_type != Field::FIELD_CAST_ENUM &&
- field_type != Field::FIELD_CAST_SET)
+ /* Can old example field store new data? */
+ if ((change_field=
+ !field->field_cast_compatible(field_example->field_cast_type())))
{
- if (field_example->field_cast_type() != field_type)
- {
- if (!(change_field=
- field_example->field_cast_compatible(field->field_cast_type())))
- {
- /*
- if old field can't store value of 'worse' new field we will make
- decision about result field type based only on Item result type
- */
- if (!field->field_cast_compatible(field_example->field_cast_type()))
- skip_store_field= 1;
- }
- }
+ /*
+ if old field can't store value of 'worse' new field we will make
+ decision about result field type based only on Item result type
+ */
+ if (!field_example->field_cast_compatible(field->field_cast_type()))
+ skip_store_field= 1;
}
- else
- skip_store_field= 1;
}
else if (field_example || item->type() == Item::FIELD_ITEM)
+ {
+ /* expression can't be mixed with field */
skip_store_field= 1;
+ }
// size/type should be changed
if (change_field ||
skip_store_field ||
(new_type != item_type) ||
(max_length < new_length) ||
- ((new_type == INT_RESULT) &&
- (decimals < item->decimals)) ||
(!maybe_null && item->maybe_null) ||
(item_type == STRING_RESULT && new_type == STRING_RESULT &&
!my_charset_same(collation.collation, item->collation.collation)))
@@ -2556,8 +2547,6 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
// new field has some parameters worse then current
skip_store_field|= (change_field &&
(max_length > new_length) ||
- ((new_type == INT_RESULT) &&
- (decimals > item->decimals)) ||
(maybe_null && !item->maybe_null) ||
(item_type == STRING_RESULT &&
new_type == STRING_RESULT &&