MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
  • MariaDB\ 71.8%
  • C++ 16.4%
  • C 10.4%
  • Shell 0.5%
  • Perl 0.4%
  • Other 0.3%
Find a file
unknown 4f15a043e2 Fix for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which explicitly
or implicitly uses stored function gives "Table not locked" error'

CREATE TABLE ... SELECT ... statement which was explicitly or implicitly
(through view) using stored function gave "Table not locked" error.

The actual bug resides in the current locking scheme of CREATE TABLE SELECT
code, which first opens and locks tables of the SELECT statement itself,
and then, having SELECT tables locked, creates the .FRM, opens the .FRM and
acquires lock on it. This scheme opens a possibility for a deadlock, which
was present and ignored since version 3.23 or earlier. This scheme also
conflicts with the invariant of the prelocking algorithm -- no table can
be open and locked while there are tables locked in prelocked mode.

The patch makes an exception for this invariant when doing CREATE TABLE ...
SELECT, thus extending the possibility of a deadlock to the prelocked mode.
We can't supply a better fix in 5.0.


mysql-test/r/sp.result:
  Added tests for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which
  explicitly or implicitly uses stored function gives "Table not locked" error'
mysql-test/t/sp.test:
  Added tests for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which
  explicitly or implicitly uses stored function gives "Table not locked" error'
sql/mysql_priv.h:
  Added flag which can be passed to open_table() routine in order to ignore
  set of locked tables and prelocked mode.
  We don't need declaration of create_table_from_items() any longer as it was
  moved into sql_insert.cc and made static.
sql/sql_base.cc:
  open_table():
    Added flag which allows open table ignoring set of locked tables and
    prelocked mode.
sql/sql_insert.cc:
  Moved create_table_from_items() from sql_table.cc to sql_insert.cc as it was
  not used outside of sql_insert.cc and contains code which is specific for
  CREATE TABLE ... SELECT.
  Also now when we are executing CREATE TABLE ... SELECT ... statement which
  SELECT part requires execution in prelocked mode we ignore set of locked
  tables in order to get access to the table we just have created.
  We probably don't want to do this if we are under real LOCK TABLES since
  it will widen window for deadlock too much.
sql/sql_table.cc:
  Moved create_table_from_items() routine into sql_insert.cc, since it was not
  used anywhere outside of this file and contains logic which is specific for
  CREATE TABLE ... SELECT statement.
2006-05-09 16:39:11 +04:00
bdb BUG#15734: Fix undefined awk behaviour breaking compilation on Debian. 2005-12-14 13:09:37 +01:00
BitKeeper Merge mysql.com:/space/my/mysql-4.1 2005-12-07 10:40:26 +01:00
BUILD Use yaSSL as default for BUILD/* scripts 2006-03-21 11:21:52 +01:00
client Fix for bug #16855 2006-03-27 17:45:06 -08:00
cmd-line-utils Merge neptunus.(none):/home/msvensson/mysql/bug16557/my50-bug16557 2006-02-21 08:58:19 +01:00
config/ac-macros yassl link problem fixed 2006-04-03 12:07:18 +02:00
dbug Several fixes revelaled by Intel compiler. 2005-09-23 16:47:08 +03:00
Docs Merge 2006-04-03 03:52:22 +02:00
extra Bug #17235 perror prints wrong prefix for ndb error codes 2006-02-08 17:17:27 +01:00
heap Merge mysql.com:/opt/local/work/mysql-4.1-root 2006-02-02 18:17:18 +03:00
include Merge monty@bk-internal.mysql.com:/home/bk/mysql-5.0 2006-03-27 12:07:59 +03:00
innobase Applied innodb-5.0-ss398 snapshot. 2006-04-01 01:54:15 +04:00
libmysql yassl link problem fixed 2006-04-03 12:07:18 +02:00
libmysql_r yassl link problem fixed 2006-04-03 12:07:18 +02:00
libmysqld compilation fixes 2006-03-06 22:08:29 +01:00
man - Removed obsolete and outdated man page files from the man 2005-10-27 14:51:58 +02:00
myisam Manual merge 2006-03-30 17:14:55 +04:00
myisammrg BUG#17314: Can't use index_merge/intersection for MERGE tables 2006-02-11 21:51:43 +03:00
mysql-test Fix for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which explicitly 2006-05-09 16:39:11 +04:00
mysys Merge mysql.com:/home/mydev/mysql-5.0 2006-03-03 16:29:42 +01:00
ndb Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0 2006-04-04 11:50:54 +02:00
netware .libs is no longer used when compiling netware 2006-04-03 11:54:09 -04:00
os2 Merge 2005-09-29 03:20:31 +02:00
pstack Makefile.am, configure.in: 2005-09-24 15:51:45 +02:00
regex Merge 2005-09-29 03:20:31 +02:00
scripts Merge 2006-04-03 03:52:22 +02:00
server-tools Makefile.am: 2006-03-03 02:46:47 +01:00
sql Fix for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which explicitly 2006-05-09 16:39:11 +04:00
sql-bench Set thread_stack after return from end_thread() 2005-12-03 18:13:06 +02:00
sql-common Safer fix for Bug #18435 "5.0.19 libmysqlclient not ABI-compatible with 5.0.18" 2006-03-27 12:02:23 +03:00
SSL Added missing SSL library (Should be in source distribution) 2003-11-28 12:18:13 +02:00
strings conf_to_src.c: 2006-04-05 19:43:38 +05:00
support-files Merge 2006-04-01 05:53:37 +02:00
tests Fix incorrect merge: put '/*' comment start back. 2006-03-30 22:35:50 +04:00
tools pthread_handler_decl() changed to be ctags-friendly 2005-10-08 16:39:55 +02:00
VC++Files Merge mysql.com:/Users/kent/mysql/bk/mysql-4.1-new 2006-04-01 02:46:32 +02:00
vio No longer leak file descriptors in mysql_close. Fixes Bug#15846. 2006-03-17 18:46:34 +01:00
zlib Changes after initial patch to #15787 2006-01-23 21:35:11 +03:00
.bzrignore Disable udf test 2006-03-27 18:25:35 -08:00
.cvsignore Import changeset 2000-07-31 21:29:14 +02:00
configure.in configure.in: 2006-03-29 22:20:16 +02:00
COPYING - manual.texi will be replaced with a manual written in DocBook/XML. This ChangeSet removes all 2005-04-13 11:51:38 +02:00
Makefile.am Merge 2005-11-04 02:17:11 +01:00
README README: 2006-04-01 04:13:33 +02:00

This is a release of MySQL, a dual-license SQL database server.
MySQL is brought to you by the MySQL team at MySQL AB.

License information can be found in these files:
- For GPL (free) distributions, see the COPYING file.
- For commercial distributions, see the MySQLEULA.txt file.


For further information about MySQL or additional documentation, see:
- The latest information about MySQL: http://www.mysql.com
- The current MySQL documentation: http://dev.mysql.com/doc

Some manual sections of special interest:

- If you are migrating from an older version of MySQL, please read the
  "Upgrading from..." section first!
- To see what MySQL can do, take a look at the features section.
- For installation instructions, see the Installation chapter.
- For future plans, see the TODO appendix.
- For the new features/bugfix history, see the News appendix.
- For the currently known bugs/misfeatures (known errors) see the problems
  appendix.
- For a list of developers and other contributors, see the Credits
  appendix.

A local copy of the MySQL Reference Manual can be found in the Docs
directory in GNU Info format.  You can also browse the manual online or
download it in any of several formats at the URL given earlier in this
file.

************************************************************

IMPORTANT:

Bug or error reports should be sent to http://bugs.mysql.com.