mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
A fix and a test case for Bug#13488 "Left outer join query incorrectly
gives MYSQL_DATA_TRUNCATED"
This commit is contained in:
@ -558,6 +558,24 @@ int Materialized_cursor::open(JOIN *join __attribute__((unused)))
|
||||
result->prepare(item_list, &fake_unit) ||
|
||||
table->file->ha_rnd_init(TRUE));
|
||||
thd->restore_active_arena(this, &backup_arena);
|
||||
if (rc == 0)
|
||||
{
|
||||
/*
|
||||
Now send the result set metadata to the client. We need to do it
|
||||
here, as in Select_materialize::send_fields the exact column types
|
||||
are not yet known. The new types may differ from the original ones
|
||||
sent at prepare if some of them were altered by MySQL HEAP tables
|
||||
mechanism -- used when create_tmp_field_from_item may alter the
|
||||
original column type.
|
||||
|
||||
We can't simply supply SEND_EOF flag to send_fields, because
|
||||
send_fields doesn't flush the network buffer.
|
||||
*/
|
||||
rc= result->send_fields(item_list, Protocol::SEND_NUM_ROWS);
|
||||
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
||||
result->send_eof();
|
||||
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -647,14 +665,6 @@ bool Select_materialize::send_fields(List<Item> &list, uint flags)
|
||||
if (create_result_table(unit->thd, unit->get_unit_column_types(),
|
||||
FALSE, thd->options | TMP_TABLE_ALL_COLUMNS, ""))
|
||||
return TRUE;
|
||||
/*
|
||||
We can't simply supply SEND_EOF flag to send_fields, because send_fields
|
||||
doesn't flush the network buffer.
|
||||
*/
|
||||
rc= result->send_fields(list, Protocol::SEND_NUM_ROWS);
|
||||
thd->server_status|= SERVER_STATUS_CURSOR_EXISTS;
|
||||
result->send_eof();
|
||||
thd->server_status&= ~SERVER_STATUS_CURSOR_EXISTS;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user