1. 16 Mar, 2007 1 commit
    • unknown's avatar
      Bug #26261: · 2e8e78a4
      unknown authored
       INSERT uses query_id to verify what fields are
       mentioned in the fields list of the INSERT command.
       However the check for that is made after the 
       ON DUPLICATE KEY is processed. This causes all
       the fields mentioned in ON DUPLICATE KEY to be 
       considered as mentioned in the fields list of 
       INSERT.
       Moved the check up, right after processing the
       fields list.
      
      
      mysql-test/r/insert_update.result:
        Bug #26261: test case
      mysql-test/t/insert_update.test:
        Bug #26261: test case
      sql/mysql_priv.h:
        Bug #26261: moved the check inside mysql_prepare_insert
      sql/sql_insert.cc:
        Bug #26261: move the check inside mysql_prepare_insert
        before setting up the ON DUPLICATE KEY part
      sql/sql_prepare.cc:
        Bug #26261: moved the check inside mysql_prepare_insert
      2e8e78a4
  2. 22 Feb, 2007 2 commits
    • unknown's avatar
      Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 1f93b0c8
      unknown authored
      into  dl145s.mysql.com:/users/mhansson/mysql/autopush/5.0o-bug24010
      
      
      1f93b0c8
    • unknown's avatar
      Bug #24010: INSERT INTO ... SELECT fails on unique constraint with data · ddb5a563
      unknown authored
      it doesn't select.
      
      This bug was fixed along with bug #16861: User defined variable can 
      have a wrong value if a tmp table was used.
      
      There the fix consisted of Item_func_set_user_var overloading the method
      Item::save_in_field. Consider the query from the test case:
      
      
      INSERT INTO foo( bar, baz )
      SELECT 
        bar,
        @newBaz := 1 + baz
      FROM 
        foo
      WHERE 
        quux <= 0.1;
      
      Here the assignment expression '@newBaz := 1 + baz' is represented by an 
      Item_func_set_user_var. Its member method save_in_field, which writes the 
      value of this assignment into the result field, writes the val_xxx() value, 
      which is not updated at this point. In the fix introduced by the patch,
      the save_in_field method reads the actual variable value instead.
      
      See also comment for 
      ChangeSet@1.2368.1.3, 2007-01-09 23:24:56+03:00, evgen@moonbone.local +4 -0
      and comment for
      Item_func_set_user_var::save_in_field (item_func.cc)
      
      
      mysql-test/r/update.result:
        BUG#24010
        The correct, and expected, result
      mysql-test/t/update.test:
        BUG#24010
        The test case for this bug. When the bug is active, the INSERT ... SELECT 
        statement will try to insert the values <1, 2> which gives an error
      ddb5a563
  3. 21 Feb, 2007 2 commits
    • unknown's avatar
      Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt · a1234294
      unknown authored
      into  moonbone.local:/mnt/gentoo64/work/23800-bug1-5.0-opt-mysql
      
      
      sql/item.cc:
        Auto merged
      sql/item.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      a1234294
    • unknown's avatar
      Bug#23800: Outer fields in correlated subqueries is used in a temporary table · f8855142
      unknown authored
      created for sorting.
      
      Any outer reference in a subquery was represented by an Item_field object.
      If the outer select employs a temporary table all such fields should be
      replaced with fields from that temporary table in order to point to the 
      actual data. This replacement wasn't done and that resulted in a wrong
      subquery evaluation and a wrong result of the whole query.
      
      Now any outer field is represented by two objects - Item_field placed in the
      outer select and Item_outer_ref in the subquery. Item_field object is
      processed as a normal field and the reference to it is saved in the
      ref_pointer_array. Thus the Item_outer_ref is always references the correct
      field. The original field is substituted for a reference in the
      Item_field::fix_outer_field() function.
      
      New function called fix_inner_refs() is added to fix fields referenced from
      inner selects and to fix references (Item_ref objects) to these fields.
      
      The new Item_outer_ref class is a descendant of the Item_direct_ref class.
      It additionally stores a reference to the original field and designed to
      behave more like a field.
      
      
      sql/item.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Now all outer fields are substituted with references to them (Item_outer_ref objects)
        in the Item_field::fix_outer_field() function.
        The original field is saved in the Item_outer_ref object.
      sql/item.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added the Item_outer_ref class.
      sql/mysql_priv.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added the fix_inner_refs() function prototype.
      sql/sql_delete.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added call to the fix_inner_refs() function.
      sql/sql_select.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        The new function called fix_inner_refs() is added.
      mysql-test/r/subselect.result:
        Added a test case for bug#23800: Correlated sub query returning incorrect results when
        operated upon.
      sql/sql_update.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added call to the fix_inner_refs() function.
      mysql-test/r/subselect3.result:
        Corrected test cases result after fix for bug#23800: Correlated sub query returning
        incorrect results when operated upon.
      mysql-test/t/subselect.test:
        Added a test case for bug#23800: Correlated sub query returning incorrect results when
        operated upon.
      sql/sql_lex.cc:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        Added cleanup of the inner_refs_list.
      sql/sql_lex.h:
        Bug#23800: Correlated sub query returning incorrect results when operated upon.
        The inner_refs_list is added to the SELECT_LEX class.
      f8855142
  4. 19 Feb, 2007 4 commits
    • unknown's avatar
      Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · a06fe4ab
      unknown authored
      into  rakia.gmz:/home/kgeorge/mysql/autopush/B19717-5.0-opt
      
      
      a06fe4ab
    • unknown's avatar
      Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 3f9876d7
      unknown authored
      into  rakia.gmz:/home/kgeorge/mysql/autopush/B19717-5.0-opt
      
      
      3f9876d7
    • unknown's avatar
      Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 6d537f01
      unknown authored
      into  rakia.gmz:/home/kgeorge/mysql/autopush/B25831-5.0-opt
      
      
      sql/item.h:
        Auto merged
      sql/sql_base.cc:
        Auto merged
      sql/sql_insert.cc:
        Auto merged
      sql/sql_prepare.cc:
        Auto merged
      sql/sql_yacc.yy:
        Auto merged
      6d537f01
    • unknown's avatar
      Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving. · a97fd193
      unknown authored
       Several problems fixed: 
        1. There was a "catch-all" context initialization in setup_tables()
          that was causing the table that we insert into to be visible in the 
          SELECT part of an INSERT .. SELECT .. statement with no tables in
          its FROM clause. This was making sure all the under-initialized
          contexts in various parts of the code are not left uninitialized.
          Fixed by removing the "catch-all" statement and initializing the 
          context in the parser.
        2. Incomplete name resolution context when resolving the right-hand
          values in the ON DUPLICATE KEY UPDATE ... part of an INSERT ... SELECT ...
          caused columns from NATURAL JOIN/JOIN USING table references in the
          FROM clause of the select to be unavailable.
          Fixed by establishing a proper name resolution context.
        3. When setting up the special name resolution context for problem 2
          there was no check for cases where an aggregate function without a
          GROUP BY effectively takes the column from the SELECT part of an 
          INSERT ... SELECT unavailable for ON DUPLICATE KEY UPDATE.
          Fixed by checking for that condition when setting up the name 
          resolution context.
      
      
      mysql-test/r/insert_update.result:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - test case
      mysql-test/t/insert_update.test:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - test case
      sql/item.h:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - save_next_local is not referenced any more outside class methods
      sql/sql_base.cc:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - removed a "catch-all" code to cater for correct context initialization
      sql/sql_help.cc:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - fixed the name resolution context initialization
      sql/sql_insert.cc:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - Fixed the context of resolving the values in INSERT SELECT ON UPDATE
      sql/sql_prepare.cc:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - Correct context for name resolution of prepared INSERT .. SELECT
      sql/sql_union.cc:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - fixed the name resolution context initialization
      sql/sql_yacc.yy:
        Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
         - Set the context here instead of setup_tables()
      a97fd193
  5. 16 Feb, 2007 5 commits
    • unknown's avatar
      Adjusted results after fix for bug 25971. · d7992c88
      unknown authored
      d7992c88
    • unknown's avatar
      Adjusted results after fix for bug 25971. · 4d7334c8
      unknown authored
      4d7334c8
    • unknown's avatar
      Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 4b51bbde
      unknown authored
      into  olga.mysql.com:/home/igor/mysql-5.0-opt
      
      
      sql/sql_select.cc:
        Auto merged
      4b51bbde
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 98f87d97
      unknown authored
      into  moonbone.local:/mnt/gentoo64/work/16630-bug-5.0-opt-mysql
      
      
      sql/item.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      98f87d97
    • unknown's avatar
      Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY · d5813a06
      unknown authored
      UPDATE contains wrong data if the SELECT employs a temporary table.
      
      If the UPDATE values of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE
      statement contains fields from the SELECT part and the select employs a
      temporary table then those fields will contain wrong values because they
      aren't corrected to get data from the temporary table.
      
      The solution is to add these fields to the selects all_fields list,
      to store pointers to those fields in the selects ref_pointer_array and
      to access them via Item_ref objects.
      
      The substitution for Item_ref objects is done in the new function called 
      Item_field::update_value_transformer(). It is called through the
      item->transform() mechanism at the end of the select_insert::prepare()
      function.
      
      
      sql/item.cc:
        Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
        UPDATE contains wrong data if the SELECT employs a temporary table.
        The new method Item_field::update_value_transformer() is added. It
        substitutes fields in the update values list for references 
        (Item_ref objects) to them.
      sql/item.h:
        Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
        UPDATE contains wrong data if the SELECT employs a temporary table.
        The update_value_transformer() method is added to the Item and to the
        Item_field classes.
      sql/sql_insert.cc:
        Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
        UPDATE contains wrong data if the SELECT employs a temporary table.
        Traverse update values and substitute fields from the select for
        references (Item_ref objects) to them.
      sql/sql_select.cc:
        Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
        UPDATE contains wrong data if the SELECT employs a temporary table.
        Traverse update values and substitute fields from the select for
        references (Item_ref objects) to them.
      mysql-test/r/insert_select.result:
        Added a test case for bug#16630: The update fields of the INSERT .. SELECT ..
        ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a 
        temporary table.
      mysql-test/t/insert_select.test:
        Added a test case for bug#16630: The update fields of the INSERT .. SELECT ..
        ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a 
        temporary table.
      d5813a06
  6. 15 Feb, 2007 1 commit
    • unknown's avatar
      Fixed bug #25971: indexes on text columns were ignored when ref accesses · 6ae94723
      unknown authored
      were evaluated.
      According to the new rules for string comparison partial indexes on text
      columns can be used in the same cases when partial indexes on varchar
      columns can be used.
      
      
      mysql-test/r/endspace.result:
        Adjusted results after the fix for bug #25971.
      mysql-test/r/innodb.result:
        Adjusted results after the fix for bug #25971.
      mysql-test/r/myisam.result:
        Adjusted results after the fix for bug #25971.
      mysql-test/r/select.result:
        Added a test case for bug #25971.
      mysql-test/r/type_blob.result:
        Adjusted results after the fix for bug #25971.
      mysql-test/t/select.test:
        Added a test case for bug #25971.
      6ae94723
  7. 14 Feb, 2007 1 commit
    • unknown's avatar
      Bug#19717: The blackhole engine is returning an OK flag in · 6c8b5256
      unknown authored
      index_read(), whereas it must return HA_ERR_END_OF_FILE
      instead (as there are by definition no rows in a table of 
      that engine.
      
      
      mysql-test/r/blackhole.result:
        Bug#19717: test case
      mysql-test/t/blackhole.test:
        Bug#19717: test case
      sql/ha_blackhole.cc:
        Bug#19717: return no rows instead of success.
      6c8b5256
  8. 13 Feb, 2007 5 commits
    • unknown's avatar
      Post-merge fix · c039eed8
      unknown authored
      c039eed8
    • unknown's avatar
      Merge bk-internal.mysql.com:/data0/bk/mysql-5.0 · 579c926d
      unknown authored
      into  bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
      
      
      BitKeeper/etc/gone:
        auto-union
      mysys/my_getopt.c:
        Auto merged
      sql/field.h:
        Auto merged
      sql/item.cc:
        Auto merged
      sql/item_cmpfunc.cc:
        Auto merged
      sql/item_cmpfunc.h:
        Auto merged
      sql/mysql_priv.h:
        Auto merged
      sql/sql_prepare.cc:
        Auto merged
      sql/sql_select.cc:
        Auto merged
      sql/table.cc:
        Auto merged
      mysql-test/r/select.result:
        Manual merge
      mysql-test/t/select.test:
        Manual merge
      579c926d
    • unknown's avatar
      Merge pilot.mysql.com:/home/msvensson/mysql/mysql-5.0 · e5c1656e
      unknown authored
      into  pilot.mysql.com:/home/msvensson/mysql/mysql-5.0-maint
      
      
      BitKeeper/etc/ignore:
        auto-union
      e5c1656e
    • unknown's avatar
      Merge pilot.mysql.com:/home/msvensson/mysql/mysql-4.1-maint · faacf580
      unknown authored
      into  pilot.mysql.com:/home/msvensson/mysql/mysql-5.0-maint
      
      
      BitKeeper/etc/gone:
        auto-union
      mysys/my_getopt.c:
        Auto merged
      sql/sql_prepare.cc:
        Auto merged
      sql/table.cc:
        Auto merged
      faacf580
    • unknown's avatar
      Merge olga.mysql.com:/home/igor/mysql-5.0-opt · e656c582
      unknown authored
      into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug26209
      
      
      sql/sql_select.cc:
        Auto merged
      e656c582
  9. 12 Feb, 2007 16 commits
    • unknown's avatar
      Merge mysql.com:/home/hf/work/20691/my50-20691 · 4c2bc81a
      unknown authored
      into  mysql.com:/home/hf/work/25492/my50-25492
      
      
      sql/item.cc:
        Auto merged
      4c2bc81a
    • unknown's avatar
      Merge bk@192.168.21.1:mysql-5.0-opt · e7e25506
      unknown authored
      into  mysql.com:/home/hf/work/25492/my50-25492
      
      
      e7e25506
    • unknown's avatar
      Merge mysql.com:/home/hf/work/25492/my41-25492 · 04b64f00
      unknown authored
      into  mysql.com:/home/hf/work/25492/my50-25492
      
      
      libmysqld/lib_sql.cc:
        merging
      04b64f00
    • unknown's avatar
      bug #25492 (Invalid deallocation in mysql_stmt_fetch) · fd76e148
      unknown authored
      
      libmysqld/lib_sql.cc:
        code modified to prevent freeing of memory that wasn't malloc-ed.
        Now we check if MYSQL_STMT::result was used.
      fd76e148
    • unknown's avatar
      Merge mysql.com:/home/gluh/MySQL/Merge/5.0 · dfe66b93
      unknown authored
      into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
      
      
      dfe66b93
    • unknown's avatar
      Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · 5e84eb56
      unknown authored
      into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
      
      
      5e84eb56
    • unknown's avatar
      valgrind error fix · 7ca34a79
      unknown authored
      7ca34a79
    • unknown's avatar
      Fixed MacOSX/Intel linking problem · e307a46c
      unknown authored
       Common symbols with and without initialization
       cause the apple linker to exclude then from the
       list of global symbols.
      
      
      e307a46c
    • unknown's avatar
      Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint · 1c285489
      unknown authored
      into  mysql.com:/home/tnurnberg/24660/50-24660
      
      
      sql/table.cc:
        Auto merged
      sql/unireg.cc:
        Auto merged
      1c285489
    • unknown's avatar
      Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-4.1-maint · 8a34c4bb
      unknown authored
      into  mysql.com:/home/tnurnberg/24660/41-24660
      
      
      sql/table.cc:
        Auto merged
      8a34c4bb
    • unknown's avatar
      Merge mysql.com:/home/tnurnberg/24660/41-24660 · 91f684a5
      unknown authored
      into  mysql.com:/home/tnurnberg/24660/50-24660
      
      
      mysql-test/r/type_enum.result:
        Auto merged
      sql/table.cc:
        Auto merged
      sql/unireg.cc:
        Auto merged
      91f684a5
    • unknown's avatar
      Bug#24660: "enum" field type definition problem · 4dc7c1aa
      unknown authored
      ENUMs weren't allowed to have character 0xff, a perfectly good character in some locales.
      This was circumvented by mapping 0xff in ENUMs to ',', thereby prevent actual commas from
      being used. Now if 0xff makes an appearance, we find a character not used in the enum and
      use that as a separator. If no such character exists, we throw an error.
      
      Any solution would have broken some sort of existing behaviour. This solution should
      serve both fractions (those with 0xff and those with ',' in their enums), but
      WILL REQUIRE A DUMP/RESTORE CYCLE FROM THOSE WITH 0xff IN THEIR ENUMS. :-/
      That is, mysqldump with their current server, and restore when upgrading to one with
      this patch.
      
      
      mysql-test/r/type_enum.result:
        Bug#24660: "enum" field type definition problem
        
        Show that enums can now contain NAMES_SEP_CHAR (0xff, which is a perfectly respectable
        char in some locales), or ',', or both.
      mysql-test/t/type_enum.test:
        Bug#24660: "enum" field type definition problem
        
        Show that enums can now contain NAMES_SEP_CHAR (0xff, which is a perfectly respectable
        char in some locales), or ',', or both.
      sql/table.cc:
        Bug#24660: "enum" field type definition problem
        
        Revert fix for Bug#20922.
      sql/unireg.cc:
        Bug#24660: "enum" field type definition problem
        
        Use a field-separator for ENUM-values that is not part of those values. If impossible,
        throw error.
      4dc7c1aa
    • unknown's avatar
      Bug#24630 Subselect query crashes mysqld · 2572c826
      unknown authored
      The crash happens because second filling of the same I_S table happens in
      case of subselect with order by. table->sort.io_cache previously allocated
      in create_sort_index() is deleted during second filling
      (function get_schema_tables_result). There are two places where
      I_S table can be filled: JOIN::exec and create_sort_index().
      To fix the bug we should check if the table was already filled
      in one of these places and skip processing of the table in second.
      
      
      mysql-test/r/information_schema.result:
        test case
      mysql-test/t/information_schema.test:
        test case
      sql/mysql_priv.h:
        added new parameter 'executed_place' to function get_schema_tables_result()
      sql/sql_select.cc:
        added new parameter 'executed_place' to function get_schema_tables_result()
      sql/sql_show.cc:
        added more accurate check for cases when we need to refresh I_S table
      sql/table.cc:
        added more accurate check for cases when we need to refresh I_S table
      sql/table.h:
        added more accurate check for cases when we need to refresh I_S table
      2572c826
    • unknown's avatar
      bug #20691 (INSERT (DEFAULT) may insert garbage with NO DEFAULT NOT NULL field) · 07f36668
      unknown authored
      Some fields (GEOMETRY first of all) can't be handled properly in this
      case at all. So we return an error in this case
      
      
      mysql-test/r/default.result:
        result fixed
      mysql-test/r/gis.result:
        result fixed
      mysql-test/t/default.test:
        VIEW test added
      mysql-test/t/gis.test:
        testcase added
      sql/item.cc:
        set_defaults() changed with the 'reset()'
      07f36668
    • unknown's avatar
      Merge olga.mysql.com:/home/igor/mysql-5.0-opt · 1932ac9a
      unknown authored
      into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug26159
      
      
      1932ac9a
    • unknown's avatar
      Fixed bug #26209. · ac8e0293
      unknown authored
      The function make_unireg_sortorder ignored the fact that any
      view field is represented by a 'ref' object.
      This could lead to wrong results for the queries containing
      both GROUP BY and ORDER BY clauses.
      
      
      mysql-test/r/view.result:
        Added a test case for bug #26209.
      mysql-test/t/view.test:
        Added a test case for bug #26209.
      ac8e0293
  10. 11 Feb, 2007 3 commits
    • unknown's avatar
      sql_view.cc: · 5e42c0de
      unknown authored
        Post fix for bug#12122.
      information_schema.result:
        Corrected test case after fixing bug#12122.
      
      
      sql/sql_view.cc:
        Post fix for bug#12122.
      mysql-test/r/information_schema.result:
        Corrected test case after fixing bug#12122.
      5e42c0de
    • unknown's avatar
      Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt · a544b64f
      unknown authored
      into  moonbone.local:/mnt/gentoo64/work/12122-bug-5.0-opt-mysql
      
      
      a544b64f
    • unknown's avatar
      Fixed bug #26159. · 3e4f834d
      unknown authored
      A wrong order of statements in QUICK_GROUP_MIN_MAX_SELECT::reset
      caused a crash when a query with DISTINCT was executed by a loose scan
      for an InnoDB table that had been emptied. 
      
      
      mysql-test/r/innodb_mysql.result:
        Added a test case for bug #26159.
      mysql-test/t/innodb_mysql.test:
        Added a test case for bug #26159.
      sql/opt_range.cc:
        Fixed bug #26159.
        A wrong order of statements in QUICK_GROUP_MIN_MAX_SELECT::reset
        caused a crash when a query with DISTINCT was executed by a loose scan
        for an InnoDB table that had been emptied. 
        For an empty table quick_prefix_select->reset() was not called at all
        and thus some important initialization steps were missing.
      3e4f834d