An error occurred fetching the project authors.
  1. 22 Oct, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #874378. · fdf789a7
      Igor Babaev authored
      This bug happened for the queries over multi-table mergeable views
      because the bitmap TABLE::read_set of the underlying tables were not
      updated after the views had been merged into the query.
      Now this bitmaps are updated properly.
      Also the bitmap TABLE::merge_keys now is updated in prevention of
      future bugs.
      fdf789a7
  2. 20 Oct, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #877316. · 945f12cf
      Igor Babaev authored
      This bug happened due to incompleteness of the fix for bug 872735:
      the occurrences of the fields in the conditions of correlated
      subqueries were not taken into account when recalculating
      covering keys bit maps.
      945f12cf
  3. 29 Sep, 2011 1 commit
  4. 20 Sep, 2011 1 commit
  5. 13 Sep, 2011 1 commit
  6. 08 Sep, 2011 1 commit
  7. 06 Sep, 2011 1 commit
    • Sergey Petrunya's avatar
      BUG#823930: Wrong result with semijoin materialization and blob fields · fc6b6435
      Sergey Petrunya authored
      - Make subquery_types_allow_materialization() detect a case where 
        create_tmp_table() would create a blob column which would make it 
        impossible to use materialization
        Non-semi-join materialization worked because it detected that this case
        and felt back to use IN->EXISTS. Semi-join Materialization cannot easily
        fallback, so we have to detect this case early.
      fc6b6435
  8. 19 Jul, 2011 1 commit
    • unknown's avatar
      Fixed LP BUG#800696. · 99cce189
      unknown authored
      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.
      99cce189
  9. 09 Jul, 2011 1 commit
  10. 08 Jul, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #806510. · 5ead4083
      Igor Babaev authored
      The bug was caused by an incorrect code of the function
      Item_direct_view_ref::replace_equal_field introduced in the
      patch for bugs 717577, 724942. The function erroneously
      returned the wrapped field instead of the Item_direct_view_ref
      object itself in the cases when no replacement happened.
      
      The bug masked two other minor bugs that could result in not
      quite correct output of the EXPLAIN command for some queries.
      They were fixed in the patch as well.
       
      5ead4083
  11. 03 Jul, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #804686. · 3f7d51d0
      Igor Babaev authored
      The assert conditions in the functions Item_direct_ref_to_ident::transform
      and Item_direct_ref_to_ident::compile could be not valid after constant
      propagation when fields and field references may be substituted for constants.
      Not only these invalid asserts have been removed, but the functions containing
      them have been removed as well because now Item_ref::transform and 
      Item_ref::compile can be used instead of them.
      3f7d51d0
  12. 09 Jun, 2011 1 commit
    • Sergei Golubchik's avatar
      bugfixes: · c3f665dc
      Sergei Golubchik authored
        microsecond(TIME)
        alter table datetime<->datetime(6)
        max(TIME), mix(TIME) 
      
      mysql-test/t/func_if.test:
        fix the test case of avoid overflow
      sql/field.cc:
        don't use make_date() and make_time()
      sql/field.h:
        correct eq_def() for temporal fields
      sql/item.cc:
        move datetime caching from Item_cache_int
        to Item_cache_temporal
      sql/item.h:
        move datetime caching from Item_cache_int
        to Item_cache_temporal
      sql/item_func.cc:
        use existing helper methods, don't duplicate
      sql/item_sum.cc:
        argument cache must use argument's cmp_type, not result_type.
      sql/item_timefunc.cc:
        use existing methods, don't tuplicate.
        remove unused function.
        fix micorseconds() to support TIME argument
      sql/mysql_priv.h:
        dead code
      sql/time.cc:
        dead code
      c3f665dc
  13. 06 Jun, 2011 1 commit
    • Sergei Golubchik's avatar
      revert a suggested "optimization" that introduced a bug · 4d128777
      Sergei Golubchik authored
      compilation error in mysys/my_getsystime.c fixed
      some redundant code removed
      sec_to_time, time_to_sec, from_unixtime, unix_timestamp, @@timestamp now
        use decimal, not double for numbers with a fractional part.
      purge_master_logs_before_date() fixed
      many bugs in corner cases fixed
      
      mysys/my_getsystime.c:
        compilation failure fixed
      sql/sql_parse.cc:
        don't cut corners. it backfires.
      4d128777
  14. 26 May, 2011 1 commit
  15. 21 May, 2011 1 commit
  16. 20 May, 2011 2 commits
    • Igor Babaev's avatar
      Fixed a compiler problem. · aabb172f
      Igor Babaev authored
      aabb172f
    • Igor Babaev's avatar
      Fixed LP bug #777745. · 016a09cb
      Igor Babaev authored
      Fields belonging to views in general cannot be substituted for 
      equal items, in particular for constants, because all references
      to a view field refer to the same Item_field object while they 
      could be used in different OR parts of the where condition and
      belong to different equivalence classes (to different Item_equals).
      That's why substitution for equal items in any context is allowed
      only in place of Item_direct_view_ref objects, but not in place of
      Item_fields these objects refer to.
      Due to some erroneous code in the patch for bug 717577 substitution
      for view fields were allowed in some context.This could lead
      to wrong results returned by queries using views.
      
      The fix prohibits substitution of view fields for equal items 
      in any context.
      
      The patch also changes slightly the compile method for the Item_func
      class. Now if the analyze method returns NULL in his parameter the
      compile method is not called for the arguments of the function
      at all. A similar change was made for the Item_ref class.     
      016a09cb
  17. 19 May, 2011 5 commits
    • Igor Babaev's avatar
      Fixed compiler warnings. · 98f2be08
      Igor Babaev authored
      98f2be08
    • Vladislav Vaintroub's avatar
      Fix warnings · 579f6443
      Vladislav Vaintroub authored
      579f6443
    • Sergei Golubchik's avatar
      post review changes 2 · f06cac33
      Sergei Golubchik authored
      sql/event_parse_data.cc:
        don't use "not_used" variable
      sql/item_timefunc.cc:
        Item_temporal_func::fix_length_and_dec()
        and other changes
      sql/item_timefunc.h:
        introducing Item_timefunc::fix_length_and_dec()
      sql/share/errmsg.txt:
        don't say "column X" in the error message that used not only for columns
      f06cac33
    • Sergei Golubchik's avatar
      post-review changes 1 · 8ddcd0cd
      Sergei Golubchik authored
      include/my_time.h:
        remove duplicate defines.
        cast to ulonglong to avoid overflow
      sql/field.cc:
        perform sign extension when reading packed TIME values
      sql/item_cmpfunc.cc:
        when converting a string to a date for the purpose of comparing it with another date,
        we should ignore strict sql mode.
      sql/item_timefunc.cc:
        better error message
      sql/item_timefunc.h:
        limit decimals appropriately
      sql/share/errmsg.txt:
        don't refer to an object as a "column" in error messages that are used not only for columns.
      8ddcd0cd
    • Igor Babaev's avatar
      Fixed LP bug #784848 that caused failures of func_str.test and · 6d2da324
      Igor Babaev authored
      derived_view.test.
      Do not register Item_ref objects of the type VIEW_REF as outer
      references.
      6d2da324
  18. 18 May, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bug #784281. · 1018c901
      Igor Babaev authored
      When a view is merged into a select all the depended_from fields
      pointing to the select of the view should have been corrected to
      point to the select where the view is used. It was not done yet.
      This could lead to wrong results returned by queries such as
      one from the test case for bug 33389.
      Correction of outer references required walking through all items
      of the proccesed qurery. To avoid this the following solution was
      implemented.
      Each select now contains a pointer to the select it is merged into
      (if there is any). Such pointers allow to get the corrected value
      of depended_from on the fly. The function Item_ident::get_depended_from
      was introduced for this purpose.
      1018c901
  19. 17 May, 2011 1 commit
    • Michael Widenius's avatar
      Removed some alias warnings · 0da2df24
      Michael Widenius authored
      Fixed alias bug when compiling with gcc 4.2.4 that caused subselect.test to fail
      
      sql/item.cc:
        Removed alias warnings by changing type from char * to const char*
      sql/item.h:
        Removed alias warnings by changing type from char * to const char*
      sql/item_subselect.cc:
        Fixed alias bug when compiling with gcc 4.2.4 that caused subselect.test to fail
      sql/sql_string.h:
        Removed alias warnings by changing type from char * to const char*
      storage/heap/hp_test2.c:
        Removed SAFEMALLOC to get rid of compiler error
        Fixed test case as we can't anymore use heap_rlast() on a HASH key entry.
      0da2df24
  20. 10 May, 2011 1 commit
    • Michael Widenius's avatar
      Fixed all reported bugs for dynamic columns. · 052d1bfb
      Michael Widenius authored
      Bugs fixed:
      - Added automatic detection of unsigned arguments to COLUMN_CREATE()
      - If string length is not know for COLUMN_GET() use MAX_DYNAMIC_COLUMN_LENGTH instead of MAX_FIELD_BLOBLENGTH
      - null_value flag was not propery reset for COLUMN_LIST() and COLUMN_CREATE() which could lead to crashes later:
      - lp:778905 Assertion `value->year <= 9999' failed in dynamic_column_date_store
      - lp:778912 Assertion `field_pos < field_count' failed in Protocol_text::store in maria-5.3-mwl34
      
      include/ma_dyncol.h:
        Added define for max dynamic column length.
      mysql-test/r/cast.result:
        Added test of cast big unsigned int to signed (this test case was missing)
      mysql-test/r/dyncol.result:
        Added tests from reported bugs
        Added testing of automatic store of signed/unsigned integers
      mysql-test/t/cast.test:
        Added test of cast big unsigned int to signed (this test case was missing)
      mysql-test/t/dyncol.test:
        Added tests from reported bugs
        Added testing of automatic store of signed/unsigned integers
      sql/item.cc:
        Added assert to catch cases where null_value is not set properly
      sql/item_strfunc.cc:
        Added automatic detection of unsigned arguments to COLUMN_CREATE()
        COLUMN_GET() returned wrong value for illegal strings which lead to assert later
        null_value flag was not propery reset for COLUMN_LIST() and COLUMN_CREATE() which could lead to crashes later.
      sql/item_strfunc.h:
        If string length is not know for COLUMN_GET() use MAX_DYNAMIC_COLUMN_LENGTH
      052d1bfb
  21. 08 May, 2011 1 commit
    • Michael Widenius's avatar
      Adding support for Dynamic columns (WL#34): · 5ab92b1f
      Michael Widenius authored
      - COLUMN_CREATE(column_nr, value, [column_nr,value]...)
      - COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
      - COLUMN_DELETE(blob, column_nr, column_nr...)
      - COLUMN_EXISTS(blob, column_nr)
      - COLUMN_LIST(blob, column_nr)
      - COLUMN_GET(string, column_nr AS type)
      
      Added cast(X as DOUBLE) and cast(x as INT)
      Better warning and error messages for wrong cast's
      Created some sub functions to simplify and reuse code.
      Added a lot of conversation functions with error/warnings for what went wrong.
      Fixed some issues when casting time to datetime.
      Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
      Added dynamic columns library to libmysqlclient
      
      
      include/Makefile.am:
        Added ma_dyncol.h
      include/decimal.h:
        Added 'const' to arguments for some functions.
      include/my_sys.h:
        Added dynstr_reassociate()
      include/my_time.h:
        Added TIME_SUBSECOND_RANGE
        Added double_to_datetime()
        Added flag argument to str_to_time()
      libmysql/CMakeLists.txt:
        Added mysys/ma_dyncol.c
      libmysql/Makefile.shared:
        Added ma_dyncol
      libmysql/libmysql.c:
        Added argument to str_to_time()
      mysql-test/r/bigint.result:
        Better error messages
      mysql-test/r/cast.result:
        Better warning and error messages
        A lot of new cast() tests
      mysql-test/r/func_math.result:
        Better warning messages
      mysql-test/r/func_str.result:
        Better warning messages
      mysql-test/r/func_time.result:
        Better warning messages
      mysql-test/r/sp-vars.result:
        Better warning messages
      mysql-test/r/strict.result:
        Better warning messages
        New test result
      mysql-test/r/type_newdecimal.result:
        Better warning messages
      mysql-test/r/warnings.result:
        Better warning messages
      mysql-test/suite/funcs_1/r/innodb_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/funcs_1/r/memory_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/funcs_1/r/myisam_func_view.result:
        Updated results after better cast warnings
      mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/r/rpl_partition.result:
        Added begin...commit to speed up test.
      mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
        Removed duplicated --big_test
      mysql-test/suite/parts/t/rpl_partition.test:
        Added begin...commit to speed up test.
      mysql-test/suite/pbxt/r/cast.result:
        Updated results after better cast warnings
      mysql-test/suite/pbxt/r/func_str.result:
        Updated results after better cast warnings
      mysql-test/suite/pbxt/r/type_newdecimal.result:
        Updated results after better cast warnings
      mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
        Added begin...commit to speed up test.
      mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
        Added begin...commit to speed up test.
      mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
        More warnings
      mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
        More warnings
      mysql-test/t/cast.test:
        A lot of new cast() tests
      mysql-test/t/strict.test:
        Added new test
      mysys/CMakeLists.txt:
        Added ma_dyncol.c
      mysys/Makefile.am:
        Added ma_dyncol.c
      mysys/string.c:
        Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
      sql-common/my_time.c:
        Added 'fuzzydate' flag to str_to_time()
        Added support for microseconds to my_time_to_str() and my_datetime_to_str()
        Reset second_parts in number_to_datetime()
        Added double_to_datetime()
      sql/field.cc:
        Added double_to_longlong() and truncate_double() to simplify and reuse code
      sql/field.h:
        New prototypes
      sql/item.cc:
        Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
        (Needed to make it microsecond safe and get better warnings).
        Updated call to str_to_time_with_warn()
      sql/item.h:
        Added struct st_dyncall_create_def used by dynamic columns
        Added virtual bool dynamic_result() to tell if type of argument may change over calls.
      sql/item_cmpfunc.cc:
        Added Item_func_dyncol_exists()
      sql/item_cmpfunc.h:
        Added class Item_func_dyncol_exists
      sql/item_create.cc:
        Added get_length_and_scale() to simplify other functions
        Simplified and extended create_func_cast()
        Added support for cast(X as double(X,Y))
        Added functions to create dynamic column functions.
      sql/item_create.h:
        Added prototypes
      sql/item_func.cc:
        Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
        Added Item_double_typecast()
      sql/item_func.h:
        Added class Item_double_typecast()
      sql/item_strfunc.cc:
        Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
      sql/item_strfunc.h:
        Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
      sql/item_timefunc.cc:
        Added flag argument to str_to_time_with_warn()
        Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
        Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
      sql/item_timefunc.h:
        Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
      sql/lex.h:
        Added new SQL function names
      sql/my_decimal.cc:
        Added 'const' to some arguments.
        Better error message in case of errors (we now print out the wrong value)
        Added my_decimal2int()
      sql/my_decimal.h:
        Moved some constants to my_decimal_limits.h
        Updated prototypes.
        Made my_decimal2int() a function as it's rather long (no reason to have it inline)
        Added decimal2my_decimal() function.
      sql/mysql_priv.h:
        Prototypes for new functions
      sql/share/errmsg.txt:
        New error messages for wrong casts and dynamic columns
      sql/sql_acl.cc:
        Fixed indentation
      sql/sql_base.cc:
        Added dynamic_column_error_message()
      sql/sql_string.h:
        Added reassociate() to move a buffer to be owned by String object.
      sql/sql_yacc.yy:
        Added syntax for COLUMN_ functions.
      sql/time.cc:
        Updated str_to_datetime_with_warn() flag argument to same type as other functions
        Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
        Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
      strings/decimal.c:
        Added 'const' to arguments for some functions.
      unittest/mysys/Makefile.am:
        Added test for dynamic columns code
      5ab92b1f
  22. 27 Apr, 2011 1 commit
    • Igor Babaev's avatar
      Fixed LP bugs #717577, #724942. · 8d9dd21d
      Igor Babaev authored
      Both these two bugs happened due to the following problem.
      When a view column is referenced in the query an Item_direct_view_ref
      object is created that is refers to the Item_field for the column.
      All references to the same view column refer to the same Item_field.
      Different references can belong to different AND/OR levels and,
      as a result, can be included in different Item_equal object.
      These Item_equal objects may include different constant objects.
      If these constant objects are substituted for the Item_field created
      for a view column we have a conflict situation when the second
      substitution annuls the first substitution. This leads to
      wrong result sets returned by the query. Bug #724942 demonstrates
      such an erroneous behaviour.
      Test case of the bug #717577 produces wrong result sets because best
      equal fields of the multiple equalities built for different OR levels
      of the WHERE condition differs. The subsitution for the best equal field
      in the second OR branch overwrites the the substitution made for the
      first branch.
      
      To avoid such conflicts we have to substitute for the references
      to the view columns rather than for the underlying field items.
      To make such substitutions possible we have to include into
      multiple equalities references to view columns rather than 
      field items created for such columns.
      
      This patch modifies the Item_equal class to include references
      to view columns into multiple equality objects. It also performs
      a clean up of the class methods and adds more comments. The methods
      of the Item_direct_view_ref class that assist substitutions for
      references to view columns has been also added by this patch.
      8d9dd21d
  23. 18 Apr, 2011 1 commit
  24. 08 Apr, 2011 1 commit
    • Gleb Shchepa's avatar
      Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY · a77bc598
      Gleb Shchepa authored
      Select from a view with the underlying HAVING clause failed with a
      message: "1356: View '...' references invalid table(s) or column(s)
      or function(s) or definer/invoker of view lack rights to use them"
      
      The bug is a regression of the fix for bug 11750328 - 40825 (similar
      case, but the HAVING cause references an aliased field).
      In the old fix for bug 40825 the Item_field::name_length value has
      been used in place of the real length of Item_field::name. However,
      in some cases Item_field::name_length is not in sync with the
      actual name length (TODO: combine name and name_length into a
      solid String field).
      
      The Item_ref::print() method has been modified to calculate actual
      name length every time.
      
      
      mysql-test/r/view.result:
        Test case for bug #11829681
      mysql-test/t/view.test:
        Test case for bug #11829681
      sql/item.cc:
        Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
        
        The Item_ref::print() method has been modified to calculate actual
        name length every time.
      sql/item.h:
        Minor commentary.
      a77bc598
  25. 31 Mar, 2011 3 commits
    • Gleb Shchepa's avatar
      Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS · 7aa81e2a
      Gleb Shchepa authored
      In the string context the MIN() and MAX() functions don't take
      into account the unsignedness of the UNSIGNED BIGINT argument
      column.
      
      I.e.:
              CREATE TABLE t1 (a BIGINT UNSIGNED);
              INSERT INTO t1 VALUES (18446668621106209655);
              SELECT CONCAT(MAX(a)) FROM t1;
      
      returns -75452603341961.
      
      
      mysql-test/r/func_group.result:
        Test case for bug #11766094.
      mysql-test/t/func_group.test:
        Test case for bug #11766094.
      sql/item.cc:
        Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
        
        The Item_cache_int::val_str() method has been modified to
        take into account the unsigned_flag value when converting
        data to string.
      7aa81e2a
    • Michael Widenius's avatar
      Fixed unlikely reference to freed memory in item->print(). · fc595325
      Michael Widenius authored
      sql/item.cc:
        If a item_ref is referenced by name, we have to reset it's ref in item_ref::cleanup() as the reference may be to a memory that is freed.
        This happens at least when you have 'HAVING MAX()' in a sub query and you execute 'cond_having->print()' which tries to access items before fix fields.
      sql/item.h:
        Added 'reference_trough_name' as a marker for Item_ref that needs to have ref reset during cleanup
      fc595325
    • Michael Widenius's avatar
      Fixed all BUILD scripts to use g++ instead of gcc for linking · 1ee94dc2
      Michael Widenius authored
      Fixed memory leak from HEAP tables that was not deleted properly
      
      
      BUILD/compile-alpha-ccc:
        Use g++ instead of gcc for linking
      BUILD/compile-alpha-debug:
        Use g++ instead of gcc for linking
      BUILD/compile-pentium-pgcc:
        Use g++ instead of gcc for linking
      BUILD/compile-solaris-sparc:
        Use g++ instead of gcc for linking
      BUILD/compile-solaris-sparc-debug:
        Use g++ instead of gcc for linking
      BUILD/compile-solaris-sparc-purify:
        Use g++ instead of gcc for linking
      sql/item.cc:
        Safety fixes for expr_cache
        Call Item_result:field::cleanup() in Item_cache_wrapper::cleanup()
        More DBUG_PRINT
      sql/sql_base.cc:
        Simple optimization for setup_wild
        More DBUG_PRINT
      sql/sql_expression_cache.cc:
        Added header
        Removed not needed initialization
      sql/sql_lex.cc:
        More DBUG_PRINT
      sql/sql_select.cc:
        More DBUG_PRINT
        Fixed memory leak from HEAP tables that was not deleted properly
      storage/heap/hp_create.c:
        More DBUG_PRINT
      1ee94dc2
  26. 30 Mar, 2011 1 commit
  27. 24 Mar, 2011 2 commits
    • Sergei Golubchik's avatar
      fixes for funcs_1 suite · c41b66c0
      Sergei Golubchik authored
      c41b66c0
    • unknown's avatar
      Fix LP BUG#715738 · ec239491
      unknown authored
      Analysis:
      A query with implicit grouping is one with aggregate functions and
      no GROUP BY clause. MariaDB inherits from MySQL an SQL extenstion
      that allows mixing aggregate functions with non-aggregate fields.
      If a query with such mixed select clause produces an empty result
      set, the meaning of aggregate functions is well defined - either
      NULL (MIN, MAX, etc.), or 0 (count(*)). However the non-aggregated
      fields must also have some value, and the only reasonable value in
      the case of empty result is NULL.
      
      The cause of the many wrong results was that if a field is declared
      as non-nullable (e.g. because it is a PK or NOT NULL), the semantic
      analysis and the optimization phases treat this field as non-nullable,
      and generate all related query plan elements based on this assumption.
      
      Later during execution, these incorrectly configured/generated query
      plan elements result in a wrong result because the selected fields
      are not null due to the not-null assumption during optimization.
      
      Solution:
      Detect before the context analysys phase that a query uses implicit
      grouping with mixed aggregates/non-aggregates, and set all fields
      as nullable. The parser already walks the SELECT clause, and
      already sets Item::with_sum_func for Items that reference aggreagate
      functions. The patch adds a symmetric Item::with_field so that all
      Items that reference an Item_field are marked during their
      construction at parse time in the same way as with aggregate function
      use.
      ec239491
  28. 23 Mar, 2011 2 commits
  29. 17 Mar, 2011 2 commits
  30. 15 Mar, 2011 1 commit
    • Dmitry Shulga's avatar
      Fixed Bug#11764168 "56976: SEVERE DENIAL OF SERVICE IN PREPARED STATEMENTS". · 9320dca9
      Dmitry Shulga authored
      The problem was that server didn't check resulting size of prepared
      statement argument which was set using mysql_send_long_data() API.
      By calling mysql_send_long_data() several times it was possible
      to create overly big string and thus force server to allocate
      memory for it. There was no way to limit this allocation.
      
      The solution is to add check for size of result string against
      value of max_long_data_size start-up parameter. When intermediate
      string exceeds max_long_data_size value an appropriate error message
      is emitted.
      
      We can't use existing max_allowed_packet parameter for this purpose
      since its value is limited by 1GB and therefore using it as a limit
      for data set through mysql_send_long_data() API would have been an
      incompatible change. Newly introduced max_long_data_size parameter
      gets value from max_allowed_packet parameter unless its value is
      specified explicitly. This new parameter is marked as deprecated
      and will be eventually replaced by max_allowed_packet parameter.
      Value of max_long_data_size parameter can be set only at server
      startup.
      
      
      mysql-test/t/variables.test:
        Added checking for new start-up parameter max_long_data_size.
      sql/item.cc:
        Added call to my_message() when accumulated string exceeds
        max_long_data_size value. my_message() calls error handler
        that was installed in mysql_stmt_get_longdata before call
        to Item_param::set_longdata.
        
        The error handler then sets state, last_error and last_errno
        fields for current statement to values which correspond to
        error which was caught.
      sql/mysql_priv.h:
        Added max_long_data_size variable declaration.
      sql/mysqld.cc:
        Added support for start-up parameter 'max_long_data_size'.
        This parameter limits size of data which can be sent from
        client to server using mysql_send_long_data() API.
      sql/set_var.cc:
        Added variable 'max_long_data_size' into list of variables
        displayed by command 'show variables'.
      sql/sql_prepare.cc:
        Added error handler class Set_longdata_error_handler.
        This handler is used to catch any errors that can be
        generated during execution of Item_param::set_longdata().
        
        Source code snippet that makes checking for statement's state 
        during statement execution is moved from Prepared_statement::execute()
        to Prepared_statement::execute_loop() in order not to call
        set_parameters() when statement has failed during
        set_long_data() execution. If this hadn't been done
        the call to set_parameters() would have failed.
      tests/mysql_client_test.c:
        A testcase for the bug #56976 was added.
      9320dca9