1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-11 05:52:26 +03:00

Backport of fix to bug #33629 into mysql-next-mr-bugfixing.

Bug #33629: last_day function can return null, but has 'not null' flag set for result

LAST_DAY and MAKEDATE functions are documented as
returning NULL value, but actually they was implemented
as returning NOT NULL typed values.

That caused a confusing error "ERROR 1048 (23000): Column
'...' cannot be null" on queries like: 

  SELECT 1 FROM (SELECT LAST_DAY('0')) a;
This commit is contained in:
Gleb Shchepa
2009-10-13 21:50:08 +05:00
parent 9824a0ca27
commit bc7c439e6b
5 changed files with 48 additions and 2 deletions

View File

@@ -871,6 +871,7 @@ public:
{
decimals=0;
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
maybe_null= 1;
}
longlong val_int();
};
@@ -1025,4 +1026,9 @@ public:
Item_func_last_day(Item *a) :Item_date(a) {}
const char *func_name() const { return "last_day"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
void fix_length_and_dec()
{
Item_date::fix_length_and_dec();
maybe_null= 1;
}
};