Commit graph

211 commits

Author SHA1 Message Date
Igor Babaev
d2e3b33b8c Rolled back the patch for bug 791761.
A better fix for this bug will be pulled from mariadb-5.2.
2012-02-26 00:19:07 -08:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Michael Widenius
6920457142 Merge with MariaDB 5.1 2011-11-24 18:48:58 +02:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Igor Babaev
2e8542f462 Fixed LP bug #791761.
An aggregating query over an empty set of a join of two tables
with a rejecting HAVING clause erroneously could return a row.
It could happen in the cases when the optimizer made a conclusion
that the aggregating set was empty.
Wrong results were produced because the server missed initial
setting for aggregation functions in the mentioned cases.
2011-07-20 21:55:55 -07:00
unknown
99cce18955 Fixed LP BUG#800696.
The problem was that optimizer removes some outer references (it they are
constant for example) and the list of outer items built during prepare phase is
not actual during execution phase when we need it as the cache parameters.
First solution was use pointer on pointer on outer reference Item and
initialize temporary table on demand. This solved most problem except case
when optimiser also reduce Item which contains outer references ('OR' in
this bug test suite).

The solution is to build the list of outer reference items on execution
phase (after optimization) on demand (just before temporary table creation)
by walking Item tree and finding outer references among Item_ident
(Item_field/Item_ref) and Item_sum items.

Removed depends_on list (because it is not neede any mnore for the cache, in the place where it was used it replaced with upper_refs).

Added processor (collect_outer_ref_processor) and get_cache_parameters() methods to collect outer references (or other expression parameters in future).

mysql-test/r/subselect_cache.result:
  A new test added.
mysql-test/r/subselect_scache.result:
  Changes in creating the cache and its paremeters order or adding arguments of aggregate function (which is a parameter also, but this has no influence on the result).
mysql-test/t/subselect_cache.test:
  Added a new test.
sql/item.cc:
  depends_on removed.
  
  Added processor (collect_outer_ref_processor) and get_cache_parameters() methods to collect outer references.
  
  Item_cache_wrapper collect parameters befor initialization of its cache.
sql/item.h:
  depends_on removed.
  
  Added processor (collect_outer_ref_processor) and get_cache_parameters() methods to collect outer references.
sql/item_cmpfunc.cc:
  depends_on removed.
  
  Added processor (collect_outer_ref_processor) to collect outer references.
sql/item_cmpfunc.h:
  Added processor (collect_outer_ref_processor) to collect outer references.
sql/item_subselect.cc:
  depends_on removed.
  Added processor get_cache_parameters() method to collect outer references.
sql/item_subselect.h:
  depends_on removed.
  Added processor get_cache_parameters() method to collect outer references.
sql/item_sum.cc:
  Added processor (collect_outer_ref_processor) method to collect outer references.
sql/item_sum.h:
  Added processor (collect_outer_ref_processor) and get_cache_parameters() methods to collect outer references.
sql/opt_range.cc:
  depends_on removed.
sql/sql_base.cc:
  depends_on removed.
sql/sql_class.h:
  New iterator added.
sql/sql_expression_cache.cc:
  Build of list of items resolved in outer query done just before creating expression cache on the first execution of the subquery which removes influence of optimizer removing items (all optimization already done).
sql/sql_expression_cache.h:
  Build of list of items resolved in outer query done just before creating expression cache on the first execution of the subquery which removes influence of optimizer removing items (all optimization already done).
sql/sql_lex.cc:
  depends_on removed.
sql/sql_lex.h:
  depends_on removed.
sql/sql_list.h:
  Added add_unique method to add only unique elements to the list.
sql/sql_select.cc:
  Support of new Item list added.
sql/sql_select.h:
  Support of new Item list added.
2011-07-19 23:19:10 +03:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Michael Widenius
1be5462d59 Merge with MariaDB 5.1 2011-05-03 19:10:10 +03:00
Michael Widenius
e415ba0fb2 Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
2011-05-02 20:58:45 +03:00
Michael Widenius
3358cdd504 Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
Michael Widenius
ff3da0f963 Change TABLE->alias to String for less memory reallocation
Changed some String.ptr() -> String.c_ptr() for String that are not guaranteed to end with \0
Removed some c_ptr() usage from parameters to functions that takes ptr & length
Use preallocate buffers to avoid calling malloc() for most operations. 


sql/event_db_repository.cc:
  alias is now a String
sql/event_scheduler.cc:
  c_ptr -> c_ptr_safe() to avoid warnings from valgrind.
sql/events.cc:
  c_ptr -> c_ptr_safe() to avoid warnings from valgrind.
  c_ptr -> ptr() as function takes ptr & length
sql/field.cc:
  alias is now a String
sql/field.h:
  alias is now a String
sql/ha_partition.cc:
  alias is now a String
sql/handler.cc:
  alias is now a String
  ptr() -> c_ptr() as string is not guaranteed to be \0 terminated
sql/item.cc:
  Store error parameter in separarte buffer to ensure correct error message
sql/item_func.cc:
  ptr() -> c_ptr_safe() as string is not guaranteed to be \0 terminated
sql/item_sum.h:
  Use my_strtod() instead of my_atof() to not have to make string \0 terminated
sql/lock.cc:
  alias is now a String
sql/log.cc:
  c_ptr() -> ptr() as function takes ptr & length
sql/log_event.cc:
  c_ptr_quick() -> ptr() as we only want to get the pointer to String buffer
sql/opt_range.cc:
  ptr() -> c_ptr() as string is not guaranteed to be \0 terminated
sql/opt_table_elimination.cc:
  alias is now a String
sql/set_var.cc:
  ptr() -> c_ptr() as string is not guaranteed to be \0 terminated
  c_ptr() -> c_ptr_safe() to avoid warnings from valgrind.
  c_ptr() -> ptr() as function takes ptr & length
  Simplify some code.
sql/sp.cc:
  c_ptr() -> ptr() as function takes ptr & length
sql/sp_rcontext.cc:
  alias is now a String
sql/sql_base.cc:
  alias is now a String.
  Here we win a realloc() for most alias usage.
sql/sql_class.cc:
  Use size descriptor for printf() to avoid accessing bytes outside of buffer
sql/sql_insert.cc:
  Change allocation of TABLE as it's now contains a String
  _ptr() -> ptr() as function takes ptr & length
sql/sql_load.cc:
  Use preallocate buffers to avoid calling malloc() for most operations.
sql/sql_parse.cc:
  Use c_ptr_safe() to ensure string is \0 terminated.
sql/sql_plugin.cc:
  c_ptr_quick() -> ptr() as function takes ptr & length
sql/sql_select.cc:
  alias is now a String
sql/sql_show.cc:
  alias is now a String
sql/sql_string.h:
  Added move() function to change who owns the string (owner does the free)
sql/sql_table.cc:
  alias is now a String
  c_ptr() -> c_ptr_safe() to avoid warnings from valgrind.
sql/sql_test.cc:
  c_ptr() -> c_ptr_safe() to avoid warnings from valgrind.
  alias is now a String
sql/sql_trigger.cc:
  c_ptr() -> c_ptr_safe() to avoid warnings from valgrind.
  Use field->init() to setup pointers to alias.
sql/sql_update.cc:
  alias is now a String
sql/sql_view.cc:
  ptr() -> c_ptr_safe() as string is not guaranteed to be \0 terminated
sql/sql_yacc.yy:
  r() -> c_ptr() as string is not guaranteed to be \0 terminated
sql/table.cc:
  alias is now a String
sql/table.h:
  alias is now a String
storage/federatedx/ha_federatedx.cc:
  Remove extra 1 byte alloc that is automaticly done by strmake()
  Ensure that error message ends with \0
storage/maria/ha_maria.cc:
  alias is now a String
storage/myisam/ha_myisam.cc:
  alias is now a String
2011-02-28 12:48:50 +02:00
Michael Widenius
58bb0769bd Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria

Now need to merge with latest xtradb before pushing 

sql/ha_partition.cc:
  Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
  Changed to use opt_stack_trace instead of opt_pstack.
  Removed references to pstack
sql/partition_element.h:
  Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
  Fixed wrong assert
2011-02-20 18:51:43 +02:00
Alexander Barkov
a2850a2f53 Bug#59149 valgrind warnings with "like .. escape .." function
Problem: when processing a query like:
  SELECT '' LIKE '1' ESCAPE COUNT(1);
escape_item->val_str() was never executed and the "escape" class member
stayed initialized, which led to valgrind uninitialized memory error.
      
Note, a query with some tables in "FROM" clause
returns ER_WRONG_ARGUMENTS in the same situation:

   SELECT '' LIKE '1' ESCAPE COUNT(1) FROM t1;
   ERROR 1210 (HY000): Incorrect arguments to ESCAPE

Fix: disallowing using aggregate functions in ESCAPE clause,
even if there are no tables used. There is no much use of that anyway.
2011-01-17 12:30:22 +03:00
Sergey Glukhov
e2db8e6ccb Bug#58030 crash in Item_func_geometry_from_text::val_str
Item_sum_max/Item_sum_min incorrectly set null_value flag and
attempt to get result in parent functions leads to crash.
This happens due to double evaluation of the function argumet.
First evaluation happens in the comparator and second one
happens in Item_cache::cache_value().
The fix is to introduce new Item_cache object which
holds result of the argument and use this cached value
as an argument of the comparator.

mysql-test/r/func_group.result:
  test case
mysql-test/t/func_group.test:
  test case
sql/item.cc:
  added assertion that ether we have some result or result is NULL.
sql/item_sum.cc:
  introduce new Item_cache object which
  holds result of the argument and use this cached value
  as an argument of the comparator.
sql/item_sum.h:
  introduce new Item_cache object which
  holds result of the argument and use this cached value
  as an argument of the comparator.
2010-12-21 14:34:11 +03:00
Sergei Golubchik
04a4b43346 merge with 5.1 2010-10-25 15:21:16 +02:00
Sergei Golubchik
745cc74c33 5.1.51 merge 2010-10-19 15:58:35 +02:00
Alexey Kopytov
d7d0f6390b Bug #54465: assert: field_types == 0 || field_types[field_pos]
== MYSQL_TYPE_LONGLONG

A MIN/MAX() function with a subquery as its argument could lead
to a debug assertion on debug builds or wrong data on release
ones.

The problem was a combination of the following factors:

- Item_sum_hybrid::fix_fields() might use the argument
(args[0]) to calculate 'hybrid_field_type' which was later used
to decide how the data should be sent to the client.

- Item_sum::make_field() might use the argument again to
calculate the field's type when sending result set metadata to
the client.

- The argument could be changed in between these two calls via
  Item::set_arg() leading to inconsistent metadata being
  reported.

Here is what was happening for the bug's test case:

1. Item_sum_hybrid::fix_fields() calculates hybrid_field_type
as MYSQL_TYPE_LONGLONG based on args[0] which is an
Item::SUBSELECT_ITEM at that time.

2. A temporary table is created to execute the
query. create_tmp_field_from_item() creates a Field_long object
according to the subselect's max_length.

3. The subselect item in Item_sum_hybrid is replaced by the
Item_field object referencing the newly created Field_long.

4. Item_sum::make_field() rightfully returns the
MYSQL_TYPE_LONG type when calculating the result set metadata.

5. When sending the actual data, Item::send() relies on the
virtual field_type() function which in our case returns
previously calculated hybrid_field_type == MYSQL_TYPE_LONGLONG.

It looks like the only solution is to never refer to the
argument's metadata after the result metadata has been
calculated in fix_fields(), since the argument itself may be
different by then. In this sense, Item_sum::make_field() should
never be used, because it may rely on the argument's metadata
and is only called after fix_fields(). The "default"
implementation in Item::make_field() should be used instead as
it relies only on field_type(), but not on the argument's type.

Fixed by removing Item_sum::make_field() so that the superclass
implementation Item::make_field() is always used.

mysql-test/r/func_group.result:
  Added a test case for bug #54465.
mysql-test/t/func_group.test:
  Added a test case for bug #54465.
sql/item_sum.cc:
  Removed Item_sum::make_field() so that the superclass
  implementation Item::make_field() is always used.
sql/item_sum.h:
  Removed Item_sum::make_field() so that the superclass
  implementation Item::make_field() is always used.
2010-08-27 13:44:35 +04:00
Michael Widenius
58a75bb18b Automerge with 5.1 2010-08-25 01:44:50 +03:00
Michael Widenius
b6fe4713fe Fix for LP#612894 Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value
mysql-test/r/group_by.result:
  Added test that showed problems that no_rows_in_results() didn't work for expressions
mysql-test/r/subselect4.result:
  Test case for LP#612894
mysql-test/t/group_by.test:
  Added test that showed problems that no_rows_in_results() didn't work for expressions
mysql-test/t/subselect4.test:
  Test case for LP#612894
sql/item.h:
  Added restore_to_before_no_rows_in_result()
  Added function processor for no_rows_in_results() and restore_to_before_no_rows_in_results() to ensure it works with functions
  Fix that above functions are handled by Item_ref()
sql/item_func.h:
  Ensure that no_rows_in_results() and restore_to_before_no_rows_in_result() are called for all function arguments
sql/item_sum.cc:
  Added restore_to_before_no_rows_in_result() to restore settings after Item_sum_hybrid::no_rows_in_result() was called.
  This is needed to handle the case where we have made 'make_const()' on the item in opt_sum(), but the item will be reused again in a sub query.
  Ignore multiple calls to no_rows_in_result() as Item_ref is calling it twice.
sql/item_sum.h:
  Added restore_to_before_no_rows_in_result();
sql/sql_select.cc:
  Added reset of no_rows_in_result() for JOIN::reinit()
sql/sql_select.h:
  Added marker if no_rows_in_result() is called.
2010-08-23 12:46:25 +03:00
Michael Widenius
d042146e5b Merge with MariaDB 5.1.49
Removed references to HA_END_SPACE_KEY (which has been 0 for a long time)
2010-08-05 22:56:11 +03:00
Michael Widenius
e0a6b02c5d Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
2010-08-02 12:01:24 +03:00
Davi Arnaut
0f9ddfa9d8 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

One somewhat major source of strict-aliasing violations and
related warnings is the SQL_LIST structure. For example,
consider its member function `link_in_list` which takes
a pointer to pointer of type T (any type) as a pointer to
pointer to unsigned char. Dereferencing this pointer, which
is done to reset the next field, violates strict-aliasing
rules and might cause problems for surrounding code that
uses the next field of the object being added to the list.

The solution is to use templates to parametrize the SQL_LIST
structure in order to deference the pointers with compatible
types. As a side bonus, it becomes possible to remove quite
a few casts related to acessing data members of SQL_LIST.

sql/handler.h:
  Use the appropriate template type argument.
sql/item.cc:
  Remove now-unnecessary cast.
sql/item_subselect.cc:
  Remove now-unnecessary casts.
sql/item_sum.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary cast.
sql/mysql_priv.h:
  Move SQL_LIST structure to sql_list.h
  Use the appropriate template type argument.
sql/sp.cc:
  Remove now-unnecessary casts.
sql/sql_delete.cc:
  Use the appropriate template type argument.
  Remove now-unnecessary casts.
sql/sql_derived.cc:
  Remove now-unnecessary casts.
sql/sql_lex.cc:
  Remove now-unnecessary casts.
sql/sql_lex.h:
  SQL_LIST now takes a template type argument which must
  match the type of the elements of the list. Use forward
  declaration when the type is not available, it is used
  in pointers anyway.
sql/sql_list.h:
  Rename SQL_LIST to SQL_I_List. The template parameter is
  the type of object that is stored in the list.
sql/sql_olap.cc:
  Remove now-unnecessary casts.
sql/sql_parse.cc:
  Remove now-unnecessary casts.
sql/sql_prepare.cc:
  Remove now-unnecessary casts.
sql/sql_select.cc:
  Remove now-unnecessary casts.
sql/sql_show.cc:
  Remove now-unnecessary casts.
sql/sql_table.cc:
  Remove now-unnecessary casts.
sql/sql_trigger.cc:
  Remove now-unnecessary casts.
sql/sql_union.cc:
  Remove now-unnecessary casts.
sql/sql_update.cc:
  Remove now-unnecessary casts.
sql/sql_view.cc:
  Remove now-unnecessary casts.
sql/sql_yacc.yy:
  Remove now-unnecessary casts.
storage/myisammrg/ha_myisammrg.cc:
  Remove now-unnecessary casts.
2010-06-10 17:45:22 -03:00
Sergei Golubchik
ffc8f62b08 merge 5.1->5.2 2010-06-01 21:52:20 +02:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Michael Widenius
1aafea91e5 Merge with 5.1
Fixed valgrind warnings found from running main.connect under valgrind


sql/sp_head.cc:
  Ensure that vcol_info is reset
sql/sql_acl.cc:
  Fixed usage of wrong memroot for password
sql/sql_yacc.yy:
  Ensure that vcol_info is reset
2010-04-01 12:04:26 +03:00
Michael Widenius
1fec5af772 Fixed compiler warnings and sporadic failures in test cases
mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test:
  Added missing sync_slave_with_master; Fixes random failures
mysql-test/include/default_mysqld.cnf:
  default-character-set -> character-set-server (removes warning in error files for usage of deprecated options)
mysql-test/lib/My/SafeProcess/safe_process.cc:
  Fixed compiler warning
mysql-test/lib/v1/mysql-test-run.pl:
  default-character-set -> character-set-server (removes warning in error files for usage of deprecated options)
mysql-test/suite/rpl/r/rpl_do_grant.result:
  Updated test results
mysql-test/suite/rpl/t/rpl_do_grant.test:
  Added missing sync_slave_with_master; Fixes random failures
  Had to explictely do stop slave before DROP USER to avoid failure on slave as the user is already dropped on slave.
mysql-test/suite/rpl/t/rpl_name_const.test:
  Added missing sync_slave_with_master; Fixes random failures
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
  Added missing sync_slave_with_master; Fixes random failures
mysql-test/t/bug47671-master.opt:
  default-character-set -> character-set-server (removes warning in error files for usage of deprecated options)
mysql-test/t/ctype_latin1_de-master.opt:
  default-character-set -> character-set-server (removes warning in error files for usage of deprecated options)
mysql-test/t/ctype_ucs2_def-master.opt:
  default-character-set -> character-set-server (removes warning in error files for usage of deprecated options)
sql-common/client.c:
  Fixed compiler warning
sql/item.cc:
  Renamed function to remove compiler warnings (with gcc)
sql/item.h:
  Renamed function to remove compiler warnings (with gcc)
sql/item_cmpfunc.cc:
  Renamed function to remove compiler warnings (with gcc)
sql/item_create.cc:
  Renamed function to remove compiler warnings (with gcc)
sql/item_create.h:
  Renamed function to remove compiler warnings (with gcc)
sql/item_sum.cc:
  Renamed function to remove compiler warnings (with gcc)
sql/item_sum.h:
  Renamed function to remove compiler warnings (with gcc)
sql/set_var.cc:
  Don't use bit_do_set() / bot_is_set() / bit_do_clear() as this generates compiler warnings
  (They are also of no use as we know the value can hold the bits)
sql/sql_yacc.yy:
  Renamed function to remove compiler warnings (with gcc)
storage/example/ha_example.h:
  Fixed old read_time() prototype
storage/maria/ma_search.c:
  Added extra variables to remove compiler warnings
storage/maria/maria_def.h:
  Added extra variables to remove compiler warnings
storage/myisam/ft_stopwords.c:
  Added cast to get rid of compiler warning
storage/xtradb/fil/fil0fil.c:
  Added cast to get rid of compiler warning
storage/xtradb/include/page0page.h:
  Added const to get rid of compiler warning
storage/xtradb/include/page0page.ic:
  Added const to get rid of compiler warning
support-files/compiler_warnings.supp:
  Added suppression of strict-aliasing
2010-03-28 21:10:00 +03:00
Staale Smedseng
c7fad393fd Bug #49829 Many "hides virtual function" warnings with
SunStudio
      
SunStudio compilers of late warn about methods that might hide
methods in base classes due to the use of overloading combined
with overriding. SunStudio also warns about variables defined
in local socpe or method arguments that have the same name as
a member attribute of the class.
      
This patch renames methods that might hide base class methods,
to make it easier both for humans and compilers to see what is
actually called. It also renames variables in local scope.


sql/field.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/item_cmpfunc.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/item_create.cc:
  Renaming base class create() to create_func().
sql/item_create.h:
  Renaming base class create() to create_func().
sql/protocol.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_profile.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_select.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_yacc.yy:
  Renaming base class create() to create_func().
storage/federated/ha_federated.cc:
  Local scope variable or method argument same as class 
  attribute.
storage/myisammrg/ha_myisammrg.cc:
  Local scope variable or method argument same as class 
  attribute.
2010-03-14 17:01:45 +01:00
unknown
e5099a2c85 merge 5.1->5.2 2010-02-01 08:14:12 +02:00
Michael Widenius
d8ecbbe634 Merge with MySQL 5.1.42
- Marked a couple of tests with --big
- Fixed xtradb/handler/ha_innodb.cc to call explain_filename()

storage/xtradb/handler/ha_innodb.cc:
  Call explain_filename() to get proper names for partitioned tables
2010-01-15 17:27:55 +02:00
Evgeny Potemkin
bc43bff7ed Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
MySQL manual describes values of the YEAR(2) field type as follows:
values 00 - 69 mean 2000 - 2069 years and values 70 - 99 mean 1970 - 1999
years. MIN/MAX and comparison functions was comparing them as int values
thus producing wrong result.

Now the Arg_comparator class is extended with compare_year function which
performs correct comparison of the YEAR type.
The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
correctly calculate its value.
To allow Arg_comparator to use func_name() function for Item_func and Item_sum
objects the func_name declaration is moved to the Item_result_field class.
A helper function is_owner_equal_func is added to the Arg_comparator class.
It checks whether the Arg_comparator object owner is the <=> function or not.
A helper function setup is added to the Item_sum_hybrid class. It sets up
cache item and comparator.

mysql-test/r/func_group.result:
  Added a test case for the bug#43668.
mysql-test/t/func_group.test:
  Added a test case for the bug#43668.
sql/item.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Now Item_cache_int returns the type of cached item.
sql/item.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  To allow Arg_comparator to use func_name() function for Item_func and Item_sum
  objects the func_name declaration is moved to the Item_result_field class.
sql/item_cmpfunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Arg_comparator class is extended with compare_year function which
  performs correct comparison of the YEAR type.
sql/item_cmpfunc.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The year_as_datetime variable is added to the Arg_comparator class.
  It's set to TRUE when YEAR value should be converted to the
  YYYY-00-00 00:00:00 format for correct YEAR-DATETIME comparison.
sql/item_geofunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Item_func_spatial_rel::val_int chenged to use Arg_comparator's string
  buffers.
sql/item_subselect.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Added an implementation of the virtual func_name function.
sql/item_sum.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  A helper function setup is added to the Item_sum_hybrid class. It sets up
  cache item and comparator.
sql/item_sum.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  Added an implementation of the virtual func_name function.
2009-11-17 17:06:46 +03:00
Igor Babaev
f7a75b999b The main commit of Andrey Zhakov's patch introducing vurtual(computed) columns.
The original patch has been ameliorated by Sanja and Igor.
2009-10-16 15:57:48 -07:00
Sergey Petrunia
4102605fba MWL#17: Table elimination
- Moved table elimination code to sql/opt_table_elimination.cc
- Added comments 

.bzrignore:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
libmysqld/Makefile.am:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
sql/CMakeLists.txt:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
sql/Makefile.am:
  MWL#17: Table elimination
  - Moved table elimination code to sql/opt_table_elimination.cc
2009-06-25 14:05:53 +04:00
Sergey Petrunia
fd485ad988 MWL#17: Table elimination
- Make elimination work with aggregate functions. The problem was that aggregate functions 
  reported all table bits in used_tables(), and that prevented table elimination. Fixed by 
  making aggregate functions return more correct value from used_tables(). 

mysql-test/r/ps_11bugs.result:
  MWL#17: Table elimination
  - Update test results. The difference is because of Item_ref change: outer references to constants
    are now recognized as constants, too.
mysql-test/r/subselect.result:
  - Update test results. The difference is because of Item_ref change: outer references to constants
    are now recognized as constants, too.
mysql-test/r/table_elim.result:
  MWL#17: Table elimination
  - Check that elimination works in presense of aggreagate functions
mysql-test/t/table_elim.test:
  MWL#17: Table elimination
  - Check that elimination works in presense of aggreagate functions
sql/item.h:
  MWL#17: Table elimination
  - Add Item_ref::const_item() which calls (*ref)->const_item(). Before this diff Item_ref used the 
    default implementation of const_item(){ return used_tables()==0; }. This is no longer true, as 
    COUNT(*) now has used_tables()==0 but const_item()==FALSE.
sql/item_sum.cc:
  MWL#17: Table elimination
  - Make Item_sum() and it descendants not to return all bits in used_tables(). This is needed 
    because otherwise table elimination can't work in presense of aggregate functions
  - COUNT(*) now has used_tables()==0 and const_item()==FALSE. Had to change 
    Item_ref::const_item() to account for this.
sql/item_sum.h:
  MWL#17: Table elimination
  - Add comments
2009-06-10 01:11:33 +04:00
Georgi Kodinov
979974c53b backported the fix for bug #34773 to 5.0 2008-12-09 20:35:02 +02:00
Georgi Kodinov
89d2b8efb9 Bug#34773: query with explain extended and derived table / other table
crashes server

When creating temporary table that contains aggregate functions a 
non-reversible source transformation was performed to redirect aggregate
function arguments towards temporary table columns.
This caused EXPLAIN EXTENDED to fail because it was trying to resolve
references to the (freed) temporary table.
Fixed by preserving the original aggregate function arguments and
using them (instead of the transformed ones) for EXPLAIN EXTENDED.

mysql-test/r/explain.result:
  Bug#34773: test case
mysql-test/t/explain.test:
  Bug#34773: test case
sql/item.cc:
  Bug#34773: use accessor functions instead of public members
sql/item_sum.cc:
  Bug#34773: 
   - Encapsulate the arguments into Item_sum and
     provide accessor and mutator methods 
   - print the orginal arguments (if present)
     in EXPLAIN EXTENDED
   - preserve the original arguments list.
sql/item_sum.h:
  Bug#34773: 
   - Encapsulate the arguments into Item_sum and
     provide accessor and mutator methods 
   - print the orginal arguments (if present)
     in EXPLAIN EXTENDED
   - preserve the original arguments list.
sql/opt_range.cc:
  Bug#34773: use accessor functions instead of public members
sql/opt_sum.cc:
  Bug#34773: use accessor functions instead of public members
sql/sql_select.cc:
  Bug#34773: use accessor functions instead of public members
2008-10-06 17:17:25 +03:00
unknown
fbbb60ce2f Merge moonbone.local:/work/27219-5.0-opt-mysql
into  moonbone.local:/work/27219-bug-5.1


sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/group_by.result:
  SCCS merged
mysql-test/t/group_by.test:
  SCCS merged
sql/item.cc:
  SCCS merged
sql/sql_lex.h:
  SCCS merged
2008-03-28 18:09:14 +03:00
unknown
9d661efd7f Bug#27219: Aggregate functions in ORDER BY.
Mixing aggregate functions and non-grouping columns is not allowed in the
ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because
of insufficient check.

In order to check more thoroughly the new algorithm employs a list of outer
fields used in a sum function and a SELECT_LEX::full_group_by_flag.
Each non-outer field checked to find out whether it's aggregated or not and
the current select is marked accordingly.
All outer fields that are used under an aggregate function are added to the
Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func
function.


mysql-test/t/group_by.test:
  Added a test case for the bug#27219: Aggregate functions in ORDER BY.
mysql-test/r/group_by.result:
  Added a test case for the bug#27219: Aggregate functions in ORDER BY.
sql/sql_select.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Implementation of new check for mixing non aggregated fields and aggregation
  function in the ONLY_FULL_GROUP_BY mode.
sql/sql_lex.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Initialization of the full_group_by_flag bitmap.
  SELECT_LEX::test_limit function doesn't reset ORDER BY
  clause anymore.
sql/sql_lex.h:
  Bug#27219: Aggregate functions in ORDER BY.
  The full_group_by_flag is added to the SELECT_LEX class.
sql/item_sum.h:
  Bug#27219: Aggregate functions in ORDER BY.
  The outer_fields list is added to the Item_sum class.
sql/mysql_priv.h:
  Bug#27219: Aggregate functions in ORDER BY.
  Defined a set of constants used in the new check for mixing non aggregated
  fields and sum functions in the ONLY_FULL_GROUP_BY_MODE.
sql/item_subselect.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  The Item_in_subselect::select_in_like_transformer function now drops
  ORDER BY clause in all selects in a subquery.
sql/item_sum.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Now the Item_sum::check_sum_func function now checks whether fields in the
  outer_fields list are aggregated or not and marks selects accordingly.
sql/item.cc:
  Bug#27219: Aggregate functions in ORDER BY.
  Now the Item_field::fix_fields function checks whether the field is aggregated
  or not and marks its select_lex accordingly.
2008-03-27 19:49:32 +03:00
unknown
a3e83048a3 Fix for Bug#30217: Views: changes in metadata behaviour
between 5.0 and 5.1.
  
The problem was that in the patch for Bug#11986 it was decided
to store original query in UTF8 encoding for the INFORMATION_SCHEMA.
This approach however turned out to be quite difficult to implement
properly. The main problem is to preserve the same IS-output after
dump/restore.
  
So, the fix is to rollback to the previous functionality, but also
to fix it to support multi-character-set-queries properly. The idea
is to generate INFORMATION_SCHEMA-query from the item-tree after
parsing view declaration. The IS-query should:
  - be completely in UTF8;
  - not contain character set introducers.
  
For more information, see WL4052.


mysql-test/include/ddl_i18n.check_views.inc:
  Add a test case for Bug#30217.
mysql-test/r/ddl_i18n_koi8r.result:
  Update result file.
mysql-test/r/ddl_i18n_utf8.result:
  Update result file.
mysql-test/r/information_schema.result:
  Update result file.
mysql-test/r/information_schema_db.result:
  Update result file.
mysql-test/r/mysqldump.result:
  Update result file.
mysql-test/r/show_check.result:
  Update result file.
mysql-test/t/ddl_i18n_koi8r.test:
  Add a test case for Bug#30217.
mysql-test/t/ddl_i18n_utf8.test:
  Add a test case for Bug#30217.
mysql-test/t/mysqldump.test:
  Add a test case for Bug#30217.
sql/ha_ndbcluster.cc:
  Add a parameter to print().
sql/item.cc:
  1. Add a parameter to print().
  2. Item_string::print():
        - Do not append character set introducer to the text literal
          if we're building a query for INFORMATION_SCHEMA;
        - Convert text literal to UTF8 if we're building a query
          for INFORMATION_SCHEMA.
sql/item.h:
  Add a parameter to print().
sql/item_cmpfunc.cc:
  Add a parameter to print().
sql/item_cmpfunc.h:
  Add a parameter to print().
sql/item_func.cc:
  Add a parameter to print().
sql/item_func.h:
  Add a parameter to print().
sql/item_geofunc.h:
  Add a parameter to print().
sql/item_row.cc:
  Add a parameter to print().
sql/item_row.h:
  Add a parameter to print().
sql/item_strfunc.cc:
  Add a parameter to print().
sql/item_strfunc.h:
  Add a parameter to print().
sql/item_subselect.cc:
  Add a parameter to print().
sql/item_subselect.h:
  Add a parameter to print().
sql/item_sum.cc:
  Add a parameter to print().
sql/item_sum.h:
  Add a parameter to print().
sql/item_timefunc.cc:
  Add a parameter to print().
sql/item_timefunc.h:
  Add a parameter to print().
sql/mysql_priv.h:
  Add a parameter to print().
sql/sp_head.cc:
  Add a parameter to print().
sql/sql_lex.cc:
  Add a parameter to print().
sql/sql_lex.h:
  Add a parameter to print().
sql/sql_parse.cc:
  Add a parameter to print().
sql/sql_select.cc:
  Add a parameter to print().
sql/sql_show.cc:
  Add a parameter to print().
sql/sql_test.cc:
  Add a parameter to print().
sql/sql_view.cc:
  Build INFORMATION_SCHEMA query from Item-tree.
sql/sql_yacc.yy:
  Build INFORMATION_SCHEMA query from Item-tree.
sql/table.h:
  Add a parameter to print().
2008-02-22 13:30:33 +03:00
unknown
a9e05bf758 Merge linux-st28.site:/home/martin/mysql/src/bug32798-united/my50-bug32798-united
into  linux-st28.site:/home/martin/mysql/src/bug32798-united/my51-bug32798-united


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
sql/item_sum.cc:
  Manual merge, Field::cmp has argument type const uchar* in 5.1
sql/item_sum.h:
  manual merge
2007-12-14 12:40:39 +01:00
unknown
0c4b3f5784 Bug#32798: DISTINCT in GROUP_CONCAT clause fails when ordering by a column
with null values

For queries containing GROUP_CONCAT(DISTINCT fields ORDER BY fields), there 
was a limitation that the DISTINCT fields had to be the same as ORDER BY 
fields, owing to the fact that one single sorted tree was used for keeping 
track of tuples, ordering and uniqueness. Fixed by introducing a second 
structure to handle uniqueness so that the original structure has only to 
order the result.


mysql-test/r/func_gconcat.result:
  Bug#32798:
  - Wrong test result turned correct after fix.
  - Correct test result
mysql-test/t/func_gconcat.test:
  Bug#32798: Test case
sql/item_sum.cc:
  Bug#32798: Implementation of fix. Dead code removal.
  
  - removed comment describing this bug
  - replaced body of function group_concat_key_cmp_with_distinct
  - removed function group_concat_key_cmp_with_distinct_and_order
  - Added a Unique object to maintain uniqueness of values.
sql/item_sum.h:
  Bug#32798: Declarations and comments.
2007-12-14 12:24:20 +01:00
unknown
26a2b00498 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt


mysql-test/r/binary.result:
  Auto merged
mysql-test/r/ctype_collate.result:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/t/binary.test:
  Auto merged
mysql-test/t/create.test:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/sql_select.h:
  Auto merged
sql/table.cc:
  Auto merged
storage/myisam/mi_open.c:
  Auto merged
strings/ctype-simple.c:
  Auto merged
mysql-test/r/create.result:
  Manual merge.
mysql-test/r/subselect.result:
  Manual merge.
mysql-test/r/type_enum.result:
  Manual merge.
mysql-test/t/type_enum.test:
  Manual merge.
mysql-test/include/mix1.inc:
  Manual merge.
mysql-test/r/innodb_mysql.result:
  Manual merge.
mysql-test/t/subselect.test:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
storage/myisam/mi_key.c:
  Manual merge.
2007-06-30 20:49:28 -07:00
unknown
c2e961cf2e Bug#27333: subquery grouped for aggregate of outer
query / no aggregate of subquery
 The optimizer counts the aggregate functions that 
 appear as top level expressions (in all_fields) in 
 the current subquery. Later it makes a list of these
 that it uses to actually execute the aggregates in
 end_send_group().
 That count is used in several places as a flag whether
 there are aggregates functions.
 While collecting the above info it must not consider
 aggregates that are not aggregated in the current 
 context. It must treat them as normal expressions 
 instead. Not doing that leads to incorrect data about
 the query, e.g. running a query that actually has no
 aggregate functions as if it has some (and hence is
 expected to return only one row).
 Fixed by ignoring the aggregates that are not aggregated
 in the current context. 
 One other smaller omission discovered and fixed in the 
 process : the place of aggregation was not calculated for
 user defined functions. Fixed by calling 
 Item_sum::init_sum_func_check() and 
 Item_sum::check_sum_func() as it's done for the rest of 
 the aggregate functions.


mysql-test/r/subselect.result:
  Bug #27333: test case
mysql-test/t/subselect.test:
  Bug #27333: test case
sql/item_subselect.cc:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
sql/item_sum.cc:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
sql/item_sum.h:
  Bug#27333: calculate the place of 
   aggregation for user defined functions.
sql/sql_select.cc:
  Bug#27333: When counting the aggregated functions
   and collecting a list of them we must not consider
   the aggregates that are not aggregated in the local
   context as "local" : i.e. we must treat them as 
   normal functions and not add them to the aggregate
   functions list.
sql/sql_select.h:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
2007-06-29 10:39:17 +03:00
unknown
f252f9248a WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c


BitKeeper/etc/ignore:
  added libmysqld/ha_ndbcluster_cond.cc
  ---
  added debian/defs.mk debian/control
client/completion_hash.cc:
  Remove not needed casts
client/my_readline.h:
  Remove some old types
client/mysql.cc:
  Simplify types
client/mysql_upgrade.c:
  Remove some old types
  Update call to dirname_part
client/mysqladmin.cc:
  Remove some old types
client/mysqlbinlog.cc:
  Remove some old types
  Change some buffers to be uchar to avoid casts
client/mysqlcheck.c:
  Remove some old types
client/mysqldump.c:
  Remove some old types
  Remove some not needed casts
  Change some string lengths to size_t
client/mysqlimport.c:
  Remove some old types
client/mysqlshow.c:
  Remove some old types
client/mysqlslap.c:
  Remove some old types
  Remove some not needed casts
client/mysqltest.c:
  Removed some old types
  Removed some not needed casts
  Updated hash-get-key function arguments
  Updated parameters to dirname_part()
client/readline.cc:
  Removed some old types
  Removed some not needed casts
  Changed some string lengths to use size_t
client/sql_string.cc:
  Removed some old types
dbug/dbug.c:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some prototypes to avoid casts
extra/comp_err.c:
  Removed some old types
extra/innochecksum.c:
  Removed some old types
extra/my_print_defaults.c:
  Removed some old types
extra/mysql_waitpid.c:
  Removed some old types
extra/perror.c:
  Removed some old types
extra/replace.c:
  Removed some old types
  Updated parameters to dirname_part()
extra/resolve_stack_dump.c:
  Removed some old types
extra/resolveip.c:
  Removed some old types
include/config-win.h:
  Removed some old types
include/decimal.h:
  Changed binary strings to be uchar* instead of char*
include/ft_global.h:
  Removed some old types
include/hash.h:
  Removed some old types
include/heap.h:
  Removed some old types
  Changed records_under_level to be 'ulong' instead of 'uint' to clarify usage of variable
include/keycache.h:
  Removed some old types
include/m_ctype.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
include/m_string.h:
  Removed some old types
  Changed some string lengths to use size_t
include/my_alloc.h:
  Changed some string lengths to use size_t
include/my_base.h:
  Removed some old types
include/my_dbug.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed db_dump() to take uchar * as argument for memory to reduce number of casts in usage
include/my_getopt.h:
  Removed some old types
include/my_global.h:
  Removed old types:
  my_size_t -> size_t
  byte -> uchar
  gptr -> uchar *
include/my_list.h:
  Removed some old types
include/my_nosys.h:
  Removed some old types
include/my_pthread.h:
  Removed some old types
include/my_sys.h:
  Removed some old types
  Changed MY_FILE_ERROR to be in line with new definitions of my_write()/my_read()
  Changed some string lengths to use size_t
  my_malloc() / my_free() now uses void *
  Updated parameters to dirname_part() & my_uncompress()
include/my_tree.h:
  Removed some old types
include/my_trie.h:
  Removed some old types
include/my_user.h:
  Changed some string lengths to use size_t
include/my_vle.h:
  Removed some old types
include/my_xml.h:
  Removed some old types
  Changed some string lengths to use size_t
include/myisam.h:
  Removed some old types
include/myisammrg.h:
  Removed some old types
include/mysql.h:
  Removed some old types
  Changed byte streams to use uchar* instead of char*
include/mysql_com.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
include/queues.h:
  Removed some old types
include/sql_common.h:
  Removed some old types
include/sslopt-longopts.h:
  Removed some old types
include/violite.h:
  Removed some old types
  Changed some string lengths to use size_t
libmysql/client_settings.h:
  Removed some old types
libmysql/libmysql.c:
  Removed some old types
libmysql/manager.c:
  Removed some old types
libmysqld/emb_qcache.cc:
  Removed some old types
libmysqld/emb_qcache.h:
  Removed some old types
libmysqld/lib_sql.cc:
  Removed some old types
  Removed some not needed casts
  Changed some buffers to be uchar* to avoid casts
  true -> TRUE, false -> FALSE
mysys/array.c:
  Removed some old types
mysys/charset.c:
  Changed some string lengths to use size_t
mysys/checksum.c:
  Include zlib to get definition for crc32
  Removed some old types
mysys/default.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/default_modify.c:
  Changed some string lengths to use size_t
  Removed some not needed casts
mysys/hash.c:
  Removed some old types
  Changed some string lengths to use size_t
  Note: Prototype of hash_key() has changed which may cause problems if client uses hash_init() with a cast for the hash-get-key function.
  hash_element now takes 'ulong' as the index type (cleanup)
mysys/list.c:
  Removed some old types
mysys/mf_cache.c:
  Changed some string lengths to use size_t
mysys/mf_dirname.c:
  Removed some old types
  Changed some string lengths to use size_t
  Added argument to dirname_part() to avoid calculation of length for 'to'
mysys/mf_fn_ext.c:
  Removed some old types
  Updated parameters to dirname_part()
mysys/mf_format.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/mf_getdate.c:
  Removed some old types
mysys/mf_iocache.c:
  Removed some old types
  Changed some string lengths to use size_t
  Changed calculation of 'max_length' to be done the same way in all functions
mysys/mf_iocache2.c:
  Removed some old types
  Changed some string lengths to use size_t
  Clean up comments
  Removed not needed indentation
mysys/mf_keycache.c:
  Removed some old types
mysys/mf_keycaches.c:
  Removed some old types
mysys/mf_loadpath.c:
  Removed some old types
mysys/mf_pack.c:
  Removed some old types
  Changed some string lengths to use size_t
  Removed some not needed casts
  Removed very old VMS code
  Updated parameters to dirname_part()
  Use result of dirnam_part() to remove call to strcat()
mysys/mf_path.c:
  Removed some old types
mysys/mf_radix.c:
  Removed some old types
mysys/mf_same.c:
  Removed some old types
mysys/mf_sort.c:
  Removed some old types
mysys/mf_soundex.c:
  Removed some old types
mysys/mf_strip.c:
  Removed some old types
mysys/mf_tempdir.c:
  Removed some old types
mysys/mf_unixpath.c:
  Removed some old types
mysys/mf_wfile.c:
  Removed some old types
mysys/mulalloc.c:
  Removed some old types
mysys/my_alloc.c:
  Removed some old types
  Changed some string lengths to use size_t
  Use void* as type for allocated memory area
  Removed some not needed casts
  Changed argument 'Size' to 'length' according coding guidelines
mysys/my_chsize.c:
  Changed some buffers to be uchar* to avoid casts
mysys/my_compress.c:
  More comments
  Removed some old types
  Changed string lengths to use size_t
  Changed arguments to my_uncompress() to make them easier to understand
  Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix)
  Changed type of 'pack_data' argument to packfrm() to avoid casts.
mysys/my_conio.c:
  Changed some string lengths to use size_t
mysys/my_create.c:
  Removed some old types
mysys/my_div.c:
  Removed some old types
mysys/my_error.c:
  Removed some old types
mysys/my_fopen.c:
  Removed some old types
mysys/my_fstream.c:
  Removed some old types
  Changed some string lengths to use size_t
  writen -> written
mysys/my_getopt.c:
  Removed some old types
mysys/my_getwd.c:
  Removed some old types
  More comments
mysys/my_init.c:
  Removed some old types
mysys/my_largepage.c:
  Removed some old types
  Changed some string lengths to use size_t
mysys/my_lib.c:
  Removed some old types
mysys/my_lockmem.c:
  Removed some old types
mysys/my_malloc.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed all functions to use size_t
mysys/my_memmem.c:
  Indentation cleanup
mysys/my_once.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
mysys/my_open.c:
  Removed some old types
mysys/my_pread.c:
  Removed some old types
  Changed all functions to use size_t
  Added comment for how my_pread() / my_pwrite() are supposed to work.
  Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe.
  (If we ever would really need this, it should be enabled only with a flag argument)
mysys/my_quick.c:
  Removed some old types
  Changed all functions to use size_t
mysys/my_read.c:
  Removed some old types
  Changed all functions to use size_t
mysys/my_realloc.c:
  Removed some old types
  Use void* as type for allocated memory area
  Changed all functions to use size_t
mysys/my_static.c:
  Removed some old types
mysys/my_static.h:
  Removed some old types
mysys/my_vle.c:
  Removed some old types
mysys/my_wincond.c:
  Removed some old types
mysys/my_windac.c:
  Removed some old types
mysys/my_write.c:
  Removed some old types
  Changed all functions to use size_t
mysys/ptr_cmp.c:
  Removed some old types
  Changed all functions to use size_t
mysys/queues.c:
  Removed some old types
mysys/safemalloc.c:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed all functions to use size_t
mysys/string.c:
  Removed some old types
  Changed all functions to use size_t
mysys/testhash.c:
  Removed some old types
mysys/thr_alarm.c:
  Removed some old types
mysys/thr_lock.c:
  Removed some old types
mysys/tree.c:
  Removed some old types
mysys/trie.c:
  Removed some old types
mysys/typelib.c:
  Removed some old types
plugin/daemon_example/daemon_example.cc:
  Removed some old types
regex/reginit.c:
  Removed some old types
server-tools/instance-manager/buffer.cc:
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/buffer.h:
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/commands.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/instance_map.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed buffer to be of type uchar*
server-tools/instance-manager/instance_options.cc:
  Changed buffer to be of type uchar*
  Replaced alloc_root + strcpy() with strdup_root()
server-tools/instance-manager/mysql_connection.cc:
  Changed buffer to be of type uchar*
server-tools/instance-manager/options.cc:
  Removed some old types
server-tools/instance-manager/parse.cc:
  Changed some string lengths to use size_t
server-tools/instance-manager/parse.h:
  Removed some old types
  Changed some string lengths to use size_t
server-tools/instance-manager/protocol.cc:
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
server-tools/instance-manager/protocol.h:
  Changed some string lengths to use size_t
server-tools/instance-manager/user_map.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/derror.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/discover.cc:
  Changed in readfrm() and writefrom() the type for argument 'frmdata' to uchar** to avoid casts
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
sql/event_data_objects.cc:
  Removed some old types
  Added missing casts for alloc() and sprintf()
sql/event_db_repository.cc:
  Changed some buffers to be uchar* to avoid casts
  Added missing casts for sprintf()
sql/event_queue.cc:
  Removed some old types
sql/field.cc:
  Removed some old types
  Changed memory buffers to be uchar*
  Changed some string lengths to use size_t
  Removed a lot of casts
  Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/field.h:
  Removed some old types
  Changed memory buffers to be uchar* (except of store() as this would have caused too many other changes). 
  Changed some string lengths to use size_t
  Removed some not needed casts
  Changed val_xxx(xxx, new_ptr) to take const pointers
sql/field_conv.cc:
  Removed some old types
  Added casts required because memory area pointers are now uchar*
sql/filesort.cc:
  Initalize variable that was used unitialized in error conditions
sql/gen_lex_hash.cc:
  Removed some old types
  Changed memory buffers to be uchar*
  Changed some string lengths to use size_t
  Removed a lot of casts
  Safety fix in Field_blob::val_decimal() to not access zero pointer
sql/gstream.h:
  Added required cast
sql/ha_ndbcluster.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
  Added required casts
  Removed some not needed casts
sql/ha_ndbcluster.h:
  Removed some old types
sql/ha_ndbcluster_binlog.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Replaced sql_alloc() + memcpy() + set end 0 with sql_strmake()
  Changed some string lengths to use size_t
  Added missing casts for alloc() and sprintf()
sql/ha_ndbcluster_binlog.h:
  Removed some old types
sql/ha_ndbcluster_cond.cc:
  Removed some old types
  Removed some not needed casts
sql/ha_ndbcluster_cond.h:
  Removed some old types
sql/ha_partition.cc:
  Removed some old types
  Changed prototype for change_partition() to avoid casts
sql/ha_partition.h:
  Removed some old types
sql/handler.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/handler.h:
  Removed some old types
  Changed some string lengths to use size_t
  Changed type for 'frmblob' parameter for discover() and ha_discover() to get fewer casts
sql/hash_filo.h:
  Removed some old types
  Changed all functions to use size_t
sql/hostname.cc:
  Removed some old types
sql/item.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Use strmake() instead of memdup() to create a null terminated string.
  Updated calls to new Field()
sql/item.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/item_cmpfunc.h:
  Removed some old types
sql/item_create.cc:
  Removed some old types
sql/item_func.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added test for failing alloc() in init_result_field()
  Remove old confusing comment
  Fixed compiler warning
sql/item_func.h:
  Removed some old types
sql/item_row.cc:
  Removed some old types
sql/item_row.h:
  Removed some old types
sql/item_strfunc.cc:
  Include zlib (needed becasue we call crc32)
  Removed some old types
sql/item_strfunc.h:
  Removed some old types
  Changed some types to match new function prototypes
sql/item_subselect.cc:
  Removed some old types
sql/item_subselect.h:
  Removed some old types
sql/item_sum.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/item_sum.h:
  Removed some old types
sql/item_timefunc.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/item_timefunc.h:
  Removed some old types
sql/item_xmlfunc.cc:
  Changed some string lengths to use size_t
sql/item_xmlfunc.h:
  Removed some old types
sql/key.cc:
  Removed some old types
  Removed some not needed casts
sql/lock.cc:
  Removed some old types
  Added some cast to my_multi_malloc() arguments for safety
sql/log.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Changed usage of pwrite() to not assume it holds the cursor position for the file
  Made usage of my_read() safer
sql/log_event.cc:
  Removed some old types
  Added checking of return value of malloc() in pack_info()
  Changed some buffers to be uchar* to avoid casts
  Removed some 'const' to avoid casts
  Added missing casts for alloc() and sprintf()
  Added required casts
  Removed some not needed casts
  Added some cast to my_multi_malloc() arguments for safety
sql/log_event.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/log_event_old.cc:
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/log_event_old.h:
  Changed some buffers to be uchar* to avoid casts
sql/mf_iocache.cc:
  Removed some old types
sql/my_decimal.cc:
  Changed memory area to use uchar*
sql/my_decimal.h:
  Changed memory area to use uchar*
sql/mysql_priv.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Changed some string lengths to use size_t
  Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid long overflow
  Changed some buffers to be uchar* to avoid casts
sql/mysqld.cc:
  Removed some old types
sql/net_serv.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Ensure that vio_read()/vio_write() return values are stored in a size_t variable
  Removed some not needed casts
sql/opt_range.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/opt_range.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/opt_sum.cc:
  Removed some old types
  Removed some not needed casts
sql/parse_file.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed alloc_root + memcpy + set end 0 -> strmake_root()
sql/parse_file.h:
  Removed some old types
sql/partition_info.cc:
  Removed some old types
  Added missing casts for alloc()
  Changed some buffers to be uchar* to avoid casts
sql/partition_info.h:
  Changed some buffers to be uchar* to avoid casts
sql/protocol.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/protocol.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/records.cc:
  Removed some old types
sql/repl_failsafe.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Added required casts
sql/rpl_filter.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some string lengths to use size_t
sql/rpl_filter.h:
  Changed some string lengths to use size_t
sql/rpl_injector.h:
  Removed some old types
sql/rpl_record.cc:
  Removed some old types
  Removed some not needed casts
  Changed some buffers to be uchar* to avoid casts
sql/rpl_record.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/rpl_record_old.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/rpl_record_old.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid cast
sql/rpl_rli.cc:
  Removed some old types
sql/rpl_tblmap.cc:
  Removed some old types
sql/rpl_tblmap.h:
  Removed some old types
sql/rpl_utility.cc:
  Removed some old types
sql/rpl_utility.h:
  Removed some old types
  Changed type of m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length
sql/set_var.cc:
  Removed some old types
  Updated parameters to dirname_part()
sql/set_var.h:
  Removed some old types
sql/slave.cc:
  Removed some old types
  Changed some string lengths to use size_t
sql/slave.h:
  Removed some old types
sql/sp.cc:
  Removed some old types
  Added missing casts for printf()
sql/sp.h:
  Removed some old types
  Updated hash-get-key function arguments
sql/sp_cache.cc:
  Removed some old types
  Added missing casts for printf()
  Updated hash-get-key function arguments
sql/sp_head.cc:
  Removed some old types
  Added missing casts for alloc() and printf()
  Added required casts
  Updated hash-get-key function arguments
sql/sp_head.h:
  Removed some old types
sql/sp_pcontext.cc:
  Removed some old types
sql/sp_pcontext.h:
  Removed some old types
sql/sql_acl.cc:
  Removed some old types
  Changed some string lengths to use size_t
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added required casts
sql/sql_analyse.cc:
  Changed some buffers to be uchar* to avoid casts
sql/sql_analyse.h:
  Changed some buffers to be uchar* to avoid casts
sql/sql_array.h:
  Removed some old types
sql/sql_base.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_binlog.cc:
  Removed some old types
  Added missing casts for printf()
sql/sql_cache.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Removed some not needed casts
  Changed some string lengths to use size_t
sql/sql_cache.h:
  Removed some old types
  Removed reference to not existing function cache_key()
  Updated hash-get-key function arguments
sql/sql_class.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added missing casts for alloc()
  Updated hash-get-key function arguments
  Moved THD::max_row_length() to table.cc (as it's not depending on THD)
  Removed some not needed casts
sql/sql_class.h:
  Removed some old types
  Changed malloc(), free() and related functions to use void *
  Removed some not needed casts
  Changed some string lengths to use size_t
  Moved max_row_length and max_row_length_blob() to table.cc, as they are not depending on THD
sql/sql_connect.cc:
  Removed some old types
  Added required casts
sql/sql_db.cc:
  Removed some old types
  Removed some not needed casts
  Added some cast to my_multi_malloc() arguments for safety
  Added missing casts for alloc()
sql/sql_delete.cc:
  Removed some old types
sql/sql_handler.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added some cast to my_multi_malloc() arguments for safety
sql/sql_help.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_insert.cc:
  Removed some old types
  Added missing casts for alloc() and printf()
sql/sql_lex.cc:
  Removed some old types
sql/sql_lex.h:
  Removed some old types
  Removed some not needed casts
sql/sql_list.h:
  Removed some old types
  Removed some not needed casts
sql/sql_load.cc:
  Removed some old types
  Removed compiler warning
sql/sql_manager.cc:
  Removed some old types
sql/sql_map.cc:
  Removed some old types
sql/sql_map.h:
  Removed some old types
sql/sql_olap.cc:
  Removed some old types
sql/sql_parse.cc:
  Removed some old types
  Trivial move of code lines to make things more readable
  Changed some string lengths to use size_t
  Added missing casts for alloc()
sql/sql_partition.cc:
  Removed some old types
  Removed compiler warnings about not used functions
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_partition.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/sql_plugin.cc:
  Removed some old types
  Added missing casts for alloc()
  Updated hash-get-key function arguments
sql/sql_prepare.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Added missing casts for alloc() and printf()
sql-common/client.c:
  Removed some old types
  Changed some memory areas to use uchar*
sql-common/my_user.c:
  Changed some string lengths to use size_t
sql-common/pack.c:
  Changed some buffers to be uchar* to avoid casts
sql/sql_repl.cc:
  Added required casts
  Changed some buffers to be uchar* to avoid casts
  Changed some string lengths to use size_t
sql/sql_select.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some old types
sql/sql_select.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
sql/sql_servers.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_show.cc:
  Removed some old types
  Added missing casts for alloc()
  Removed some not needed casts
sql/sql_string.cc:
  Removed some old types
  Added required casts
sql/sql_table.cc:
  Removed some old types
  Removed compiler warning about not used variable
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
sql/sql_test.cc:
  Removed some old types
sql/sql_trigger.cc:
  Removed some old types
  Added missing casts for alloc()
sql/sql_udf.cc:
  Removed some old types
  Updated hash-get-key function arguments
sql/sql_union.cc:
  Removed some old types
sql/sql_update.cc:
  Removed some old types
  Removed some not needed casts
sql/sql_view.cc:
  Removed some old types
sql/sql_yacc.yy:
  Removed some old types
  Changed some string lengths to use size_t
  Added missing casts for alloc()
sql/stacktrace.c:
  Removed some old types
sql/stacktrace.h:
  Removed some old types
sql/structs.h:
  Removed some old types
sql/table.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
  Removed setting of LEX_STRING() arguments in declaration
  Added required casts
  More function comments
  Moved max_row_length() here from sql_class.cc/sql_class.h
sql/table.h:
  Removed some old types
  Changed some string lengths to use size_t
sql/thr_malloc.cc:
  Use void* as type for allocated memory area
  Changed all functions to use size_t
sql/tzfile.h:
  Changed some buffers to be uchar* to avoid casts
sql/tztime.cc:
  Changed some buffers to be uchar* to avoid casts
  Updated hash-get-key function arguments
  Added missing casts for alloc()
  Removed some not needed casts
sql/uniques.cc:
  Removed some old types
  Removed some not needed casts
sql/unireg.cc:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
  Removed some not needed casts
  Added missing casts for alloc()
storage/archive/archive_reader.c:
  Removed some old types
storage/archive/azio.c:
  Removed some old types
  Removed some not needed casts
storage/archive/ha_archive.cc:
  Removed some old types
  Changed type for 'frmblob' in archive_discover() to match handler
  Updated hash-get-key function arguments
  Removed some not needed casts
storage/archive/ha_archive.h:
  Removed some old types
storage/blackhole/ha_blackhole.cc:
  Removed some old types
storage/blackhole/ha_blackhole.h:
  Removed some old types
storage/csv/ha_tina.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Changed some buffers to be uchar* to avoid casts
storage/csv/ha_tina.h:
  Removed some old types
  Removed some not needed casts
storage/csv/transparent_file.cc:
  Removed some old types
  Changed type of 'bytes_read' to be able to detect read errors
  Fixed indentation
storage/csv/transparent_file.h:
  Removed some old types
storage/example/ha_example.cc:
  Removed some old types
  Updated hash-get-key function arguments
storage/example/ha_example.h:
  Removed some old types
storage/federated/ha_federated.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Removed some not needed casts
storage/federated/ha_federated.h:
  Removed some old types
storage/heap/_check.c:
  Changed some buffers to be uchar* to avoid casts
storage/heap/_rectest.c:
  Removed some old types
storage/heap/ha_heap.cc:
  Removed some old types
storage/heap/ha_heap.h:
  Removed some old types
storage/heap/heapdef.h:
  Removed some old types
storage/heap/hp_block.c:
  Removed some old types
  Changed some string lengths to use size_t
storage/heap/hp_clear.c:
  Removed some old types
storage/heap/hp_close.c:
  Removed some old types
storage/heap/hp_create.c:
  Removed some old types
storage/heap/hp_delete.c:
  Removed some old types
storage/heap/hp_hash.c:
  Removed some old types
storage/heap/hp_info.c:
  Removed some old types
storage/heap/hp_open.c:
  Removed some old types
storage/heap/hp_rfirst.c:
  Removed some old types
storage/heap/hp_rkey.c:
  Removed some old types
storage/heap/hp_rlast.c:
  Removed some old types
storage/heap/hp_rnext.c:
  Removed some old types
storage/heap/hp_rprev.c:
  Removed some old types
storage/heap/hp_rrnd.c:
  Removed some old types
storage/heap/hp_rsame.c:
  Removed some old types
storage/heap/hp_scan.c:
  Removed some old types
storage/heap/hp_test1.c:
  Removed some old types
storage/heap/hp_test2.c:
  Removed some old types
storage/heap/hp_update.c:
  Removed some old types
storage/heap/hp_write.c:
  Removed some old types
  Changed some string lengths to use size_t
storage/innobase/handler/ha_innodb.cc:
  Removed some old types
  Updated hash-get-key function arguments
  Added missing casts for alloc() and printf()
  Removed some not needed casts
storage/innobase/handler/ha_innodb.h:
  Removed some old types
storage/myisam/ft_boolean_search.c:
  Removed some old types
storage/myisam/ft_nlq_search.c:
  Removed some old types
storage/myisam/ft_parser.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/ft_static.c:
  Removed some old types
storage/myisam/ft_stopwords.c:
  Removed some old types
storage/myisam/ft_update.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/ftdefs.h:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/fulltext.h:
  Removed some old types
storage/myisam/ha_myisam.cc:
  Removed some old types
storage/myisam/ha_myisam.h:
  Removed some old types
storage/myisam/mi_cache.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_check.c:
  Removed some old types
storage/myisam/mi_checksum.c:
  Removed some old types
storage/myisam/mi_close.c:
  Removed some old types
storage/myisam/mi_create.c:
  Removed some old types
storage/myisam/mi_delete.c:
  Removed some old types
storage/myisam/mi_delete_all.c:
  Removed some old types
storage/myisam/mi_dynrec.c:
  Removed some old types
storage/myisam/mi_extra.c:
  Removed some old types
storage/myisam/mi_key.c:
  Removed some old types
storage/myisam/mi_locking.c:
  Removed some old types
storage/myisam/mi_log.c:
  Removed some old types
storage/myisam/mi_open.c:
  Removed some old types
  Removed some not needed casts
  Check argument of my_write()/my_pwrite() in functions returning int
  Added casting of string lengths to size_t
storage/myisam/mi_packrec.c:
  Removed some old types
  Changed some buffers to be uchar* to avoid casts
storage/myisam/mi_page.c:
  Removed some old types
storage/myisam/mi_preload.c:
  Removed some old types
storage/myisam/mi_range.c:
  Removed some old types
storage/myisam/mi_rfirst.c:
  Removed some old types
storage/myisam/mi_rkey.c:
  Removed some old types
storage/myisam/mi_rlast.c:
  Removed some old types
storage/myisam/mi_rnext.c:
  Removed some old types
storage/myisam/mi_rnext_same.c:
  Removed some old types
storage/myisam/mi_rprev.c:
  Removed some old types
storage/myisam/mi_rrnd.c:
  Removed some old types
storage/myisam/mi_rsame.c:
  Removed some old types
storage/myisam/mi_rsamepos.c:
  Removed some old types
storage/myisam/mi_scan.c:
  Removed some old types
storage/myisam/mi_search.c:
  Removed some old types
storage/myisam/mi_static.c:
  Removed some old types
storage/myisam/mi_statrec.c:
  Removed some old types
storage/myisam/mi_test1.c:
  Removed some old types
storage/myisam/mi_test2.c:
  Removed some old types
storage/myisam/mi_test3.c:
  Removed some old types
storage/myisam/mi_unique.c:
  Removed some old types
storage/myisam/mi_update.c:
  Removed some old types
storage/myisam/mi_write.c:
  Removed some old types
storage/myisam/myisam_ftdump.c:
  Removed some old types
storage/myisam/myisamchk.c:
  Removed some old types
storage/myisam/myisamdef.h:
  Removed some old types
storage/myisam/myisamlog.c:
  Removed some old types
  Indentation fix
storage/myisam/myisampack.c:
  Removed some old types
storage/myisam/rt_index.c:
  Removed some old types
storage/myisam/rt_split.c:
  Removed some old types
storage/myisam/sort.c:
  Removed some old types
storage/myisam/sp_defs.h:
  Removed some old types
storage/myisam/sp_key.c:
  Removed some old types
storage/myisammrg/ha_myisammrg.cc:
  Removed some old types
storage/myisammrg/ha_myisammrg.h:
  Removed some old types
storage/myisammrg/myrg_close.c:
  Removed some old types
storage/myisammrg/myrg_def.h:
  Removed some old types
storage/myisammrg/myrg_delete.c:
  Removed some old types
storage/myisammrg/myrg_open.c:
  Removed some old types
  Updated parameters to dirname_part()
storage/myisammrg/myrg_queue.c:
  Removed some old types
storage/myisammrg/myrg_rfirst.c:
  Removed some old types
storage/myisammrg/myrg_rkey.c:
  Removed some old types
storage/myisammrg/myrg_rlast.c:
  Removed some old types
storage/myisammrg/myrg_rnext.c:
  Removed some old types
storage/myisammrg/myrg_rnext_same.c:
  Removed some old types
storage/myisammrg/myrg_rprev.c:
  Removed some old types
storage/myisammrg/myrg_rrnd.c:
  Removed some old types
storage/myisammrg/myrg_rsame.c:
  Removed some old types
storage/myisammrg/myrg_update.c:
  Removed some old types
storage/myisammrg/myrg_write.c:
  Removed some old types
storage/ndb/include/util/ndb_opts.h:
  Removed some old types
storage/ndb/src/cw/cpcd/main.cpp:
  Removed some old types
storage/ndb/src/kernel/vm/Configuration.cpp:
  Removed some old types
storage/ndb/src/mgmclient/main.cpp:
  Removed some old types
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
  Removed some old types
  Removed old disabled code
storage/ndb/src/mgmsrv/main.cpp:
  Removed some old types
storage/ndb/src/ndbapi/NdbBlob.cpp:
  Removed some old types
storage/ndb/src/ndbapi/NdbOperationDefine.cpp:
  Removed not used variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
  Added required casts
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Added required casts
storage/ndb/tools/delete_all.cpp:
  Removed some old types
storage/ndb/tools/desc.cpp:
  Removed some old types
storage/ndb/tools/drop_index.cpp:
  Removed some old types
storage/ndb/tools/drop_tab.cpp:
  Removed some old types
storage/ndb/tools/listTables.cpp:
  Removed some old types
storage/ndb/tools/ndb_config.cpp:
  Removed some old types
storage/ndb/tools/restore/consumer_restore.cpp:
  Changed some buffers to be uchar* to avoid casts with new defintion of packfrm()
storage/ndb/tools/restore/restore_main.cpp:
  Removed some old types
storage/ndb/tools/select_all.cpp:
  Removed some old types
storage/ndb/tools/select_count.cpp:
  Removed some old types
storage/ndb/tools/waiter.cpp:
  Removed some old types
strings/bchange.c:
  Changed function to use uchar * and size_t
strings/bcmp.c:
  Changed function to use uchar * and size_t
strings/bmove512.c:
  Changed function to use uchar * and size_t
strings/bmove_upp.c:
  Changed function to use uchar * and size_t
strings/ctype-big5.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-bin.c:
  Changed functions to use size_t
strings/ctype-cp932.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-czech.c:
  Fixed indentation
  Changed functions to use size_t
strings/ctype-euc_kr.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-eucjpms.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-gb2312.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-gbk.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-latin1.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-mb.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-simple.c:
  Changed functions to use size_t
  Simpler loops for caseup/casedown
  unsigned int -> uint
  unsigned char -> uchar
strings/ctype-sjis.c:
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-tis620.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-uca.c:
  Changed functions to use size_t
  unsigned char -> uchar
strings/ctype-ucs2.c:
  Moved inclusion of stdarg.h to other includes
  usigned char -> uchar
  Changed functions to use size_t
  Changed character length functions to return uint
strings/ctype-ujis.c:
  Changed functions to use size_t
  Changed character length functions to return uint
  unsigned char -> uchar
strings/ctype-utf8.c:
  Changed functions to use size_t
  unsigned char -> uchar
  Indentation fixes
strings/ctype-win1250ch.c:
  Indentation fixes
  Changed functions to use size_t
strings/ctype.c:
  Changed functions to use size_t
strings/decimal.c:
  Changed type for memory argument to uchar *
strings/do_ctype.c:
  Indentation fixes
strings/my_strtoll10.c:
  unsigned char -> uchar
strings/my_vsnprintf.c:
  Changed functions to use size_t
strings/r_strinstr.c:
  Removed some old types
  Changed functions to use size_t
strings/str_test.c:
  Removed some old types
strings/strappend.c:
  Changed functions to use size_t
strings/strcont.c:
  Removed some old types
strings/strfill.c:
  Removed some old types
strings/strinstr.c:
  Changed functions to use size_t
strings/strlen.c:
  Changed functions to use size_t
strings/strmake.c:
  Changed functions to use size_t
strings/strnlen.c:
  Changed functions to use size_t
strings/strnmov.c:
  Changed functions to use size_t
strings/strto.c:
  unsigned char -> uchar
strings/strtod.c:
  Changed functions to use size_t
strings/strxnmov.c:
  Changed functions to use size_t
strings/xml.c:
  Changed functions to use size_t
  Indentation fixes
tests/mysql_client_test.c:
  Removed some old types
tests/thread_test.c:
  Removed some old types
vio/test-ssl.c:
  Removed some old types
vio/test-sslclient.c:
  Removed some old types
vio/test-sslserver.c:
  Removed some old types
vio/vio.c:
  Removed some old types
vio/vio_priv.h:
  Removed some old types
  Changed vio_read()/vio_write() to work with size_t
vio/viosocket.c:
  Changed vio_read()/vio_write() to work with size_t
  Indentation fixes
vio/viossl.c:
  Changed vio_read()/vio_write() to work with size_t
  Indentation fixes
vio/viosslfactories.c:
  Removed some old types
vio/viotest-ssl.c:
  Removed some old types
win/README:
  More explanations
2007-05-10 12:59:39 +03:00
unknown
9887430fc0 Merge magare.gmz:/home/kgeorge/mysql/work/WL3527-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/WL3527-5.1-opt


mysql-test/r/gis.result:
  Auto merged
mysql-test/t/gis.test:
  Auto merged
sql/field.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/subselect.result:
  merge 5.0-opt -> 5.1-opt
mysql-test/t/subselect.test:
  merge 5.0-opt -> 5.1-opt
sql/sql_base.cc:
  merge 5.0-opt -> 5.1-opt
2007-03-26 17:03:57 +03:00
unknown
1f8bdbe4eb Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Ensured correct setting of the depended_from field in references
generated for set functions aggregated in outer selects.
A wrong value of this field resulted in wrong maps returned by 
used_tables() for these references.
Made sure that a temporary table field is added for any set function
aggregated in outer context when creation of a temporary table is 
needed to execute the inner subquery. 


mysql-test/r/subselect.result:
  Added a test case for bug #27229.
mysql-test/t/subselect.test:
  Added a test case for bug #27229.
sql/item.cc:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Ensured correct setting of the depended_from field in references
  generated for set functions aggregated in outer selects.
sql/item_sum.cc:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Added the field aggr_sel to the objects of the class Item_sum.
  In any Item_sum object created for a set function this field 
  has to contain a pointer to the select where the set function
  is aggregated.
sql/item_sum.h:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Added the field aggr_sel to the objects of the class Item_sum.
  In any Item_sum object created for a set function this field 
  has to contain a pointer to the select where the set function
  is aggregated.
  Added a method that says whether a set function is aggregated
  in outer context and, if so, returns the aggregating select.
  Removed the field nest_level_tables_count introduced by the
  patch for bug 24484 as aggr_sel->join->tables contains the
  sane number.
sql/sql_base.cc:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Added the field aggr_sel to the objects of the class Item_sum.
  Removed changes introduced by the patch for bug 24484 as 
  the field leaf_count of the THD class is not used anymore.
sql/sql_class.h:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Added the field aggr_sel to the objects of the class Item_sum.
  Removed changes introduce by the patch for bug 24484 as 
  the field leaf_count of the THD class is not used anymore.
sql/sql_insert.cc:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  Added the field aggr_sel to the objects of the class Item_sum.
  Removed changes introduce by the patch for bug 24484 as 
  the field leaf_count of the THD class is not used anymore.
sql/sql_select.cc:
  Fixed bug #27229: crash when a set function aggregated in outer
  context was used as an argument of GROUP_CONCAT.
  When creating a temporary table a field is added in it for any 
  set function aggregated in outer context.
2007-03-22 14:48:03 -07:00
unknown
941f2fb956 Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt


mysql-test/r/subselect3.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/t/union.test:
  Auto merged
sql/item.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/subselect.result:
  merging
mysql-test/t/subselect.test:
  merging
sql/sql_base.cc:
  mergin
sql/sql_class.h:
  merging
sql/sql_select.cc:
  merging
2007-03-22 11:43:23 +04:00
unknown
9c89dd654e Bug #24484:
To correctly decide which predicates can be evaluated with a given table
the optimizer must know the exact set of tables that a predicate depends 
on. If that mask is too wide (refer to non-existing tables) the optimizer
can erroneously skip a predicate.
One such case of wrong table usage mask were the aggregate functions.
The have a all-1 mask (meaning depend on all tables, including non-existent
ones).
Fixed by making a real used_tables mask for the aggregates. The mask is
constructed in the following way :
1. OR the table dependency masks of all the arguments of the aggregate.
2. If all the arguments of the function are from the local name resolution 
  context and it is evaluated in the same name resolution
  context where it is referenced all the tables from that name resolution 
  context are OR-ed to the dependency mask. This is to denote that an
  aggregate function depends on the number of rows it processes.
3. Handle correctly the case of an aggregate function optimization (such that
  the aggregate function can be pre-calculated and made a constant).

Made sure that an aggregate function is never a constant (unless subject of a 
specific optimization and pre-calculation).  

One other flaw was revealed and fixed in the process : references were 
not calling the recalculation method for used_tables of their targets.


mysql-test/r/subselect3.result:
  Bug #24484: test case
mysql-test/t/subselect3.test:
  Bug #24484: test case
sql/item.h:
  Bug #24484: Item_ref must update the used tables.
sql/item_sum.cc:
  Bug #24484: correct calculation of used_tables for aggregates.
sql/item_sum.h:
  Bug #24484: correct calculation of used_tables for aggregates.
sql/opt_range.cc:
  Bug #24484: fixed ref resolution in loose index scan
sql/sql_base.cc:
  Bug #24484: moved counting of leaf tables inside 
  setup_tables_and_check_access.
sql/sql_class.h:
  Bug #24484: changed table count to more narrow type.
sql/sql_insert.cc:
  Bug #24484: moved counting of leaf tables inside 
  setup_tables_and_check_access. Substract the first
  table (and its subtables) of an INSERT statement
  from leaf_count.
sql/sql_select.cc:
  Bug #24484: correct check for aggregates
2007-03-20 19:46:02 +02:00
unknown
61430c77a4 Merge siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/51
into  siva.hindu.god:/home/tsmith/m/bk/mrg-jan17/maint/51


BUILD/check-cpu:
  Auto merged
configure.in:
  Auto merged
include/my_global.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/r/type_enum.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/mysqladmin.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/type_enum.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
mysys/my_read.c:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
server-tools/instance-manager/Makefile.am:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/federated/ha_federated.cc:
  Auto merged
server-tools/instance-manager/instance.cc:
  Use remote (global 5.1 version)
sql/unireg.cc:
  Use remote (5.1 global version)
mysql-test/t/trigger.test:
  Manual merge
server-tools/instance-manager/guardian.cc:
  Manual merge
2007-01-18 08:30:35 -07:00
unknown
8f5e92e052 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-22687


libmysqld/Makefile.am:
  Auto merged
sql/Makefile.am:
  Auto merged
BitKeeper/deleted/.del-item_uniq.cc:
  Auto merged
BitKeeper/deleted/.del-item_uniq.h:
  Auto merged
sql/item.h:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/lex.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2007-01-12 08:11:52 -07:00