1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug #31928: Search fails on '1000-00-00' date after sql_mode change

When constructing a key image stricter date checking (from sql_mode)
should not be enabled, because it will reject invalid dates that the
server would otherwise accept for searching when there's no index.
 
Fixed by disabling strict date checking when constructing a key image.


mysql-test/r/type_date.result:
  Bug #31928: test case
mysql-test/t/type_date.test:
  Bug #31928: test case
sql/sql_select.h:
  Bug #31928: Disable strict date checking when consructing
  a key image
This commit is contained in:
unknown
2007-11-07 18:02:12 +02:00
parent 2a0f4e4faf
commit 36d1659a80
3 changed files with 65 additions and 5 deletions

View File

@@ -548,14 +548,17 @@ public:
enum store_key_result copy()
{
enum store_key_result result;
enum_check_fields saved_count_cuted_fields=
to_field->table->in_use->count_cuted_fields;
THD *thd= to_field->table->in_use;
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
ulong sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
to_field->table->in_use->count_cuted_fields= CHECK_FIELD_IGNORE;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
result= copy_inner();
to_field->table->in_use->count_cuted_fields= saved_count_cuted_fields;
thd->count_cuted_fields= saved_count_cuted_fields;
thd->variables.sql_mode= sql_mode;
return result;
}