diff options
author | unknown <evgen@moonbone.local> | 2006-08-21 00:23:57 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2006-08-21 00:23:57 +0400 |
commit | 7a11df8c933581a88ffb3c807db8147fc520ffc2 (patch) | |
tree | dbfb257fc0de2b3b7786a5892135855658c58874 /sql/item.h | |
parent | 1cbebc6e18e22d10b4be12634f5c6d2ed72cffca (diff) | |
download | mariadb-git-7a11df8c933581a88ffb3c807db8147fc520ffc2.tar.gz |
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
A date can be represented as an int (like 20060101) and as a string (like
"2006.01.01"). When a DATE/TIME field is compared in one SELECT against both
representations the constant propagation mechanism leads to comparison
of DATE as a string and DATE as an int. In this example it compares 2006 and
20060101 integers. Obviously it fails comparison although they represents the
same date.
Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
context for items being compared. I.e. if items compared as strings the
comparison context is STRING.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The context check is done in the
Item_field::equal_fields_propagator() and in the change_cond_ref_to_const()
functions.
Also the better fix for bug 21159 is introduced.
mysql-test/t/type_datetime.test:
Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
mysql-test/r/type_datetime.result:
Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
sql/sql_select.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The check is done in the change_cond_ref_to_const() function.
sql/item_cmpfunc.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
context for items being compared.
sql/item.h:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
To the Item class a new field called cmp_context is added.
It represents the comparison context of an item.
sql/item.cc:
Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The context check is done in the
Item_field::equal_fields_propagator() function.
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h index 514c31c2d74..e3df0fdf389 100644 --- a/sql/item.h +++ b/sql/item.h @@ -465,7 +465,7 @@ public: my_bool with_subselect; /* If this item is a subselect or some of its arguments is or contains a subselect */ - + Item_result cmp_context; /* Comparison context */ // alloc & destruct is done as start of select using sql_alloc Item(); /* |