diff options
author | unknown <bell@sanja.is.com.ua> | 2004-06-10 21:33:15 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-06-10 21:33:15 +0300 |
commit | d9b81f3a084c362d9948504b59149bade9eb4229 (patch) | |
tree | f035e112c3312d9754f9971c9d02ca260d43d40e /sql/sql_base.cc | |
parent | f9ec1ff25a7c645b21973a347126503e4247e020 (diff) | |
download | mariadb-git-d9b81f3a084c362d9948504b59149bade9eb4229.tar.gz |
EXISTS(SELECT * ...)
close table before opening in optimize
mysql-test/r/subselect.result:
test of EXISTS(SELECT * ...)
mysql-test/t/subselect.test:
test of EXISTS(SELECT * ...)
sql/sql_base.cc:
EXISTS(SELECT * ...)
sql/sql_table.cc:
close table before opening one
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index e3fbfb2d0e3..889c95125c5 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -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); |