mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for BUG#9103:
Don't produce data truncation warnings from within cp_buffer_from_ref(). This function is only used to make index search tuples and data truncation that occurs here has no relation with truncated values being saved into tables.
This commit is contained in:
@ -6185,7 +6185,7 @@ join_read_const(JOIN_TAB *tab)
|
||||
TABLE *table= tab->table;
|
||||
if (table->status & STATUS_GARBAGE) // If first read
|
||||
{
|
||||
if (cp_buffer_from_ref(&tab->ref))
|
||||
if (cp_buffer_from_ref(tab->join->thd, &tab->ref))
|
||||
error=HA_ERR_KEY_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
@ -6248,7 +6248,7 @@ join_read_always_key(JOIN_TAB *tab)
|
||||
|
||||
if (!table->file->inited)
|
||||
table->file->ha_index_init(tab->ref.key);
|
||||
if (cp_buffer_from_ref(&tab->ref))
|
||||
if (cp_buffer_from_ref(tab->join->thd, &tab->ref))
|
||||
return -1;
|
||||
if ((error=table->file->index_read(table->record[0],
|
||||
tab->ref.key_buff,
|
||||
@ -6275,7 +6275,7 @@ join_read_last_key(JOIN_TAB *tab)
|
||||
|
||||
if (!table->file->inited)
|
||||
table->file->ha_index_init(tab->ref.key);
|
||||
if (cp_buffer_from_ref(&tab->ref))
|
||||
if (cp_buffer_from_ref(tab->join->thd, &tab->ref))
|
||||
return -1;
|
||||
if ((error=table->file->index_read_last(table->record[0],
|
||||
tab->ref.key_buff,
|
||||
@ -6449,7 +6449,7 @@ join_ft_read_first(JOIN_TAB *tab)
|
||||
if (!table->file->inited)
|
||||
table->file->ha_index_init(tab->ref.key);
|
||||
#if NOT_USED_YET
|
||||
if (cp_buffer_from_ref(&tab->ref)) // as ft-key doesn't use store_key's
|
||||
if (cp_buffer_from_ref(tab->join->thd, &tab->ref)) // as ft-key doesn't use store_key's
|
||||
return -1; // see also FT_SELECT::init()
|
||||
#endif
|
||||
table->file->ft_init();
|
||||
@ -8168,7 +8168,8 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
|
||||
{
|
||||
memcpy(tab->ref.key_buff2, tab->ref.key_buff, tab->ref.key_length);
|
||||
}
|
||||
if ((tab->ref.key_err=cp_buffer_from_ref(&tab->ref)) || diff)
|
||||
if ((tab->ref.key_err= cp_buffer_from_ref(tab->join->thd, &tab->ref)) ||
|
||||
diff)
|
||||
return 1;
|
||||
return memcmp(tab->ref.key_buff2, tab->ref.key_buff, tab->ref.key_length)
|
||||
!= 0;
|
||||
@ -8176,11 +8177,17 @@ cmp_buffer_with_ref(JOIN_TAB *tab)
|
||||
|
||||
|
||||
bool
|
||||
cp_buffer_from_ref(TABLE_REF *ref)
|
||||
cp_buffer_from_ref(THD *thd, TABLE_REF *ref)
|
||||
{
|
||||
enum enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
|
||||
for (store_key **copy=ref->key_copy ; *copy ; copy++)
|
||||
if ((*copy)->copy())
|
||||
{
|
||||
thd->count_cuted_fields= save_count_cuted_fields;
|
||||
return 1; // Something went wrong
|
||||
}
|
||||
thd->count_cuted_fields= save_count_cuted_fields;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user