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.
Find a file
unknown e0d2f525fe Fix for bug#20670 "UPDATE using key and invoking trigger that modifies
this key does not stop" (5.1 version).

UPDATE statement which WHERE clause used key and which invoked trigger
that modified field in this key worked indefinetely.

This problem occured because in cases when UPDATE statement was
executed in update-on-the-fly mode (in which row is updated right
during evaluation of select for WHERE clause) the new version of
the row became visible to select representing WHERE clause and was
updated again and again.
We already solve this problem for UPDATE statements which does not
invoke triggers by detecting the fact that we are going to update
field in key used for scanning and performing update in two steps,
during the first step we gather information about the rows to be
updated and then doing actual updates. We also do this for
MULTI-UPDATE and in its case we even detect situation when such
fields are updated in triggers (actually we simply assume that
we always update fields used in key if we have before update
trigger).

The fix simply extends this check which is done with help of
check_if_key_used()/QUICK_SELECT_I::check_if_keys_used()
routine/method in such way that it also detects cases when
field used in key is updated in trigger. We do this by
changing check_if_key_used() to take field bitmap instead
field list as argument and passing TABLE::write_set
to it (we also have to add info about fields used in
triggers to this bitmap a bit earlier).
As nice side-effect we have more precise and thus more optimal
perfomance-wise check for the MULTI-UPDATE.
Also check_if_key_used() routine and similar method were renamed
to is_key_used()/is_keys_used() in order to better reflect that
it is simple boolean predicate.
Finally, partition_key_modified() routine now also takes field
bitmap instead of field list as argument.


sql/key.cc:
  Now check_if_key_used() takes field bitmap instead of field list as
  argument (bitmaps are also used in its implementation).
  It is no longer responsible for checking if key uses automatically
  updated TIMESTAMP fields, instead callers should properly mark such
  fields in field bitmap.
  Also renamed this function to is_key_used().
sql/mysql_priv.h:
  Renamed check_if_key_used() to is_key_used(), also now this routine
  takes field bitmap instead of field list as argument.
sql/opt_range.cc:
  QUICK_SELECT_I::check_if_keys_used() method and check_if_key_used()
  routine were renamed to is_keys_used()/is_key_used(). Also now they
  take bitmap instead of field list as argument.
sql/opt_range.h:
  QUICK_SELECT_I::check_if_key_used() method was renamed to is_keys_used().
  Now it takes field bitmap instead of field list as argument and no
  longer responsible for checking if key uses automatically updated
  TIMESTAMP fields. Instead callers should properly mark such fields
  in field bitmap.
sql/sql_partition.cc:
  partition_key_modified() now takes field bitmap instead of list
  as argument.
sql/sql_partition.h:
  partition_key_modified() now takes field bitmap as argument
  instead of field list.
sql/sql_update.cc:
  To detect situation in which trigger modifies part of key which is
  going to be used for processing of where clause and thus makes
  processing of this update with update-on-the-fly method unsafe
  we use check_if_key_used() routine and similar method (which were
  renamed to is_key_used()) plus information from TABLE::write_map
  bitmap. Note that we have to call TABLE::mark_columns_needed_for_update()
  method earlier now to fill this bitmap with information about fields
  updated in triggers.
  safe_update_on_fly() routine now uses the same approach and no
  longer needs list of fields as argument.
2006-09-21 13:39:29 +04:00
BitKeeper Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge 2006-08-30 03:00:19 +04:00
BUILD Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
client Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
cmd-line-utils Merge neptunus.(none):/home/msvensson/mysql/bug16557/my50-bug16557 2006-02-21 08:57:18 +01:00
config/ac-macros Many files: 2006-08-21 15:34:29 +02:00
dbug Windows build fix: declare _db_set_ before it's used. 2006-08-14 16:15:08 +04:00
Docs Remove old cruft from the tree: mysqltestmanager, mysql_test_run_new, 2006-04-11 18:54:24 -07:00
extra Merge bodhi.local:/opt/local/work/tmp_merge 2006-08-12 21:06:51 +04:00
include Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge 2006-08-30 03:00:19 +04:00
libmysql Fix for bug #20907 2006-08-30 12:17:35 +02:00
libmysql_r Re-apply missing changeset, orignally pushed by elliot 2006-06-06 14:21:07 +03:00
libmysqld Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
man Makefile.am, configure.in: 2006-07-28 23:12:40 +02:00
mysql-test Fix im_instance_conf.imtest failure on AIX and HPUX. 2006-08-31 18:48:50 +04:00
mysys Merge zim.(none):/home/brian/mysql/dep-5.1 2006-08-14 21:26:33 -07:00
netware Fixed warning message breakage. 2006-08-13 22:28:41 -07:00
plugin Remove compiler warnings 2006-06-23 02:49:19 +03:00
pstack Makefile.am, configure.in: 2005-09-24 15:51:45 +02:00
regex Merge mysql.com:/home/emurphy/src/bk-clean/tmp_merge 2006-06-23 17:27:54 -04:00
scripts Merge zim.(none):/home/brian/mysql/dep-5.1 2006-08-14 21:26:33 -07:00
server-tools Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
sql Fix for bug#20670 "UPDATE using key and invoking trigger that modifies 2006-09-21 13:39:29 +04:00
sql-common Merge zim.(none):/home/brian/mysql/dep-5.1 2006-08-14 21:26:33 -07:00
storage Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
strings Merge bk-internal.mysql.com:/data0/bk/mysql-5.1 2006-08-17 16:37:16 +02:00
support-files Many files: 2006-08-21 15:34:29 +02:00
tests Merge zippy.cornsilk.net:/home/cmiller/work/mysql/merge/mysql-5.0 2006-08-21 12:59:46 -04:00
unittest Fixing unit test execution script to work with AIX 5.2 and OS X machines. 2006-08-14 13:52:05 +02:00
vio Re-apply missing changeset, orignally pushed by elliot 2006-06-06 14:21:07 +03:00
win Removed warnings for Windows build issues. Edited Windows README to remove reference to BDB. 2006-08-14 14:45:48 -07:00
zlib Rename cmakelists.txt -> CMakeLists.txt 2006-05-12 10:51:07 +02:00
.bzrignore Merge bodhi.local:/opt/local/work/tmp_merge 2006-08-12 21:06:51 +04:00
.cvsignore Import changeset 2000-07-31 21:29:14 +02:00
CMakeLists.txt Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1 2006-08-25 14:07:30 -07:00
configure.in Major changes are plug.in files created for almost all storage engines. A few stray BDB references removed. 2006-08-18 21:19:19 -07: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 Many files: 2006-08-21 15:34:29 +02: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.