The crash mentioned in original bug report is already prevented by one
of previous patches (fix for bug #13343 "CREATE|etc TRIGGER|VIEW|USER
don't commit the transaction (inconsistency)"), this patch only improve
error returning.
Version for 5.0.
It fixes three problems:
1. The cause of the bug was that we did not check the table version for
the HANDLER ... READ commands. We did not notice when a table was
replaced by a new one. This can happen during ALTER TABLE, REPAIR
TABLE, and OPTIMIZE TABLE (there might be more cases). I call the fix
for this problem "the primary bug fix".
2. mysql_ha_flush() was not always called with a locked LOCK_open.
Though the function comment clearly said it must.
I changed the code so that the locking is done when required. I call
the fix for this problem "the secondary fix".
3. In 5.0 (not in 4.1 or 4.0) DROP TABLE had a possible deadlock flaw in
concur with FLUSH TABLES WITH READ LOCK. I call the fix for this
problem "the 5.0 addendum fix".
test_if_order_by_key() expected only Item_fields to be in order->item, thus
failing to find available index on view's field, which results in reported
error.
Now test_if_order_by_key() calls order->item->real_item() to get field for
choosing index.
my_sopen() on win32 which allows to use FILE_SHARE_DELETE flag to
allow deleting opened files. my_sopen() implementation is added to
support this functionality.
we changing current db temporarily and restore it when sp is created. however thd->db
in this case becomes empty string rather than NULL and so all checks of thd->db == NULL
will be false. So if after this we'll issue create procedure sp2()... without specifying
db it will succeed and create sp with db=NULL, which causes mysqldto crash on
show procedure status statement.
This patch fixes the problem.
it is added a check of not being empty value. When modifying SP with Admin
application on win32 it does not pass curent database so sp is stored with
db=null which causes a crash later on show procedure status;
in the function body
Changed the way the end of query was found from the lex state.
The routine body was not extracted correctly when using the
/*!version ... */ wrapper (in dump files); for some types of routines
(e.g. with a label at the first begin), the trailing "*/" was not skipped.
the same column as an aliased and as a non-aliased column.
The problem was that Item_direct_view_ref::eq() was first comparing view columns
by name, and in this case the name of one of them is different since it is aliased.