summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-11-24 11:31:36 +0300
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2009-11-24 11:31:36 +0300
commitadb89e98aaa8b00b3efb7a56aebdaf12c5e75ee4 (patch)
treec7017f926485e3c5647276d684f4adc4847f9faf /sql/sql_insert.cc
parentbc014badaf78cd057018a7db6a9857b584b932b3 (diff)
parentfad34c34cf22eb1c503204aee204dfb83ad7acea (diff)
downloadmariadb-git-adb89e98aaa8b00b3efb7a56aebdaf12c5e75ee4.tar.gz
Manual merge from the mysql-5.1-bugteam.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index a4785418d4c..6281dd8168a 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -500,6 +500,22 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list)
DBUG_ENTER("open_and_lock_for_insert_delayed");
#ifndef EMBEDDED_LIBRARY
+ if (thd->locked_tables && thd->global_read_lock)
+ {
+ /*
+ If this connection has the global read lock, the handler thread
+ will not be able to lock the table. It will wait for the global
+ read lock to go away, but this will never happen since the
+ connection thread will be stuck waiting for the handler thread
+ to open and lock the table.
+ If we are not in locked tables mode, INSERT will seek protection
+ against the global read lock (and fail), thus we will only get
+ to this point in locked tables mode.
+ */
+ my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
if (delayed_get_table(thd, table_list))
DBUG_RETURN(TRUE);