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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user