1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

EXISTS(SELECT * ...)

close table before opening in optimize
This commit is contained in:
bell@sanja.is.com.ua
2004-06-10 21:33:15 +03:00
parent 5f235eb828
commit be642b9bcd
4 changed files with 39 additions and 4 deletions

View File

@ -2184,8 +2184,19 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
!((Item_field*) item)->field)
{
uint elem= fields.elements;
if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name, &it))
Item_subselect *subsel= thd->lex->current_select->master_unit()->item;
if (subsel &&
subsel->substype() == Item_subselect::EXISTS_SUBS)
{
/*
It is EXISTS(SELECT * ...) and we can replace * by any constant.
Item_int do not need fix_fields() because it is basic constant.
*/
it.replace(new Item_int("Not_used", (longlong) 1, 21));
}
else if (insert_fields(thd,tables,((Item_field*) item)->db_name,
((Item_field*) item)->table_name, &it))
{
if (stmt)
thd->restore_backup_item_arena(stmt, &backup);