Commit graph

664 commits

Author SHA1 Message Date
svoj@may.pils.ru
8cfef42f72 Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0
into  may.pils.ru:/home/svoj/devel/bk/mysql-5.0-engines
2006-10-08 15:14:53 +05:00
kroki/tomash@moonlight.intranet
ee0cebf9a7 BUG#21726: Incorrect result with multiple invocations of LAST_INSERT_ID.
Note: bug#21726 does not directly apply to 4.1, as it doesn't have stored
procedures.  However, 4.1 had some bugs that were fixed in 5.0 by the
patch for bug#21726, and this patch is a backport of those fixes.
Namely, in 4.1 it fixes:

  - LAST_INSERT_ID(expr) didn't return value of expr (4.1 specific).

  - LAST_INSERT_ID() could return the value generated by current
    statement if the call happens after the generation, like in

      CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
      INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());

  - Redundant binary log LAST_INSERT_ID_EVENTs could be generated.
2006-10-06 13:34:07 +04:00
svoj@april.(none)
77cb275b70 Merge mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-5.1-engines
2006-10-05 21:15:12 +05:00
svoj@mysql.com/april.(none)
d41340516f Merge mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG21381/mysql-5.0-engines
2006-10-05 19:02:29 +05:00
svoj@mysql.com/april.(none)
b141a7c1b9 BUG#21381 - Engine not notified about multi-table UPDATE IGNORE
Though this is not storage engine specific problem, I was able to
repeat this problem with BDB and NDB engines only. That was the
reason to add a test case into ndb_update.test. As a result
different bad things could happen.

BDB has removed duplicate rows which is not expected.
NDB returns an error.

For multi table update notify storage engine about UPDATE IGNORE
as it is done in single table UPDATE.
2006-10-05 18:23:53 +05:00
dlenev@mockturtle.local
8eb4401c59 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mockturtle.local:/home/dlenev/src/mysql-5.0-rt-merge
2006-10-02 22:53:10 +04:00
kroki/tomash@moonlight.intranet
5ea8adfae7 BUG#21726: Incorrect result with multiple invocations of LAST_INSERT_ID
Non-upper-level INSERTs (the ones in the body of stored procedure,
stored function, or trigger) into a table that have AUTO_INCREMENT
column didn't affected the result of LAST_INSERT_ID() on this level.

The problem was introduced with the fix of bug 6880, which in turn was
introduced with the fix of bug 3117, where current insert_id value was
remembered on the first call to LAST_INSERT_ID() (bug 3117) and was
returned from that function until it was reset before the next
_upper-level_ statement (bug 6880).

The fix for bug#21726 brings back the behaviour of version 4.0, and
implements the following: remember insert_id value at the beginning
of the statement or expression (which at that point equals to
the first insert_id value generated by the previous statement), and
return that remembered value from LAST_INSERT_ID() or @@LAST_INSERT_ID.

Thus, the value returned by LAST_INSERT_ID() is not affected by values
generated by current statement, nor by LAST_INSERT_ID(expr) calls in
this statement.

Version 5.1 does not have this bug (it was fixed by WL 3146).
2006-10-02 14:28:23 +04:00
dlenev@mockturtle.local
79bf51461e Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg20670-2
2006-09-30 11:35:34 +04:00
dlenev@mockturtle.local
93fed182eb Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mockturtle.local:/home/dlenev/src/mysql-5.1-bg20670
2006-09-30 00:31:33 +04:00
dlenev@mockturtle.local
5f149dde09 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.
2006-09-21 13:39:29 +04:00
dlenev@mockturtle.local
091ed9fb38 Fix for bug#20670 "UPDATE using key and invoking trigger that modifies
this key does not stop" (version for 5.0 only).

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 in 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.
As nice side-effect we have more precise and thus more optimal
perfomance-wise check for the MULTI-UPDATE.
Also check_if_key_used()/QUICK_SELECT_I::check_if_keys_used() were
renamed to is_key_used()/QUICK_SELECT_I::is_keys_used() in order to
better reflect that boolean predicate.

Note that this check is implemented in much more elegant way in 5.1
2006-09-21 11:35:38 +04:00
gkodinov@dl145s.mysql.com
ce8ed889d7 Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1
2006-09-18 12:57:20 +02:00
igor@rurik.mysql.com
d3d3cef88c Fixed bug #21493: crash for the second execution of a function
containing a select statement that uses an aggregating IN subquery.
Added a parameter to the function fix_prepare_information 
to restore correctly the having clause for the second execution.
Saved andor structure of the having conditions at the proper moment
before any calls of split_sum_func2 that could modify the having structure
adding new Item_ref objects. (These additions, are produced not with 
the statement mem_root, but rather with the execution mem_root.)
2006-09-16 09:50:48 -07:00
evgen@moonbone.local
8cf9781717 Merge moonbone.local:/work/tmp_merge-5.0-mysql
into  moonbone.local:/work/tmp_merge-5.1-opt-mysql
2006-08-29 18:58:50 +04:00
evgen@sunlight.local
dd9a07706b Fixed bug#21261: Wrong access rights was required for an insert into a view
SELECT right instead of INSERT right was required for an insert into to a view.
This wrong behaviour appeared after the fix for bug #20989. Its intention was
to ask only SELECT right for all tables except the very first for a complex
INSERT query. But that patch has done it in a wrong way and lead to asking 
a wrong access right for an insert into a view.

The setup_tables_and_check_access() function now accepts two want_access
parameters. One will be used for the first table and the second for other
tables.
2006-08-15 21:45:24 +04:00
svoj@may.pils.ru
67db270c71 BUG#7391 - Cross-database multi-table UPDATE uses active database
privileges

This problem is 4.1 specific. It doesn't affect 4.0 and was fixed
in 5.x before.

Having any mysql user who is allowed to issue multi table update
statement and any column/table grants, allows this user to update
any table on a server (mysql grant tables are not exception).

check_grant() accepts number of tables (in table list) to be checked
in 5-th param. While checking grants for multi table update, number
of tables must be 1. It must never be 0 (actually we have
DBUG_ASSERT(number > 0) in 5.x in grant_check() function).
2006-08-03 14:03:08 +05:00
kostja@bodhi.local
73189969f3 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-07-26 23:33:25 +04:00
guilhem@gbichot3.local
bca3fc7800 Merge gbichot3.local:/home/mysql_src/mysql-5.1-interval-move-next-insert-id
into  gbichot3.local:/home/mysql_src/mysql-5.1
2006-07-09 22:50:02 +02:00
guilhem@gbichot3.local
0594e1b84b WL#3146 "less locking in auto_increment":
this is a cleanup patch for our current auto_increment handling:
new names for auto_increment variables in THD, new methods to manipulate them
(see sql_class.h), some move into handler::, causing less backup/restore
work when executing substatements. 
This makes the logic hopefully clearer, less work is is needed in
mysql_insert().
By cleaning up, using different variables for different purposes (instead
of one for 3 things...), we fix those bugs, which someone may want to fix
in 5.0 too:
BUG#20339 "stored procedure using LAST_INSERT_ID() does not replicate
statement-based"
BUG#20341 "stored function inserting into one auto_increment puts bad
data in slave"
BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY UPDATE"
(now if a row is updated, LAST_INSERT_ID() will return its id)
and re-fixes:
BUG#6880 "LAST_INSERT_ID() value changes during multi-row INSERT"
(already fixed differently by Ramil in 4.1)
Test of documented behaviour of mysql_insert_id() (there was no test).
The behaviour changes introduced are:
- LAST_INSERT_ID() now returns "the first autogenerated auto_increment value
successfully inserted", instead of "the first autogenerated auto_increment
value if any row was successfully inserted", see auto_increment.test.
Same for mysql_insert_id(), see mysql_client_test.c.
- LAST_INSERT_ID() returns the id of the updated row if ON DUPLICATE KEY
UPDATE, see auto_increment.test. Same for mysql_insert_id(), see
mysql_client_test.c.
- LAST_INSERT_ID() does not change if no autogenerated value was successfully 
inserted (it used to then be 0), see auto_increment.test.
- if in INSERT SELECT no autogenerated value was successfully inserted,
mysql_insert_id() now returns the id of the last inserted row (it already
did this for INSERT VALUES), see mysql_client_test.c.
- if INSERT SELECT uses LAST_INSERT_ID(X), mysql_insert_id() now returns X
(it already did this for INSERT VALUES), see mysql_client_test.c.
- NDB now behaves like other engines wrt SET INSERT_ID: with INSERT IGNORE,
the id passed in SET INSERT_ID is re-used until a row succeeds; SET INSERT_ID
influences not only the first row now.

Additionally, when unlocking a table we check that the thread is not keeping
a next_insert_id (as the table is unlocked that id is potentially out-of-date);
forgetting about this next_insert_id is done in a new
handler::ha_release_auto_increment().

Finally we prepare for engines capable of reserving finite-length intervals
of auto_increment values: we store such intervals in THD. The next step
(to be done by the replication team in 5.1) is to read those intervals from
THD and actually store them in the statement-based binary log. NDB
will be a good engine to test that.
2006-07-09 17:52:19 +02:00
kostja@bodhi.local
7bf73ac3e5 Merge bodhi.local:/opt/local/work/mysql-5.0-root
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2006-07-07 22:09:43 +04:00
tomas@poseidon.ndb.mysql.com
98874725e0 Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not read all columns during update
2006-07-04 11:43:06 +02:00
dlenev@mysql.com
d4450e6696 Fix for bug#18437 "Wrong values inserted with a before update trigger on
NDB table".

SQL-layer was not marking fields which were used in triggers as such. As
result these fields were not always properly retrieved/stored by handler
layer. So one might got wrong values or lost changes in triggers for NDB,
Federated and possibly InnoDB tables.
This fix solves the problem by marking fields used in triggers
appropriately.

Also this patch contains the following cleanup of ha_ndbcluster code:

We no longer rely on reading LEX::sql_command value in handler in order
to determine if we can enable optimization which allows us to handle REPLACE
statement in more efficient way by doing replaces directly in write_row()
method without reporting error to SQL-layer.
Instead we rely on SQL-layer informing us whether this optimization
applicable by calling handler::extra() method with
HA_EXTRA_WRITE_CAN_REPLACE flag.
As result we no longer apply this optimzation in cases when it should not
be used (e.g. if we have on delete triggers on table) and use in some
additional cases when it is applicable (e.g. for LOAD DATA REPLACE).

Finally this patch includes fix for bug#20728 "REPLACE does not work
correctly for NDB table with PK and unique index".
  
This was yet another problem which was caused by improper field mark-up.
During row replacement fields which weren't explicity used in REPLACE
statement were not marked as fields to be saved (updated) so they have
retained values from old row version. The fix is to mark all table
fields as set for REPLACE statement. Note that in 5.1 we already solve
this problem by notifying handler that it should save values from all
fields only in case when real replacement happens.
2006-07-02 01:51:10 +04:00
mikael@dator5.(none)
4e390d711a BUG#17138: Crashes in stored procedure
Last round of review fixes
2006-07-01 00:01:37 -04:00
gkodinov@mysql.com
96ceb6c234 gcc 4.1 linux warning fixes backported from 5.0. 2006-06-28 16:28:29 +03:00
mikael@dator5.(none)
a8e6967c02 BUG#17138: Error in stored procedure
Review comments
2006-06-21 20:55:33 -04:00
mikael@dator5.(none)
cd93441a0a Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug17138
2006-06-20 16:59:51 -04:00
svoj@may.pils.ru
1c42c9730d Merge may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-5.0
into  may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-5.1
2006-06-20 16:45:51 +05:00
mikael@dator5.(none)
8bd81e1fee BUG#17138: Error in stored procedure due to fatal error when not really
a fatal error. New handling of ignore error in place.
2006-06-19 20:56:50 -04:00
svoj@may.pils.ru
2c28b3cbf1 Addition to fix for
BUG#18036 - update of table joined to self reports table as crashed

Set exclude_from_table_unique_test value back to FALSE. It is needed for
further check in multi_update::prepare whether to use record cache.
2006-06-19 17:50:52 +05:00
svoj@may.pils.ru
6a90aede13 Merge may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-4.1
into  may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-5.0
2006-06-19 16:06:29 +05:00
svoj@may.pils.ru
37cdb0fbf3 BUG#18036 - update of table joined to self reports table as crashed
Certain updates of table joined to self results in unexpected
behavior.

The problem was that record cache was mistakenly enabled for
self-joined table updates. Normally record cache must be disabled
for such updates.

Fixed wrong condition in code that determines whether to use
record cache for self-joined table updates.

Only MyISAM tables were affected.
2006-06-19 14:05:14 +05:00
monty@mysql.com
c46fb742b8 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new
into  mysql.com:/home/my/mysql-5.1
2006-06-04 21:05:22 +03:00
monty@mysql.com
74cc73d461 This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),

- New optional handler function introduced: reset()
  This is called after every DML statement to make it easy for a handler to
  statement specific cleanups.
  (The only case it's not called is if force the file to be closed)

- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
  should be moved to handler::reset()

- table->read_set contains a bitmap over all columns that are needed
  in the query.  read_row() and similar functions only needs to read these
  columns
- table->write_set contains a bitmap over all columns that will be updated
  in the query. write_row() and update_row() only needs to update these
  columns.
  The above bitmaps should now be up to date in all context
  (including ALTER TABLE, filesort()).

  The handler is informed of any changes to the bitmap after
  fix_fields() by calling the virtual function
  handler::column_bitmaps_signal(). If the handler does caching of
  these bitmaps (instead of using table->read_set, table->write_set),
  it should redo the caching in this code. as the signal() may be sent
  several times, it's probably best to set a variable in the signal
  and redo the caching on read_row() / write_row() if the variable was
  set.

- Removed the read_set and write_set bitmap objects from the handler class

- Removed all column bit handling functions from the handler class.
  (Now one instead uses the normal bitmap functions in my_bitmap.c instead
  of handler dedicated bitmap functions)

- field->query_id is removed. One should instead instead check
  table->read_set and table->write_set if a field is used in the query.

- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
  handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
  instead use table->read_set to check for which columns to retrieve.

- If a handler needs to call Field->val() or Field->store() on columns
  that are not used in the query, one should install a temporary
  all-columns-used map while doing so. For this, we provide the following
  functions:

  my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
  field->val();
  dbug_tmp_restore_column_map(table->read_set, old_map);

  and similar for the write map:

  my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
  field->val();
  dbug_tmp_restore_column_map(table->write_set, old_map);

  If this is not done, you will sooner or later hit a DBUG_ASSERT
  in the field store() / val() functions.
  (For not DBUG binaries, the dbug_tmp_restore_column_map() and
  dbug_tmp_restore_column_map() are inline dummy functions and should
  be optimized away be the compiler).

- If one needs to temporary set the column map for all binaries (and not
  just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
  methods) one should use the functions tmp_use_all_columns() and
  tmp_restore_column_map() instead of the above dbug_ variants.

- All 'status' fields in the handler base class (like records,
  data_file_length etc) are now stored in a 'stats' struct. This makes
  it easier to know what status variables are provided by the base
  handler.  This requires some trivial variable names in the extra()
  function.

- New virtual function handler::records().  This is called to optimize
  COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
  (stats.records is not supposed to be an exact value. It's only has to
  be 'reasonable enough' for the optimizer to be able to choose a good
  optimization path).

- Non virtual handler::init() function added for caching of virtual
  constants from engine.

- Removed has_transactions() virtual method. Now one should instead return
  HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
  transactions.

- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
  that is to be used with 'new handler_name()' to allocate the handler
  in the right area.  The xxxx_create_handler() function is also
  responsible for any initialization of the object before returning.

  For example, one should change:

  static handler *myisam_create_handler(TABLE_SHARE *table)
  {
    return new ha_myisam(table);
  }

  ->

  static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
  {
    return new (mem_root) ha_myisam(table);
  }

- New optional virtual function: use_hidden_primary_key().
  This is called in case of an update/delete when
  (table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
  but we don't have a primary key. This allows the handler to take precisions
  in remembering any hidden primary key to able to update/delete any
  found row. The default handler marks all columns to be read.

- handler::table_flags() now returns a ulonglong (to allow for more flags).

- New/changed table_flags()
  - HA_HAS_RECORDS	    Set if ::records() is supported
  - HA_NO_TRANSACTIONS	    Set if engine doesn't support transactions
  - HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
                            Set if we should mark all primary key columns for
			    read when reading rows as part of a DELETE
			    statement. If there is no primary key,
			    all columns are marked for read.
  - HA_PARTIAL_COLUMN_READ  Set if engine will not read all columns in some
			    cases (based on table->read_set)
 - HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
   			    Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
 - HA_DUPP_POS              Renamed to HA_DUPLICATE_POS
 - HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
			    Set this if we should mark ALL key columns for
			    read when when reading rows as part of a DELETE
			    statement. In case of an update we will mark
			    all keys for read for which key part changed
			    value.
  - HA_STATS_RECORDS_IS_EXACT
			     Set this if stats.records is exact.
			     (This saves us some extra records() calls
			     when optimizing COUNT(*))
			    

- Removed table_flags()
  - HA_NOT_EXACT_COUNT     Now one should instead use HA_HAS_RECORDS if
			   handler::records() gives an exact count() and
			   HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
  - HA_READ_RND_SAME	   Removed (no one supported this one)

- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()

- Renamed handler::dupp_pos to handler::dup_pos

- Removed not used variable handler::sortkey


Upper level handler changes:

- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
  cache is updated on engine creation time and updated on open.


MySQL level changes (not obvious from the above):

- DBUG_ASSERT() added to check that column usage matches what is set
  in the column usage bit maps. (This found a LOT of bugs in current
  column marking code).

- In 5.1 before, all used columns was marked in read_set and only updated
  columns was marked in write_set. Now we only mark columns for which we
  need a value in read_set.

- Column bitmaps are created in open_binary_frm() and open_table_from_share().
  (Before this was in table.cc)

- handler::table_flags() calls are replaced with handler::ha_table_flags()

- For calling field->val() you must have the corresponding bit set in
  table->read_set. For calling field->store() you must have the
  corresponding bit set in table->write_set. (There are asserts in
  all store()/val() functions to catch wrong usage)

- thd->set_query_id is renamed to thd->mark_used_columns and instead
  of setting this to an integer value, this has now the values:
  MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
  Changed also all variables named 'set_query_id' to mark_used_columns.

- In filesort() we now inform the handler of exactly which columns are needed
  doing the sort and choosing the rows.

- The TABLE_SHARE object has a 'all_set' column bitmap one can use
  when one needs a column bitmap with all columns set.
  (This is used for table->use_all_columns() and other places)

- The TABLE object has 3 column bitmaps:
  - def_read_set     Default bitmap for columns to be read
  - def_write_set    Default bitmap for columns to be written
  - tmp_set          Can be used as a temporary bitmap when needed.
  The table object has also two pointer to bitmaps read_set and write_set
  that the handler should use to find out which columns are used in which way.

- count() optimization now calls handler::records() instead of using
  handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).

- Added extra argument to Item::walk() to indicate if we should also
  traverse sub queries.

- Added TABLE parameter to cp_buffer_from_ref()

- Don't close tables created with CREATE ... SELECT but keep them in
  the table cache. (Faster usage of newly created tables).


New interfaces:

- table->clear_column_bitmaps() to initialize the bitmaps for tables
  at start of new statements.

- table->column_bitmaps_set() to set up new column bitmaps and signal
  the handler about this.

- table->column_bitmaps_set_no_signal() for some few cases where we need
  to setup new column bitmaps but don't signal the handler (as the handler
  has already been signaled about these before). Used for the momement
  only in opt_range.cc when doing ROR scans.

- table->use_all_columns() to install a bitmap where all columns are marked
  as use in the read and the write set.

- table->default_column_bitmaps() to install the normal read and write
  column bitmaps, but not signaling the handler about this.
  This is mainly used when creating TABLE instances.

- table->mark_columns_needed_for_delete(),
  table->mark_columns_needed_for_delete() and
  table->mark_columns_needed_for_insert() to allow us to put additional
  columns in column usage maps if handler so requires.
  (The handler indicates what it neads in handler->table_flags())

- table->prepare_for_position() to allow us to tell handler that it
  needs to read primary key parts to be able to store them in
  future table->position() calls.
  (This replaces the table->file->ha_retrieve_all_pk function)

- table->mark_auto_increment_column() to tell handler are going to update
  columns part of any auto_increment key.

- table->mark_columns_used_by_index() to mark all columns that is part of
  an index.  It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
  it to quickly know that it only needs to read colums that are part
  of the key.  (The handler can also use the column map for detecting this,
  but simpler/faster handler can just monitor the extra() call).

- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
  also mark all columns that is used by the given key.

- table->restore_column_maps_after_mark_index() to restore to default
  column maps after a call to table->mark_columns_used_by_index().

- New item function register_field_in_read_map(), for marking used columns
  in table->read_map. Used by filesort() to mark all used columns

- Maintain in TABLE->merge_keys set of all keys that are used in query.
  (Simplices some optimization loops)

- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
  but the field in the clustered key is not assumed to be part of all index.
  (used in opt_range.cc for faster loops)

-  dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
   tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
   mark all columns as usable.  The 'dbug_' version is primarily intended
   inside a handler when it wants to just call Field:store() & Field::val()
   functions, but don't need the column maps set for any other usage.
   (ie:: bitmap_is_set() is never called)

- We can't use compare_records() to skip updates for handlers that returns
  a partial column set and the read_set doesn't cover all columns in the
  write set. The reason for this is that if we have a column marked only for
  write we can't in the MySQL level know if the value changed or not.
  The reason this worked before was that MySQL marked all to be written
  columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
  bug'.

- open_table_from_share() does not anymore setup temporary MEM_ROOT
  object as a thread specific variable for the handler. Instead we
  send the to-be-used MEMROOT to get_new_handler().
  (Simpler, faster code)



Bugs fixed:

- Column marking was not done correctly in a lot of cases.
  (ALTER TABLE, when using triggers, auto_increment fields etc)
  (Could potentially result in wrong values inserted in table handlers
  relying on that the old column maps or field->set_query_id was correct)
  Especially when it comes to triggers, there may be cases where the
  old code would cause lost/wrong values for NDB and/or InnoDB tables.

- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
  OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
  This allowed me to remove some wrong warnings about:
  "Some non-transactional changed tables couldn't be rolled back"

- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
  (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
  some warnings about
  "Some non-transactional changed tables couldn't be rolled back")

- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
  which could cause delete_table to report random failures.

- Fixed core dumps for some tests when running with --debug

- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
  (This has probably caused us to not properly remove temporary files after
  crash)

- slow_logs was not properly initialized, which could maybe cause
  extra/lost entries in slow log.

- If we get an duplicate row on insert, change column map to read and
  write all columns while retrying the operation. This is required by
  the definition of REPLACE and also ensures that fields that are only
  part of UPDATE are properly handled.  This fixed a bug in NDB and
  REPLACE where REPLACE wrongly copied some column values from the replaced
  row.

- For table handler that doesn't support NULL in keys, we would give an error
  when creating a primary key with NULL fields, even after the fields has been
  automaticly converted to NOT NULL.

- Creating a primary key on a SPATIAL key, would fail if field was not
  declared as NOT NULL.


Cleanups:

- Removed not used condition argument to setup_tables

- Removed not needed item function reset_query_id_processor().

- Field->add_index is removed. Now this is instead maintained in
  (field->flags & FIELD_IN_ADD_INDEX)

- Field->fieldnr is removed (use field->field_index instead)

- New argument to filesort() to indicate that it should return a set of
  row pointers (not used columns). This allowed me to remove some references
  to sql_command in filesort and should also enable us to return column
  results in some cases where we couldn't before.

- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
  bitmap, which allowed me to use bitmap functions instead of looping over
  all fields to create some needed bitmaps. (Faster and smaller code)

- Broke up found too long lines

- Moved some variable declaration at start of function for better code
  readability.

- Removed some not used arguments from functions.
  (setup_fields(), mysql_prepare_insert_check_table())

- setup_fields() now takes an enum instead of an int for marking columns
   usage.

- For internal temporary tables, use handler::write_row(),
  handler::delete_row() and handler::update_row() instead of
  handler::ha_xxxx() for faster execution.

- Changed some constants to enum's and define's.

- Using separate column read and write sets allows for easier checking
  of timestamp field was set by statement.

- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()

- Don't build table->normalized_path as this is now identical to table->path
  (after bar's fixes to convert filenames)

- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
  do comparision with the 'convert-dbug-for-diff' tool.


Things left to do in 5.1:

- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
  row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
  Mats has promised to look into this.

- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
  (I added several test cases for this, but in this case it's better that
  someone else also tests this throughly).
  Lars has promosed to do this.
2006-06-04 18:52:22 +03:00
jani@a193-229-222-105.elisa-laajakaista.fi
c81b4c01bf Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new
2006-05-30 16:07:49 +03:00
gkodinov@mysql.com
a21a2b5bcd BUG#18681: View privileges are broken
The check for view security was lacking several points :
1. Check with the right set of permissions : for each table ref that
participates in a view there were the right credentials to use in it's
security_ctx member, but these weren't used for checking the credentials.
This makes hard enforcing the SQL SECURITY DEFINER|INVOKER property
consistently.
2. Because of the above the security checking for views was just ruled out
in explicit ways in several places.
3. The security was checked only for the columns of the tables that are
brought into the query from a view. So if there is no column reference
outside of the view definition it was not detecting the lack of access to
the tables in the view in SQL SECURITY INVOKER mode.

The fix below tries to fix the above 3 points.
2006-05-26 11:47:53 +03:00
evgen@sunlight.local
368b92390c Manually merged 2006-04-05 20:12:26 +04:00
evgen@sunlight.local
b9949ed9c7 Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
Mutli-table uses temporary table to store new values for fields. With the
new values the rowid of the record to be updated is stored in a Field_string
field. Table to be updated is set as source table of the rowid field.
But when the temporary table creates the tmp field for the rowid field it
converts it to a varstring field because the table to be updated was created by
the v4.1. Due to this the stored rowids were broken and no records for 
update were found.

The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring. The Field_string::type() function 
now always returns MYSQL_TYPE_STRING if can_alter_field_type is set to 0.
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
2006-04-05 13:29:04 +04:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
konstantin@mysql.com
a27e32b565 Merge mysql.com:/home/kostja/mysql/mysql-5.0-root
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-22 14:04:24 +03:00
dlenev@mysql.com
e47606a30b Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/src/mysql-5.0-bg16593
2006-02-16 16:22:53 +03:00
dlenev@mysql.com
4a41a00d4b Fix for bug #16593 "Deadlock or crash in stress test for case where
trigger starts trigger".

In short, the deadlock/crash happened when execution of statement, which used
stored functions or activated triggers, coincided with alteration of the
tables used by these functions or triggers (in highly concurrent environment).

Bug was caused by the incorrect handling of tables from prelocked set in
open_tables() functions in situations when refresh happened. This fix replaces
old smart but not very robust way of handling tables after refresh (which was
closing only old tables), with new one which simply closes all tables opened so
far and restarts open_tables().
Also fixed handling of temporary tables in close_tables_for_reopen().

No test case present since bug manifests itself only in concurrent environment.
2006-02-16 16:19:24 +03:00
konstantin@mysql.com
5ed755d0d8 Merge mysql.com:/home/kostja/mysql/tmp_merge
into  mysql.com:/home/kostja/mysql/mysql-5.1-merge
2006-02-08 23:53:45 +03:00
sergefp@mysql.com
a906e3c62d WL#2985 "Partition pruning", "do pruning for UPDATE/DELETE": Post-merge fixes 2006-02-06 18:33:39 +03:00
konstantin@mysql.com
98091b152a Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/opt/local/work/mysql-5.0-root
2006-02-02 18:17:18 +03:00
sergefp@mysql.com
c53b5a0b9f WL#2985 "Partition pruning": addition2: perform partition pruning for
single-table UPDATE/DELETE.
2006-01-26 20:17:17 +03:00
sergefp@mysql.com
5c3027833b BUG#15935: post-review fixes: added comment 2006-01-26 00:09:04 +03:00
sergefp@mysql.com
5d0e8d81ee BUG#15935: In mysql_update, don't use full index scan when we could have used quick select scan. 2006-01-25 23:25:23 +03:00
sergefp@mysql.com
56ba8abd12 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/home/psergey/mysql-5.1-ppruning-r4
2006-01-04 11:25:48 +03:00
sergefp@mysql.com
7c3fe127e0 Fix compiler warning 2006-01-04 11:16:34 +03:00
ingo@mysql.com
44ef4989bb Merge mysql.com:/home/mydev/mysql-4.1
into  mysql.com:/home/mydev/mysql-4.1-bug5390
2005-12-27 10:36:19 +01:00
ingo@mysql.com
ef52a59418 Merge mysql.com:/home/mydev/mysql-5.0
into  mysql.com:/home/mydev/mysql-5.0-bug5390
2005-12-27 10:31:00 +01:00
ingo@mysql.com
a04c5adb0b BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 5.1.
Extended the unique table check by a check of lock data.
Merge sub-tables cannot be detected by doing name checks only.
2005-12-22 13:48:00 +01:00
lars@mysql.com
ad126d90e0 WL#1012: All changes as one single changeset.
This includes both code and test cases.
2005-12-22 06:39:02 +01:00
ingo@mysql.com
b0e84cb999 BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 5.0.
Extended the unique table check by a check of lock data.
Merge sub-tables cannot be detected by doing name checks only.
2005-12-20 16:35:05 +01:00
jimw@mysql.com
00d29cd259 Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2005-12-12 11:57:07 -08:00
jimw@mysql.com
e18679c7ff Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-12-12 10:11:56 -08:00
jimw@mysql.com
f7ff3d653a Fix calls to free_underlaid_joins() in INSERT, DELETE, and UPDATE
handling so that indexes are closed before trying to commit the
transaction. (Bug #15536)
2005-12-08 12:33:33 -08:00
ingo@mysql.com
5aa315e23a BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
INSERT ... SELECT with the same table on both sides (hidden
below a MERGE table) does now work by buffering the select result.
The duplicate detection works now after open_and_lock_tables() 
on the locks.
I did not find a test case that failed without the change in
sql_update.cc. I made the change anyway as it should in theory
fix a possible MERGE table problem with multi-table update.
2005-12-07 19:52:26 +01:00
igor@rurik.mysql.com
09e6597015 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-12-02 20:42:36 -08:00
evgen@moonbone.local
f2559fbcc3 Merge moonbone.local:/work/15028-bug-5.0-mysql
into moonbone.local:/work/15028-bug-5.1-new-mysql
2005-12-02 22:07:10 +03:00
evgen@moonbone.local
00b902b065 Manually merged 2005-12-02 19:42:14 +03:00
evgen@moonbone.local
3f72e7645f Fix bug#15028 Multitable update returns different numbers of matched rows
depending on table order

multi_update::send_data() was counting updates, not updated rows. Thus if one 
record have several updates it will be counted several times in 'rows matched'
but updated only once.

multi_update::send_data() now counts only unique rows.
2005-12-01 23:22:20 +03:00
pem@mysql.com
b2a9961abf Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/usr/home/pem/mysql-5.1-new
2005-11-28 20:14:12 +01:00
monty@mysql.com
e42c980967 Table definition cache, part 2
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
  object and open a handler to the table object

Other noteworthy changes:
- In TABLE_SHARE the most common strings are now LEX_STRING's
- Better error message when table is not found
- Variable table_cache is now renamed 'table_open_cache'
- New variable 'table_definition_cache' that is the number of table defintions that will be cached
- strxnmov() calls are now fixed to avoid overflows
- strxnmov() will now always add one end \0 to result
- engine objects are now created with a TABLE_SHARE object instead of a TABLE object.
- After creating a field object one must call field->init(table) before using it

- For a busy system this change will give you:
 - Less memory usage for table object
 - Faster opening of tables (if it's has been in use or is in table definition cache)
 - Allow you to cache many table definitions objects
 - Faster drop of table
2005-11-23 22:45:02 +02:00
pem@mysql.com
0411412403 Fixed BUG#13729 Stored procedures: packet error after exception handled
Don't set thd->is_fatal_error in sql_update for duplicate key errors.
2005-11-23 11:56:53 +01:00
acurtis@poseidon.ndb.mysql.com
c01a3b5e5f Make storage engines "pluggable", handlerton work 2005-11-07 16:25:06 +01:00
igor@rurik.mysql.com
8e8a2d79cc Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-04 17:54:47 -08:00
monty@mysql.com
a6f5375cb0 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
2005-11-05 01:32:55 +02:00
monty@mysql.com
164b469660 Fixed wrong merge
Optimize new pushed code
2005-11-02 14:43:25 +02:00
evgen@moonbone.local
6d3bd1e0ee sql_update.cc:
After merge fix
2005-11-01 20:53:27 +03:00
evgen@moonbone.local
bbe58c7e26 Manually merged 2005-11-01 19:47:53 +03:00
igor@rurik.mysql.com
6a1c8d48f6 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-29 09:41:18 -07:00
sergefp@mysql.com
eb57f520ba Merge 2005-10-28 22:31:41 +04:00
bell@sanja.is.com.ua
b5d2e34572 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-owner7-5.0
2005-10-28 10:12:36 +03:00
igor@rurik.mysql.com
30a7c28603 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-27 21:37:52 -07:00
evgen@moonbone.local
77723c2438 Fix bug#14186 select datefield is null not updated
Date field was declared as not null, thus expression 'datefield is null'
was always false. For SELECT special handling of such cases is used. 
There 'datefield is null' converted to 'datefield eq "0000-00-00"'.

In mysql_update() before creation of select added remove_eq_conds() call.
It makes some optimization of conds and in particular performs conversion
from 'is null' to 'eq'. 
Also remove_eq_conds() makes some evaluation of conds and if it founds that
conds is always false then update statement is not processed further.
All this allows to perform some update statements process faster due to
optimized conds, and not wasting resources if conds known to be false.
2005-10-28 01:24:11 +04:00
bell@sanja.is.com.ua
1b164c7b83 support of view underlying tables and SP functions security check added (BUG#9505) (WL#2787) 2005-10-28 00:18:23 +03:00
jani@ua141d10.elisa.omakaista.fi
cbe21a8eb6 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
2005-10-27 23:43:20 +03:00
sergefp@mysql.com
56aeee44d3 Fix for BUG#14272: Don't run index scan when we should use quick select.
This could cause failures because there are table handlers (like federated)
that support quick select scanning but do not support index scanning.
2005-10-25 16:34:03 +04:00
monty@mysql.com
3e653fb922 Added more tests for new UPDATE ... ORDER BY ... LIMIT optimization 2005-10-25 02:27:40 +03:00
igor@rurik.mysql.com
a236acce10 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-22 19:35:37 -07:00
sergefp@mysql.com
e7065d355c BUG#121915: Merge 4.1->5.0 2005-10-19 01:52:06 +04:00
sergefp@mysql.com
d6903c4566 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/psergey/mysql-4.1-bug12915-r2
2005-10-18 14:08:50 +04:00
igor@rurik.mysql.com
c136e9c43b Fixed bug #12762:
allowed set functions aggregated in outer subqueries, allowed nested set functions.
2005-10-15 14:32:37 -07:00
bell@sanja.is.com.ua
6d6e107f12 - set 'updating' in both tables list if we have two of them (because of subquery) (BUG#13236)
- fixed test
2005-10-14 00:02:38 +03:00
lars@mysql.com
57f36732ca Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1
into  mysql.com:/users/lthalmann/bk/mysql-5.0
2005-10-10 17:50:19 +02:00
lars@mysql.com
998380521f BUG#12618: Removing fake locking 2005-10-10 15:10:14 +02:00
tomas@poseidon.ndb.mysql.com
620b7bafb0 Merge 2005-10-06 10:54:07 +02:00
sergefp@mysql.com
e9f2f9437a BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete
when there is no WHERE clause.
2005-09-30 15:21:37 +04:00
msvensson@neptunus.(none)
fbf4a5e079 Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
2005-09-28 11:34:53 +02:00
monty@mysql.com
ea6d5f9ec3 Fixed error found during review of new pushed code 2005-09-25 21:22:23 +03:00
guilhem@mysql.com
388cf622ee Fix fur BUG#13348: "multi-table updates and deletes are not logged if no rows were affected".
Not fixed in 4.1 as not critical. Also I'm correcting error checking of multi-UPDATE/DELETE
when it comes to binlogging, to make it consistent with when we rollback the statement.
2005-09-20 17:41:47 +02:00
ndbdev@dl145c.mysql.com
dc595c9b1d merge 2005-09-15 07:36:47 +02:00
dlenev@mysql.com
2a96aa110f Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg12704-2
2005-09-15 03:57:59 +04:00
dlenev@mysql.com
e231ebe5fb Fix for bug #12704 "Server crashes during trigger execution".
This bug occurs when some trigger for table used by DML statement is created
or changed while statement was waiting in lock_tables(). In this situation
prelocking set which we have calculated becames invalid which can easily lead
to errors and even in some cases to crashes.

With proposed patch we no longer silently reopen tables in lock_tables(),
instead caller of lock_tables() becomes responsible for reopening tables and
recalculation of prelocking set.
2005-09-15 03:56:09 +04:00
tulin@dl145c.mysql.com
80da104ea5 merge 2005-09-14 13:37:52 +02:00
gluh@eagle.intranet.mysql.r18.ru
cc395fc0c2 Bug#9683 INFORMATION_SCH: Creation of temporary table allowed in
Information_schema DB 
Bug#9846 Inappropriate error displayed while
         dropping table from 'INFORMATION_SCHEMA'
Bug#10734 Grant of privileges other than 'select' and 
         'create view' should fail on schema 
Bug#10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA

 cumulative fix for bugs above(after review, 2nd version)
 added privilege check for information schema db & tables
2005-09-13 16:07:38 +05:00
ndbdev@dl145c.mysql.com
f40c1576b0 Merge 2005-09-06 09:20:15 +02:00
pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se
02056f8e3a Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.0
into  c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.1
2005-08-25 13:11:38 -04:00
bell@sanja.is.com.ua
144c847da6 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-bug3-5.0
2005-08-23 23:17:36 +03:00
monty@mysql.com
1a6f16edd9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2005-08-15 18:35:48 +03:00
timour@mysql.com
354ce1d024 Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-2486-merge
2005-08-12 19:27:54 +03:00
timour@mysql.com
a247282aa6 Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".

* Some of the main problems fixed by the patch:
  - in "select *" queries the * expanded correctly according to
    ANSI for arbitrary natural/using joins
  - natural/using joins are correctly transformed into JOIN ... ON
    for any number/nesting of the joins.
  - column references are correctly resolved against natural joins
    of any nesting and combined with arbitrary other joins.

* This patch also contains a fix for name resolution of items
  inside the ON condition of JOIN ... ON - in this case items must
  be resolved only against the JOIN operands. To support such
  'local' name resolution, the patch introduces a stack of
  name resolution contexts used at parse time.

NOTICE:
- This patch is not complete in the sense that
  - there are 2 test cases that still do not pass -
    one in join.test, one in select.test. Both are marked
    with a comment "TODO: WL#2486".
  - it does not include a new test specific for the task
2005-08-12 17:57:19 +03:00
monty@mysql.com
4c0d23e156 Fixes during review of new pushed code
Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong
2005-08-12 13:54:42 +03:00
dlenev@mysql.com
0f75d64734 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11973-2
2005-08-11 10:39:33 +04:00
dlenev@mysql.com
60511c3df2 Clumsy but working fix for bug #11973 "SELECT .. INTO var_name; in trigger
cause crash on update".

Let us update "thd" pointer in LEX, all its units and in LEX::result before
executing statement in trigger body, since triggers are associated with TABLE
object and because of this can be used in different threads.
2005-08-10 00:23:56 +04:00
dlenev@mysql.com
615baa9f23 Fix for bug #10055 "Using stored function with information_schema causes empty
result set".

To enable full access to contents of I_S tables from stored functions
or statements that use them, we manipulate with thread's open tables
state and ensure that we won't cause deadlock when we open tables by
ignoring flushes and name-locks.
Building of contents of I_S.TABLES no longer requires locking of tables
since we use use handler::info() method with HA_STATUS_AUTO flag instead
of handler::update_auto_increment() for obtaining information about
auto-increment values. But this also means that handlers have to implement
support for HA_STATUS_AUTO flag (particularly InnoDB needs it).
2005-08-08 17:46:06 +04:00
bell@sanja.is.com.ua
4c69fbe632 issue correct error message in case of view presence for duplicated table on update (BUG#10773)
frequently used command sequence replaced with inline function
2005-08-02 22:54:49 +03:00
mronstrom@mysql.com
67087e2aa7 Patch for push of wl1354 Partitioning 2005-07-18 13:31:02 +02:00
tomas@poseidon.ndb.mysql.com
911d878ca9 Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1
2005-07-15 15:08:38 +02:00
marko@hundin.mysql.fi
bf7b47d92e sql_update.cc:
mysql_update(): Call handler::unlock_row()
  also in the first while loop.
  This patch is from Heikki,
  and it was approved by Sergei Golubchik.
2005-07-13 16:13:36 +03:00
tomas@poseidon.ndb.mysql.com
674b6bb151 Merge 2005-07-12 20:01:22 +02:00
bell@sanja.is.com.ua
d3905f3d0e Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
ndbdev@dl145b.mysql.com
161a58ab4b merge 2005-06-06 23:39:19 +02:00
monty@mysql.com
a69f432115 Code cleanups during code reviews
Ensure we get error if INSERT IGNORE ... SELECT fails
Fixed wrong key_part->key_length usage in index_merge
2005-06-01 16:35:09 +03:00
tomas@poseidon.ndb.mysql.com
5088b28d09 Merge 2005-05-31 14:37:47 +02:00
konstantin@mysql.com
2d6a70c42a Preparatory (and the most problematic) patch for Bug#7306
"the server side preparedStatement error for LIMIT placeholder",
which moves all uses of LIMIT clause from PREPARE to OPTIMIZE
and later steps.
After-review fixes.
2005-05-30 20:54:37 +04:00
dlenev@mysql.com
1449d44e1c Manual merge of patch fixing several trigger related bugs with main tree. 2005-05-24 22:35:41 +04:00
dlenev@brandersnatch.localdomain
007a205918 Fix for bugs:
#5860 "Multi-table UPDATE does not activate update triggers"
 #6812 "Triggers are not activated for INSERT ... SELECT"
 #8755 "Trigger is not activated by LOAD DATA".
This patch also implements proper handling of triggers for special forms
of insert like REPLACE or INSERT ... ON DUPLICATE KEY UPDATE. 
Also now we don't call after trigger in case when we have failed to
inserted/update or delete row. Trigger failure should stop statement
execution.

I have not properly tested handling of errors which happen inside of
triggers in this patch, since it is simplier to do this once we will be
able to access tables from triggers.
2005-05-24 22:19:33 +04:00
tulin@dl145c.mysql.com
03590c20bd merge 2005-05-18 22:26:23 +02:00
monty@mysql.com
79909808d8 After merge fix 2005-05-17 23:52:36 +03:00
tulin@dl145c.mysql.com
23f79bd1f2 merge 2005-05-17 10:17:53 +02:00
mronstrom@mysql.com
c33a0673a6 Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/Users/mikron/wl1682
2005-05-12 12:01:01 +02:00
igor@rurik.mysql.com
9d4b228b61 Many files:
Fixed bug #8528.
  Representation for single-table views was made similar to
  representation for multi-table views.
view.test:
  Added test case for bug #8528.
view.result:
  Added test case for bug #8528. Fixed other test cases.
2005-05-10 16:31:13 -07:00
mronstrom@mysql.com
aedc92ab39 After review fixes 2005-05-09 10:30:25 +02:00
mronstrom@mysql.com[mikron]
4bfdc6c9c3 wl2445.patch 2005-05-07 14:06:07 +02:00
mronstrom@mysql.com
b4ab00df62 WL 1682: Bitvector for updated/read fields in handler interface
Fixed clear issues of bitvector and memory allocation issues
2005-05-07 10:00:25 +02:00
mronstrom@mysql.com
f7cd6b8aa1 WL 1682: After review fixes + update bitvector class + bitvector test
cases + bug fixes
2005-05-02 15:45:33 +02:00
mronstrom@mysql.com
21347433cf WL 1682: Use bitvector instead of query_id to tell handler which fields
to read and write
Changed Server code, added new interface to handler and changed the
NDB handler, InnoDB handler and Federated handler that previously used
query_id
Bug#10202 fix (one-liner fix for memory leak)
2005-04-28 14:45:27 +02:00
dlenev@brandersnatch.localdomain
6b0b4734d9 Fix for bug #9486 "Can't perform multi-update in stored procedure".
New more SP-locking friendly approach to handling locks in multi-update.
Now we mark all tables of multi-update as needing write lock at parsing
stage and if possible downgrade lock at execution stage (For its work
SP-locking mechanism needs to know all lock types right after parsing
stage).
2005-04-15 20:31:47 +04:00
bell@sanja.is.com.ua
1659dacab1 fixed mechanism of detection selection from table wich we update
(BUG##9398, BUG#8703)
fixed wrong join view detection in multi-delete which lead to server crash
2005-03-28 15:13:31 +03:00
jimw@mysql.com
ee2b4ec959 Eliminate warnings noticed by VC7. This includes fixing my_mmap() on
Windows to call CreateFileMapping() with correct arguments, and
propogating the introduction of query_id_t to everywhere query ids are
passed around. (Bug #8826)
2005-03-18 16:12:25 -08:00
jani@a193-229-222-105.elisa-laajakaista.fi
1fbb61754b Fixed two bugs in MySQL ACL.
First one is related to Bug#7905. One should not be allowed to
create new user with password without UPDATE privilege to
MySQL database. Furthermore, executing the same GRANT statement
twice would actually crash the server and corrupt privilege database.

Other bug was that one could update a column, using the existing
value as basis to calculate the new value (e.g. UPDATE t1 SET a=a+1)
without SELECT privilege to the field (a in the above example)

Fixed tests grant.pl and grant2, which were wrong.
2005-03-17 08:16:56 +02:00
monty@mysql.com
594ef41b2d Cleanup during reviews
Removed some optional arguments
Fixed portability problem in federated tests
2005-03-16 16:11:01 +02:00
dlenev@mysql.com
5b16dbf960 Manual merge SP-locking improvements patch with current tree. 2005-03-04 17:46:45 +03:00
dlenev@brandersnatch.localdomain
5a6c7027f0 Better approach for prelocking of tables for stored routines execution
and some SP-related cleanups.

- We don't have separate stage for calculation of list of tables
  to be prelocked and doing implicit LOCK/UNLOCK any more.
  Instead we calculate this list at open_tables() and do implicit
  LOCK in lock_tables() (and UNLOCK in close_thread_tables()).
  Also now we support cases when same table (with same alias) is
  used several times in the same query in SP.

- Cleaned up execution of SP. Moved all common code which handles
  LEX and does preparations before statement execution or complex
  expression evaluation to auxilary sp_lex_keeper class. Now 
  all statements in SP (and corresponding instructions) that
  evaluate expression which can contain subquery have their
  own LEX.
2005-03-04 16:35:28 +03:00
monty@mysql.com
0a6b7aedb2 Remove compiler warnings and remove not used variables
(Found during build process)
2005-02-25 16:53:22 +02:00
monty@mysql.com
e2ea35ec67 Merge with 4.1 2005-02-22 15:47:00 +02:00
mats@mysql.com
0ad02a920c Merge from 4.0 2005-02-18 14:19:08 +01:00
mats@mysql.com
d0f1b5f3fd Merge mysql.com:/home/bkroot/mysql-4.0
into mysql.com:/home/bk/b7879-mysql-4.0
2005-02-18 13:50:19 +01:00
serg@serg.mylan
530eecbd99 Merge serg.mylan:/usr/home/serg/Abk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0-xa
2005-02-17 14:00:44 +01:00
monty@mysql.com
410e51c854 Fixed failing test cases 'row.test' when running with --ps-protocol
Simple optimzations done while reviewing code
2005-02-15 16:45:00 +02:00
mats@mysql.com
625f7f0d55 Bug#7879: Using TL_READ_NO_INSERT locks instead of TL_READ locks when
reading tables in "complex" SQL statements. If inserts happen in a
table being read, the statements have no serialization order and the
change can therefore not be reproduced on the slave.
2005-02-15 11:02:01 +01:00
serg@serg.mylan
fd828e5b4d manually merged 2005-02-14 21:50:09 +01:00
hf@deer.(none)
b94a482ee9 Precision Math implementation 2005-02-09 02:50:45 +04:00
monty@mysql.com
422c2eb868 4.1 -> 5.0 merge 2005-02-03 13:18:30 +02:00
monty@mysql.com
3936edd7fa Fixed during review of new pulled code 2005-02-02 20:28:01 +02:00
serg@serg.mylan
33fc4b10b6 configure.in
don't define UNIV_DEBUG in CFLAGS/CXXFLAGS anymore
sql/mysqld.cc
    hide from the user options that do nothing
sql/sql_update.cc
    better fix for uninitialized used_index
2005-02-02 12:08:20 +01:00
acurtis@pcgem.rdg.cyberkinetica.com
6a354b1b04 Bug#7011
Merge from 4.0
2005-01-31 12:48:00 +00:00
acurtis@pcgem.rdg.cyberkinetica.com
500fbf5c0f Bug#7011
Fix replication for multi-update
  new test - rpl_multi_update2
2005-01-30 10:24:03 +00:00
serg@serg.mylan
3c5060981f query_id and my_xid -> ulonglong
fix for binlog+autocommit+tclog
comments, style fixes
2005-01-27 22:38:56 +01:00
serg@serg.mylan
c76405a7ee merged 2005-01-24 19:41:42 +01:00
serg@serg.mylan
67ba2e367a fixes/cleanups according to Coverity report 2005-01-24 15:48:25 +01:00
monty@mysql.com
314cf993c6 Fixed memory reference errors found by valgrind 2005-01-12 03:38:53 +02:00
monty@mysql.com
bda0a78184 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
2005-01-06 13:31:31 +02:00
monty@mysql.com
d35140a851 First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
2005-01-06 13:00:13 +02:00
bell@sanja.is.com.ua
a8a5f3590c fixed bugs in view code with prepared statemnts 2005-01-04 18:04:16 +02:00
monty@mysql.com
7cf8285b3f After merge fixes
Add support for warnings for prepare of prepared statements
Fixed test to work with --ps-protocol
Fixed some test results
2005-01-04 13:46:53 +02:00
monty@mysql.com
309b1a2b6c Merge with 4.1 tree to get fix for INSERT IGNORE ... ON DUPLICATE KEY 2005-01-03 23:04:52 +02:00
monty@mysql.com
2299e1eca4 Better handling of ensuring that setup_tables() are not called twice
This fixed a bug in prepared statements when used with outher joins
Fixed a bug in SUM(DISTINCT) when used with prepared statements.
Some safety fixes in test scripts to ensure that previous test failures shouldn't affect other tests
2005-01-03 21:04:33 +02:00
monty@mysql.com
1bd22faa05 Remove DUP_IGNORE from enum_duplicates and instead use a separate ignore flag
This allows use to use INSERT IGNORE ... ON DUPLICATE ...
2004-12-31 12:04:35 +02:00
monty@mysql.com
d71c030587 After merge fixes 2004-12-31 00:44:00 +02:00
monty@mishka.local
4f4bbfc279 Merge with 4.1 2004-12-22 13:54:39 +02:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
1be319a708 Merge Bug#7391 from 4.0 2004-12-18 15:12:10 +00:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
1e07c1a6c1 Remove bogus lines 2004-12-18 02:34:11 +00:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
3047649845 Bug#7391 - Multi-table UPDATE security regression
Add in missing privilege checks. 
  Tests for the privileges.
2004-12-18 02:07:32 +00:00
dlenev@mysql.com
62a6d9749b Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-bg6765
2004-12-09 13:33:12 +03:00
dlenev@brandersnatch.localdomain
4b0882e0a6 Fix for bug #6765 "Implicit access to time zone description
tables requires privileges for them if some table or column level grants
present" (with after-review fixes).

We should set SELECT_ACL for implicitly opened tables in 
my_tz_check_n_skip_implicit_tables() to be able to bypass privilege
checking in check_grant(). Also we should exclude those tables from
privilege checking in multi-update.
2004-12-09 13:31:46 +03:00
monty@mysql.com
75d0958dc3 After merge fixes
Fixed compiler warnings
Fix core dump when sending SIGHUP to mysqld
2004-12-06 17:15:54 +02:00
mskold@mysql.com
f6209be015 New fix for bug#6796 Wrong outcome of update operation of ndb table 2004-12-06 14:34:02 +01:00
mskold@mysql.com
75da2fb3f4 Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-4.1
2004-12-06 14:15:52 +01:00
monty@mysql.com
0de4777187 Merge with 4.1 2004-12-06 11:38:56 +02:00
mats@mysql.com
2bbdf2403d Bug#6391 (binlog-do-db rules ignored)
CREATE DATABASE statement used the current database instead of the
  database created when checking conditions for replication.
  CREATE/DROP/ALTER DATABASE statements are now replicated based on
  the manipulated database.
2004-12-03 12:13:51 +01:00
mskold@mysql.com
065184dac3 Fix for Bug #6794 Wrong outcome of update operation of ndb table 2004-11-28 22:28:36 +01:00
bell@sanja.is.com.ua
a1cac9687e spelling fixed/comments added (postreview fixes) 2004-11-25 09:28:32 +02:00
bell@sanja.is.com.ua
1e3d8b0839 post-merge fix 2004-11-25 02:23:13 +02:00
bell@sanja.is.com.ua
072d38eb12 merge 2004-11-21 20:08:12 +02:00
bell@sanja.is.com.ua
21eb2e2eae post merge 2004-11-21 19:33:49 +02:00
bell@sanja.is.com.ua
7210195f1e now my_printf_error is not better then my_error, but my_error call is shorter
used only one implementation of format parser of (printf)
fixed multistatement
2004-11-13 19:35:51 +02:00
bell@sanja.is.com.ua
1555469b64 merge 2004-11-12 15:36:31 +02:00
bell@sanja.is.com.ua
31f7811183 post-review fixes 2004-11-12 14:34:00 +02:00
konstantin@mysql.com
1d32e06be9 Few more places with thd->lex replaced with lex (mysql_update,
check_simple_select). This change was inspired by Monty in December 2003
when thd->lex became a pointer in 4.1.
2004-11-11 22:37:48 +03:00
bell@sanja.is.com.ua
0ef0b030a5 merge 2004-11-11 21:18:10 +02:00
bell@sanja.is.com.ua
a41ef77b7b Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-view-5.0
2004-11-08 03:33:52 +02:00
bell@sanja.is.com.ua
9d0bb7426a postreview fixes 2004-11-08 01:54:23 +02:00
bell@sanja.is.com.ua
7eae926e26 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-view-5.0
2004-11-06 12:46:46 +02:00
bell@sanja.is.com.ua
064b02203f new lock for multiupdate:
- open and create derived tables
- detect which tables should be locked for write
- lock and fill derived tables
some unitialized variables fixed
2004-11-05 17:29:47 +02:00
monty@mysql.com
47bbf768d4 Fixes after merge with 4.1
FOUND is not a reserved keyword anymore
Added Item_field::set_no_const_sub() to be able to mark fields that can't be substituted
Added 'simple_select' method to be able to quickly determinate if a select_result is a normal SELECT
Note that the 5.0 tree is not yet up to date: Sanja will have to fix multi-update-locks for this merge to be complete
2004-11-03 12:39:38 +02:00
monty@mysql.com
afbe601302 merge with 4.1 2004-10-29 19:26:52 +03:00
bell@sanja.is.com.ua
3d389a038e fixed detection of updating table on which we select (BUG#6032) 2004-10-25 17:32:28 +03:00
bell@sanja.is.com.ua
4714a6e744 errors without code removed
net_printf/send_error calls replaced by my_error family functions
-1/1 (sent/unsent) error reporting removed
(WL#2133)
2004-10-20 04:04:37 +03:00
bell@sanja.is.com.ua
c287345cb8 fixed incorrect type custing (fixed problem with runing tests with --debug (thanks, Sergei Gluhov spoted it)) 2004-10-09 18:51:19 +03:00
bell@sanja.is.com.ua
c8d5f8991d merge 2004-10-07 11:36:46 +03:00
monty@mysql.com
6239edc1d1 After merge fixes
Some bigger code changes was necessary becasue of the multi-table-update and the new HANDLER code
2004-10-07 10:50:13 +03:00
bell@sanja.is.com.ua
3ef0b19cd3 fixed & added comments (according to Igor's review and a bit more) 2004-10-07 01:45:06 +03:00
monty@mysql.com
62f3cd6a31 Merge with 4.0 for 4.1 release
Noteworthy:
- New HANDLER code
- New multi-update-grant-check code
- Table lock code in ha_innodb.cc was not applied
2004-10-06 19:14:33 +03:00
monty@mysql.com
c27d22b44e Reverted patch for new usage of open_count as it caused more problems than it solved
Cleaned up patch for checking locks for multi-table updates
2004-10-06 01:24:21 +03:00
bell@sanja.is.com.ua
a78f817d20 merge 2004-10-05 13:41:51 +03:00
monty@mishka.local
5eca078b19 merge 2004-10-05 01:10:23 +03:00
monty@mishka.local
0fa62b691b Fixed bug in strict mode (A state was not properly cleared on successful insert/update's) 2004-10-05 01:05:15 +03:00
bell@sanja.is.com.ua
9062e99ee6 merge 2004-10-04 13:56:48 +03:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
2973a047ea Bug#4118: multi-table UPDATE takes WRITE lock on read table
Ensures that WRITE lock is not obtained on all tables referenced.
2004-10-03 00:20:47 +01:00
monty@mishka.local
be4ca46fbe More fixes for strict mode:
More tests.
Better error messages.
Fixed bug when checking if we updated all needed columns for INSERT.
Give an error if we encounter a wrong float value during parsing.
Don't print DEFAULT for columns without a default value in SHOW CREATE/SHOW FIELDS.
Fixed UPDATE IGNORE when using STRICT mode.
2004-10-02 22:20:08 +03:00
dlenev@brandersnatch.localdomain
2511990c97 Support for TIMESTAMP columns holding NULL values. Unlike all other
column types TIMESTAMP is NOT NULL by default, so in order to have 
TIMESTAMP column holding NULL valaues you have to specify NULL as
one of its attributes (this needed for backward compatibility).

Main changes:
Replaced TABLE::timestamp_default_now/on_update_now members with
TABLE::timestamp_auto_set_type flag which is used everywhere
for determining if we should auto-set value of TIMESTAMP field 
during this operation or not. We are also use Field_timestamp::set_time()
instead of handler::update_timestamp() in handlers.
2004-10-01 18:54:06 +04:00
bell@sanja.is.com.ua
013512abab merge 2004-09-29 17:10:17 +03:00
bell@sanja.is.com.ua
392292a46b post review changes:
CHECK OPTION moved to one function
view name added to error messages
2004-09-29 16:35:01 +03:00
monty@mishka.local
1fc7e6af85 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mishka.local:/home/my/mysql-5.0
2004-09-28 20:19:03 +03:00
monty@mishka.local
f2941380c4 Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
Added checking of date/datetime fields.
If strict mode, give error if we have not given value to field without a default value (for INSERT)
2004-09-28 20:08:00 +03:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
0b6dc49388 Bug#5553 - Multi table UPDATE IGNORE fails on dup key
We don't want the update to abort when IGNORE is specified
2004-09-17 12:07:59 +01:00
bell@sanja.is.com.ua
09b316f051 updateability of field with collation support (BUG#5506) 2004-09-16 23:45:20 +03:00
bell@sanja.is.com.ua
67fcac7a87 support of join view updateability (WL#1809) 2004-09-15 23:42:56 +03:00
bell@sanja.is.com.ua
f797298fc5 fixed merged view fields names (BUG#5147)
support of merged VIEW over several tables added (WL#1809)
2004-09-14 19:28:29 +03:00
bell@sanja.is.com.ua
763c57d41f Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-show-5.0
2004-09-10 02:26:09 +03:00
bell@sanja.is.com.ua
0badc913bb check that table used in multi-update is unique added (BUG#5455) 2004-09-08 13:39:15 +03:00
dlenev@mysql.com
9b1bc6a4d5 Merge of changes from the main tree to tree for WL#1218 "Triggers". 2004-09-08 13:29:21 +04:00
bell@sanja.is.com.ua
425857f5b2 test of updating and fetching from the same table check (BUG##5157) 2004-09-08 10:18:04 +03:00
dlenev@brandersnatch.localdomain
9ed038dd6f WL#1218 "Triggers". Some very preliminary version of patch.
Mostly needed for Monty for him getting notion what needed for triggers 
from new .FRM format. 

Things to be done:
- Right placement of trigger's invocations
- Right handling of errors in triggers (including transaction rollback)
- Support for priviliges
- Right handling of DROP/RENAME table (hope that it will be handled automatically
  with merging of .TRG into .FRM file)
- Saving/restoring some information critical for trigger creation and replication
  with their definitions (e.g. sql_mode, creator, ...)
- Replication

Already has some known bugs so probably not for general review.
2004-09-07 16:29:46 +04:00
bell@sanja.is.com.ua
ee03178f01 merge 2004-09-06 15:56:38 +03:00
bell@sanja.is.com.ua
6d8e178523 merge 2004-09-05 22:14:27 +03:00
bell@sanja.is.com.ua
161662ba4c Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0
2004-09-04 15:32:13 +03:00
monty@mysql.com
46ff90738b Merge with pulled code 2004-09-03 22:38:45 +03:00
monty@mysql.com
cbd67f49e1 Cleanup of new code pushed into 5.0 since last pull
Merged the different find_xxxx_table_in_list functions to one + some inline functions
2004-09-03 21:43:04 +03:00
bell@sanja.is.com.ua
bd2c119176 CHECK OPTIONs added (WL#1983) 2004-09-03 15:18:40 +03:00
bell@sanja.is.com.ua
392c306969 fixed open_and_lock_tables result processing (all open_and_lock_tables revision)
fixed printing of COLLATE operation
(BUG#5155)
2004-08-31 10:06:38 +03:00
bell@sanja.is.com.ua
a27b1e54d5 fixed using VIEW fields (BUG#4617) 2004-07-23 09:20:58 +03:00
miguel@hegel.txg
b3b598d19c Fixes for bug #4571 (Windows compabilities) 2004-07-16 03:47:17 -03:00
bell@sanja.is.com.ua
9336d36cf8 VIEW
two TABLE_LIST copy eliminated
2004-07-16 01:15:55 +03:00
monty@mysql.com
31fe2837f9 Merge with 4.1 2004-07-12 08:20:24 +03:00
monty@mysql.com
db7efa2780 New handler::index_flags() definition to make it easy to check the full used key and a specific key part.
Added key part to optimize_range() to fix problems when using fields in key parts.
2004-07-08 15:45:25 +03:00
monty@mysql.com
1e31199995 Merge with 4.1.3-beta 2004-07-07 11:29:39 +03:00
serg@serg.mylan
c03addab79 merged 2004-06-23 12:36:07 +02:00
serg@serg.mylan
3f1c4ba745 handler interface cleanups:
more logical table/index_flags
  return  HA_ERR_WRONG_COMMAND instead of abstract methods where appropriate
  max_keys and other limits renamed to max_supported_keys/etc
  max_keys/etc are now wrappers to max_supported_keys/etc 
  ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to real {index,rnd}_{init,end} to enforce strict pairing
2004-06-23 12:29:05 +02:00
guilhem@mysql.com
2b20e84ff8 Making DROP TABLE IF EXISTS, DROP DATABASE IF EXISTS, DELETE FROM, UPDATE be logged to
binlog even if they changed nothing, and a test for this.
This is useful when users use these commands to clean up their master and slave by issuing
one command on master (assume master and slave have slightly different data for some
reason and you want to clean up both).
Note that I have not changed multi-table DELETE and multi-table UPDATE because their
error-reporting mechanism is more complicated.
2004-06-09 16:07:01 +02:00
sergefp@mysql.com
2e93dfaf42 More code cleanup, debug prints removed
Fixed an incorrect optimizer choice for ror-intersect(key, clustered_primary)
Typo bug fixed in multitable update
2004-06-01 15:31:58 +04:00
sergefp@mysql.com
5843eec521 Manual merge 2004-05-29 20:55:46 +04:00
bell@sanja.is.com.ua
c7396f8d20 PS and SP made compatible in mechanism used for preparing query for rexecutions (Bug #2266) 2004-05-20 02:02:49 +03:00
sergefp@mysql.com
3b29cad05c Manual merge 2004-05-13 01:49:47 +04:00
sergefp@mysql.com
a46d7542c9 This is first cset for WL#1394 "Optimize index merge when all involved index ranges include only values with equal keys"
The main idea is to exploit the fact that key scans for "key=const" return ordered sequences of rowids.
2004-05-13 01:38:40 +04:00
pem@mysql.com
bf45960eef Merge 4.1 -> 5.0 2004-05-07 18:52:06 +02:00
bell@sanja.is.com.ua
62fca61bc4 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-ndb-4.1
2004-05-05 21:24:13 +03:00
bell@sanja.is.com.ua
c5c35c667e caching of queries with isammerge tables forbiden using general way
SQL_SELECT_LIMIT as default will be applied only for SELECT statement if there was not explicit LIMIT clause
correct table list passed to class constructor of select_update
2004-05-05 21:21:41 +03:00
monty@mysql.com
104fdf607d Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
2004-05-05 12:40:59 +03:00
Sinisa@sinisa.nasamreza.org
68cb444c62 Fix for a multi table updates when one of the tables is not updated
but used in a nested query.
2004-05-04 23:04:05 +03:00
monty@mysql.com
59ddd8c738 Fix to handle unsigned data in prepared statements (Bug #3447)
Fixed security problem that password was temporarly reset when someone changed GRANT for a user. (Bug #3404)
Fixed problem with PROCEDURE analyse() and impossible WHERE (Bug #2238)
Don't auto-repair tables in mysqlcheck if table type doesn't support 'check' command.
2004-05-04 15:02:38 +03:00
pem@mysql.comhem.se
296ba0ea57 WL#1567: Add ROW_COUNT() Function to retrieve count of rows updated/inserted/deleted 2004-05-04 13:45:20 +02:00
bell@sanja.is.com.ua
a535342d57 after review PS fixes 2004-04-10 01:14:32 +03:00
bell@sanja.is.com.ua
5e37c41fae new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
2004-04-08 00:16:17 +03:00
pem@mysql.com
dfd59e296e Merge 4.1 -> 5.0. 2004-04-07 19:07:44 +02:00
dlenev@jabberwock.localdomain
f6bff2e6c6 WL#1266 "Separate auto-set logic from TIMESTAMP type."
Final version of patch.

Adds support for specifying of DEFAULT NOW() and/or ON UPDATE NOW()
clauses for TIMESTAMP field definition.
Current implementation allows only one such field per table and
uses several unireg types for storing info about this properties of
field. It should be replaced with better implementation when new
.frm format is introduced.
2004-04-02 10:12:53 +04:00
bell@sanja.is.com.ua
d095d4753e after review changes 2004-03-20 13:36:26 +02:00