mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-17607 DATE(COALESCE(year_column)) returns a wrong result
C++ does not guarantee the order of parameter evaluation. It was wrong to pass item->val_int() and item->null_value at the same time to any function or constructor. Adding a new helper class Longlong_null, and new methods Item::to_longlong_null() and Item_func_hybrid_field_type::to_longlong_null_op(), which make sure to properly call val_int()/int_op() and test null_value. Reorganizing the rest of the code accordingly.
This commit is contained in:
@ -412,16 +412,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Year_null: public Year
|
||||
class Year_null: public Year, public Null_flag
|
||||
{
|
||||
protected:
|
||||
bool m_is_null;
|
||||
public:
|
||||
Year_null(const Year &other, bool is_null)
|
||||
:Year(is_null ? Year() : other),
|
||||
m_is_null(is_null)
|
||||
Year_null(const Longlong_null &nr, bool unsigned_flag, uint length)
|
||||
:Year(nr.is_null() ? 0 : nr.value(), unsigned_flag, length),
|
||||
Null_flag(nr.is_null())
|
||||
{ }
|
||||
bool is_null() const { return m_is_null; }
|
||||
bool to_mysql_time_with_warn(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate,
|
||||
const char *field_name) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user