diff options
author | unknown <kostja@vajra.(none)> | 2007-05-18 12:29:06 +0400 |
---|---|---|
committer | unknown <kostja@vajra.(none)> | 2007-05-18 12:29:06 +0400 |
commit | fda27597eef5315ae0334ce6354d0dfe807e6672 (patch) | |
tree | c98b620d9518b959ae0997686036e4e312f990b1 /sql/sql_base.cc | |
parent | 7c70011e2165c45aa88660cb24b2b52cf67272de (diff) | |
download | mariadb-git-fda27597eef5315ae0334ce6354d0dfe807e6672.tar.gz |
Bug #27907 "Misleading error message when opening/locking tables"
Adjust the check that defines the error message to be returned.
mysql-test/r/sp-error.result:
Update results (more accurate error code)
mysql-test/r/sp-prelocking.result:
Update results (more accurate error code)
mysql-test/r/trigger.result:
Update results (more accurate error code)
mysql-test/t/sp-error.test:
ER_NOT_LOCKED -> ER_NO_SUCH_TABLE
mysql-test/t/sp-prelocking.test:
Add a test case for Bug#27907
mysql-test/t/trigger.test:
ER_NOT_LOCKED -> ER_NO_SUCH_TABLE
sql/sql_base.cc:
Adjust the check for where-we-are for a better error message.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ed48ca577fb..4f70d115e76 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1669,10 +1669,17 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, VOID(pthread_mutex_unlock(&LOCK_open)); } } - if ((thd->locked_tables) && (thd->locked_tables->lock_count > 0)) - my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias); - else + /* + No table in the locked tables list. In case of explicit LOCK TABLES + this can happen if a user did not include the able into the list. + In case of pre-locked mode locked tables list is generated automatically, + so we may only end up here if the table did not exist when + locked tables list was created. + */ + if (thd->prelocked_mode == PRELOCKED) my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias); + else + my_error(ER_TABLE_NOT_LOCKED, MYF(0), alias); DBUG_RETURN(0); } |