An error occurred fetching the project authors.
  1. 03 Dec, 2006 1 commit
    • unknown's avatar
      bug #20835 (Subqueries: literal string with =any fails) · e8b32b2b
      unknown authored
      We create Item_cache_* object for each operand for each left operand of
      a subquery predicate. We also create Item_func_conv_charset for each string
      constant that needs charset conversion. So here we have Item_cache wrapped
      into Item_func_conv_charset.
      When Item_func_conv_charset wraps an constant Item it gets it's value
      in constructor. The problem is that Item_cache is ready to be used only
      at execution time, which is too late.
      The fix makes Item_cache wrapping constant to get ready at fix_fields() time.
      
      
      mysql-test/r/subselect.result:
        test result
      mysql-test/t/subselect.test:
        test case
      sql/item_cmpfunc.cc:
        now Item_optimizer::fix_left will store constant arguments in cache
        on fix_fields() stage
      e8b32b2b
  2. 09 Nov, 2006 1 commit
    • unknown's avatar
      merging · 4b60bdc9
      unknown authored
      mysql-test/r/subselect.result:
        result fixed
      4b60bdc9
  3. 07 Nov, 2006 1 commit
    • unknown's avatar
      Bug #11032: getObject() returns a String for a sub-query of type datetime · 5af4fd25
      unknown authored
       - When returning metadata for scalar subqueries the actual type of the
         column was calculated based on the value type, which limits the actual
         type of a scalar subselect to the set of (currently) 3 basic types : 
         integer, double precision or string. This is the reason that columns
         of types other then the basic ones (e.g. date/time) are reported as
         being of the corresponding basic type.
         Fixed by storing/returning information for the column type in addition
         to the result type.
      
      
      mysql-test/r/subselect.result:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - test case
      mysql-test/t/subselect.test:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - test case
      sql/item_subselect.cc:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - store and return the field type as well in addition to result type for 
           single row subqueries
      sql/item_subselect.h:
        Bug #11032: getObject() returns a String for a sub-query of type datetime
         - store and return the field type as well in addition to result type for 
           single row subqueries
      5af4fd25
  4. 01 Nov, 2006 1 commit
    • unknown's avatar
      Fixed bug #21727. · 2a7cf59f
      unknown authored
      This is a performance issue for queries with subqueries evaluation
      of which requires filesort.
      Allocation of memory for the sort buffer at each evaluation of a
      subquery may take a significant amount of time if the buffer is rather big.
      With the fix we allocate the buffer at the first evaluation of the
      subquery and reuse it at each subsequent evaluation.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #21727.
      mysql-test/t/subselect.test:
        Added a test case for bug #21727.
      sql/item_subselect.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added an implementation for Item_subselect::is_uncacheable()
        returning TRUE if the engine if the subselect is uncacheable.
      sql/mysql_priv.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/records.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_base.cc:
        Fixed bug #21727.
        Made sure that st_table::pos_in_table_list would be always initialized.
      sql/sql_select.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_show.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added a new boolean parameter to the filesort_free_buffers procedure.
        If the value of this parameter is TRUE the procedure frees the sort_keys
        buffpek buffers.
      sql/sql_table.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Cleanup.
      sql/table.cc:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added st_table_list::in_subselect() returning for a table the subselect that 
        contains the FROM list this table is taken from (if there is any).
      sql/table.h:
        Fixed bug #21727.
        This is a performance issue for queries with subqueries evaluation
        of which requires filesort.
        Added fields for sort_keys and buffpek buffers to the FILESORT_INFO structure.
      2a7cf59f
  5. 31 Oct, 2006 1 commit
    • unknown's avatar
      BUG#8804: wrong results for NULL IN (SELECT ...) · 48df3b96
      unknown authored
      Evaluate "NULL IN (SELECT ...)" in a special way: Disable pushed-down 
      conditions and their "consequences": 
       = Do full table scans instead of unique_[index_subquery] lookups.
       = Change appropriate "ref_or_null" accesses to full table scans in
         subquery's joins.
      Also cache value of NULL IN (SELECT ...) if the SELECT is not correlated 
      wrt any upper select.
      
      
      mysql-test/r/subselect.result:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
         - Updated test results
      sql/item.h:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
         - Added comments
      sql/item_cmpfunc.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
        Made Item_in_optimizer to:
        - cache the value of "NULL IN (uncorrelated select)"
        - Turn off pushed-down predicates when evaluating "NULL IN (SELECT ...)"
      sql/item_cmpfunc.h:
        BUG#8804: wrong results for NULL IN (SELECT ...): 
        - Made Item_in_optimizer cache the value of "NULL IN (uncorrelated select)"
        - Added comments
      sql/item_subselect.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - When needed, wrap the predicates we push into subquery into an 
          Item_func_trig_cond so we're able to turn them off when evaluating 
          NULL IN (SELECT ...).
        - Added code to evaluate NULL IN (SELECT ...) in a special way:
          = In [unique_]index_subquery, do full table scan to see if there 
            are any rows.
          = For other subqueries, change ref[_or_null] to ALL if the
            ref[_or_null] was created from pushed-down predicate.
      sql/item_subselect.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added Item_subselect::is_correlated
        - Added comments
      sql/records.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Make rr_sequential() non-static
      sql/sql_lex.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added st_select_lex::is_correlated and Item_subselect::is_correlated.
      sql/sql_lex.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added st_select_lex::is_correlated
      sql/sql_select.cc:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added KEY_FIELD::outer_ref to keep track of which ref accesses are 
          created from predicates that were pushed down into the subquery.
      sql/sql_select.h:
        BUG#8804: wrong results for NULL IN (SELECT ...):
        - Added KEYUSE::outer_ref
      mysql-test/r/subselect3.result:
        New BitKeeper file ``mysql-test/r/subselect3.result''
      mysql-test/t/subselect3.test:
        New BitKeeper file ``mysql-test/t/subselect3.test''
      48df3b96
  6. 20 Oct, 2006 1 commit
    • unknown's avatar
      Fixed bug #23478. · d649efbb
      unknown authored
      If elements a not top-level IN subquery were accessed by an index and 
      the subquery result set included  a NULL value then the quantified
      predicate that contained the subquery was evaluated to NULL when 
      it should return a non-null value.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #23478.
      mysql-test/t/subselect.test:
        Added a test case for bug #23478.
      d649efbb
  7. 17 Oct, 2006 1 commit
    • unknown's avatar
      Bug#21798: memory leak during query execution with subquery in column · 841ea461
      unknown authored
                  list using a function
      When executing dependent subqueries they are re-inited and re-exec() for 
      each row of the outer context.
      The cause for the bug is that during subquery reinitialization/re-execution,
      the optimizer reallocates JOIN::join_tab, JOIN::table in make_simple_join()
      and the local variable in 'sortorder' in create_sort_index(), which is
      allocated by make_unireg_sortorder().
      Care must be taken not to allocate anything into the thread's memory pool
      while re-initializing query plan structures between subquery re-executions.
      All such items mush be cached and reused because the thread's memory pool
      is freed at the end of the whole query.
      Note that they must be cached and reused even for queries that are not 
      otherwise cacheable because otherwise it will grow the thread's memory 
      pool every time a cacheable query is re-executed. 
      We provide additional members to the JOIN structure to store references 
      to the items that need to be cached.
      
      
      mysql-test/r/subselect.result:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - test case
      mysql-test/t/subselect.test:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - test case
      sql/mysql_priv.h:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the entities allocated in the threads memory pool by
           JOIN::exec ().
      sql/sql_delete.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_select.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_select.h:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_table.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      sql/sql_update.cc:
        Bug#21798: memory leak during query execution with subquery in column
                    list using a function
         - cache the SORT_ORDER, TABLE * and JOIN_TAB allocated in the thread's 
           memory pool by JOIN::exec ().
      841ea461
  8. 16 Oct, 2006 1 commit
    • unknown's avatar
      Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on · ffc1facc
      unknown authored
                   strings
      MySQL is setting the flag HA_END_SPACE_KEYS for all the keys that reference
      text or varchar columns with collation different than binary.
      This was done to handle correctly the situation where a lookup on such a key
      may return more than 1 row because of the presence of many rows that differ
      only by the amount of trailing space in the table's string column.
      Inserting such values however appears to violate the unique checks on 
      INSERT/UPDATE. Thus that flag must not be set as it will prevent the optimizer
      from choosing a faster access method.
      This fix removes the setting of the HA_END_SPACE_KEYS flag.
      
      
      include/my_base.h:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - disabled HA_END_SPACE_KEY as it's no longer needed
      mysql-test/r/func_str.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/r/merge.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/r/select.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - test case
      mysql-test/r/subselect.result:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - fixed explain in an existing case
      mysql-test/t/select.test:
        Bug #22367: Optimizer uses ref join type instead of eq_ref for simple join on 
                     strings
         - test case
      ffc1facc
  9. 03 Oct, 2006 1 commit
    • unknown's avatar
      Update mysqltest to latest version · 9368c7bc
      unknown authored
       - ie. backport from 5.1
       - also update testcase error dected by new version
      
      
      mysql-test/include/show_msg.inc:
        BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg.inc
      mysql-test/include/show_msg80.inc:
        BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg80.inc
      BitKeeper/deleted/.del-rpl_chain_temp_table.test:
        Delete: mysql-test/t/rpl_chain_temp_table.test
      BitKeeper/deleted/.del-rpl_chain_temp_table.result:
        Delete: mysql-test/r/rpl_chain_temp_table.result
      BitKeeper/deleted/.del-rpl_failsafe.result:
        Delete: mysql-test/r/rpl_failsafe.result
      BitKeeper/deleted/.del-rpl_failsafe.test:
        Delete: mysql-test/t/rpl_failsafe.test
      BitKeeper/deleted/.del-rpl_heap.test:
        Delete: mysql-test/t/rpl_heap.test
      BitKeeper/deleted/.del-rpl_heap.result:
        Delete: mysql-test/r/rpl_heap.result
      BitKeeper/deleted/.del-rpl000018.result:
        Delete: mysql-test/r/rpl000018.result
      BitKeeper/deleted/.del-rpl000018.test:
        Delete: mysql-test/t/rpl000018.test
      client/Makefile.am:
        Link mysqltest with mysys/my_copy.c
      client/mysqltest.c:
        Update mysqltest to latest version
      mysql-test/include/have_multi_ndb.inc:
        Remove old syntax "@filename" in favor of "--require filename"
      mysql-test/include/master-slave.inc:
        Remove old syntax "@filename" in favor of "--require filename"
      mysql-test/include/ps_query.inc:
        Remove the comment about no output now when it does.
      mysql-test/r/check.result:
        Update output from --send
      mysql-test/r/connect.result:
        Update result file for connect test after backport form 5.1
      mysql-test/r/flush.result:
        Update output from --send
      mysql-test/r/flush_block_commit.result:
        Update output from --send
      mysql-test/r/func_misc.result:
        Update output from --send
      mysql-test/r/grant2.result:
        Update output from --send
      mysql-test/r/handler.result:
        Update output from --send
      mysql-test/r/kill.result:
        Update output from --send
      mysql-test/r/lock_multi.result:
        Update output from --send
      mysql-test/r/mix_innodb_myisam_binlog.result:
        Update output from --send
      mysql-test/r/mysqltest.result:
        Update mysqltest.result after backport
      mysql-test/r/ps_2myisam.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_3innodb.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_4heap.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_5merge.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_6bdb.result:
        Update result as the output from query is now printed
      mysql-test/r/ps_7ndb.result:
        Update result as the output from query is now printed
      mysql-test/r/rename.result:
        Update output from --send
      mysql-test/r/rpl000001.result:
        Update output from --send
      mysql-test/r/rpl_error_ignored_table.result:
        Update output from --send
      mysql-test/r/rpl_master_pos_wait.result:
        Update output from --send
      mysql-test/r/subselect.result:
        Update result file after adding missing ;
      mysql-test/r/synchronization.result:
        Update output from --send
      mysql-test/r/type_blob.result:
        Update result file after adding missing ;
      mysql-test/t/connect.test:
        Backport test from 5.1
      mysql-test/t/init_file.test:
        Update test so something is printed
      mysql-test/t/mysql_client_test.test:
        Update test so result is sent to file and something is printed
      mysql-test/t/mysqltest.test:
        Backport latest mysqltest.test file
      mysql-test/t/ps.test:
        Move the --replace_column statement to just before the statetement it should replace
      mysql-test/t/ps_1general.test:
        Move the --replace_column statement to just before the statetement it should replace
      mysql-test/t/ps_grant.test:
        Remove the $DB, no other test uses it
      mysql-test/t/rpl_flush_tables.test:
        Fetch $SERVER_VERSION from the db server
      mysql-test/t/rpl_trunc_temp.test:
        Remove the selection of connection master after it's been disconnected already
      mysql-test/t/subselect.test:
        Add missing ;
      mysql-test/t/type_blob.test:
        Add missing ;
      9368c7bc
  10. 25 Sep, 2006 1 commit
    • unknown's avatar
      Fixed bug #21853: assert failure for a grouping query with · 9bf2ed95
      unknown authored
      an ALL/ANY quantified subquery in HAVING.
      The Item::split_sum_func2 method should not create Item_ref
      for objects of any class derived from Item_subselect.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #21853.
      mysql-test/t/subselect.test:
        Added a test case for bug #21853.
      9bf2ed95
  11. 18 Sep, 2006 1 commit
  12. 08 Sep, 2006 1 commit
    • unknown's avatar
      Bug #21540: Subqueries with no from and aggregate functions return · 2a00a073
      unknown authored
                  wrong results
       Mark the containing Item(s) (Item_subselect descendant usually) of 
       a subselect as containing aggregate functions if it has references
       to aggregates functions that are calculated outside its context.
       This tels end_send_group() not to make an Item_subselect descendant in
       select list a copy and causes the correct value being returned.
      
      
      mysql-test/r/func_group.result:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - test cases
      mysql-test/r/subselect.result:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - fixed the result of an existing testcase.
      mysql-test/t/subselect.test:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         - test cases
      sql/item_sum.cc:
        Bug #21540: Subqueries with no from and aggregate functions return
                    wrong results
         Mark the containing Item (Item_subselect descendant usually) of 
         a subselect as containing aggregate functions if it has references
         to aggregates functions that are calculated outside its context.
         This tels end_send_group() not to make an Item_subselect descendant in
         select list a copy and causes the correct value being returned.
      2a00a073
  13. 31 Aug, 2006 1 commit
    • unknown's avatar
      Bug#14654 : Cannot select from the same table twice within a UNION statement · c9bba13a
      unknown authored
       Made the parser to support parenthesis around UNION branches.
       This is done by amending the rules of the parser so it generates the correct
       structure.
       Currently it supports arbitrary subquery/join/parenthesis operations in the 
       EXISTS clause. 
       In the IN/scalar subquery case it will allow adding nested parenthesis only 
       if there is an UNION clause after the parenthesis. Otherwise it will just  
       treat the multiple nested parenthesis as a scalar expression.
       It adds extra lex level for ((SELECT ...) UNION ...) to accommodate for the
       UNION clause.
      
      
      mysql-test/r/subselect.result:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      mysql-test/t/subselect.test:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - test cases
      sql/sql_yacc.yy:
        Bug#14654 : Cannot select from the same table twice within a UNION statement
         - shuffle around the rules for the parenthesis in subselect
      c9bba13a
  14. 24 Aug, 2006 2 commits
    • unknown's avatar
      BUG#16255: Post-review fixes: adjust the testcase. · f895a16c
      unknown authored
      mysql-test/r/subselect.result:
        BUG#16255: A proper testcase
      mysql-test/t/subselect.test:
        BUG#16255: A proper testcase
      f895a16c
    • unknown's avatar
      Bug #16255: Subquery in WHERE (the cset by Georgi Kodinov) · c74c8195
      unknown authored
       Must not use Item_direct_ref in HAVING because it points to
       the new value (witch is not yet calculated for the first row).
      
      
      mysql-test/r/subselect.result:
        Bug #16255: Subquery in where
         - test case
      mysql-test/t/subselect.test:
        Bug #16255: Subquery in where
         - test case
      sql/item_subselect.cc:
        Bug #16255: Subquery in where
         Must not use Item_direct_ref in HAVING because it points to
         the new value (witch is not yet calculated for the first row).
      c74c8195
  15. 10 Aug, 2006 1 commit
    • unknown's avatar
      Bug #16792 query with subselect, join, and group not returning proper values · d3dd6fa0
      unknown authored
       Treat queries with no FROM and aggregate functions as normal queries,
      so the aggregate function get correctly calculated as if there is 1 row. 
      This means that they will be considered to have one row, so COUNT(*) will return
      1 instead of 0. Other aggregates will behave in compatible manner.
      
      
      mysql-test/r/func_gconcat.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case. Note how it improves the support for DUAL.
      mysql-test/r/func_group.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case. Note how it improves the support for DUAL.
      mysql-test/r/subselect.result:
        Bug #16792 query with subselect, join, and group not returning proper values
         - consequence of (SELECT MAX(<const>)) now returning <const> instead of 0
      mysql-test/t/func_group.test:
        Bug #16792 query with subselect, join, and group not returning proper values
         - test case.
      sql/opt_sum.cc:
        Bug #16792 query with subselect, join, and group not returning proper values
         - cannot do the optimization if the index is already opened by (say) UPDATE
           as it invloves opening reading and closing the index.
      sql/sql_select.cc:
        Bug #16792 query with subselect, join, and group not returning proper values
         - Treat queries with no FROM and aggregate functions as normal queries,
        so the aggregate function get correctly calculated as if there is 1 row.
      d3dd6fa0
  16. 03 Aug, 2006 1 commit
    • unknown's avatar
      Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result · 8462d3a4
      unknown authored
       Reseting subqueries with "quick" access methods was incomplete.
       Partially backported the correct reseting of QUICK_SELECTs from 5.x.
      
      
      mysql-test/r/subselect.result:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - test case
      mysql-test/t/subselect.test:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - test case
      sql/opt_range.cc:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - partially backported the correct reseting of QUICK_SELECTs from 5.x.
      sql/opt_range.h:
        Bug #21180: Subselect with index for both WHERE and ORDER BY produces empty result
         - partially backported the correct reseting of QUICK_SELECTs from 5.x.
      8462d3a4
  17. 29 Jul, 2006 1 commit
    • unknown's avatar
      Add missing delimiter in subselect test · a7ec9063
      unknown authored
      mysql-test/r/subselect.result:
        Add missing semicolon delimiter and junk caused by that
      mysql-test/t/subselect.test:
        Add missing semicolon delimiter
      a7ec9063
  18. 28 Jul, 2006 1 commit
    • unknown's avatar
      BUG#14940 "MySQL choose wrong index", v.2 · ef452e19
      unknown authored
      - Make the range-et-al optimizer produce E(#table records after table 
                                                 condition is applied),
      - Make the join optimizer use this value,
      - Add "filtered" column to EXPLAIN EXTENDED to show 
        fraction of records left after table condition is applied
      - Adjust test results, add comments
      
      
      mysql-test/r/archive_gis.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/auto_increment.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/bdb_gis.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/bench_count_distinct.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/binlog_stm_blackhole.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/case.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/cast.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/compress.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/ctype_collate.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/ctype_cp1250_ch.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/date_formats.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/distinct.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/fulltext.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_compress.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_crypt.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_default.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_encrypt.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_gconcat.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_group.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_if.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_in.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_like.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_math.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_op.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_regexp.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_set.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_str.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_system.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_test.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/func_time.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/gis.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/group_by.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/group_min_max.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/having.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/heap.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/heap_hash.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/index_merge.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/index_merge_innodb.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/index_merge_ror.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/innodb_gis.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/insert_update.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/join.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/join_nested.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/key_diff.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/myisam.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/ndb_gis.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/negation_elimination.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/null.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/olap.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/partition_pruning.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/query_cache.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/row.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/rpl_get_lock.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/rpl_master_pos_wait.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/select.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/ssl.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/ssl_compress.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/subselect.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/type_blob.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/union.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/varbinary.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/variables.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/r/view.result:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/ctype_cp1250_ch.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/func_like.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/group_min_max.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/index_merge_ror.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/index_merge_ror_cpk.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/join.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      mysql-test/t/partition_pruning.test:
        BUG#14940: Adjust the test results: EXPLAIN EXTENDED now has extra "filtered" column
      sql/opt_range.cc:
        BUG#14940: Make range/index_merge/group-min-max optimizer produce TABLE::quick_condition_rows -
          estimate of #records that will match the table condition.
      sql/sql_class.cc:
        BUG#14940: Add "filtered" column to output of EXPLAIN EXTENDED
      sql/sql_select.cc:
        BUG#14940: 
        - Make the join optimizer to use TABLE::quick_condition_rows=
          = E(#table records after filtering with table condition) 
        - Add "filtered" column to output of EXPLAIN EXTENDED
      sql/sql_select.h:
        BUG#14940: Added comments
      sql/table.h:
        BUG#14940: Added comments
      ef452e19
  19. 25 Jul, 2006 1 commit
    • unknown's avatar
      Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set · 585b5bbc
      unknown authored
      The problem was in that opt_sum_query() replaced MIN/MAX functions
      with the corresponding constant found in a key, but due to imprecise
      representation of float numbers, when evaluating the where clause,
      this comparison failed.
      
      When MIN/MAX optimization detects that all tables can be removed,
      also remove all conjuncts in a where clause that refer to these
      tables. As a result of this fix, these conditions are not evaluated
      twice, and in the case of float number comparisons we do not discard
      result rows due to imprecise float representation.
      
      As a side-effect this fix also corrects an unnoticed problem in
      bug 12882.
      
      
      mysql-test/r/func_group.result:
        BUG#20954 - test result adjustment.
        Adjusted the test result of bug 12882 which was not preperly fixed.
        The current patch corrects the problem that was fully corrected by the
        patch for 12882.
        
        The problem was that opt_sum_query() indicated that the optimizer may
        remove all tables because all MIN/MAX/COUNT functions are constants,
        but this lead to an empty result instead of NULL because the WHERE
        clause was still evaluated.
        
        The current fix removes all conjuncts in the where clause that
        reference the removed tables, and thus corrects the problem.
      mysql-test/r/select.result:
        BUG#20954 - added test
      mysql-test/r/subselect.result:
        BUG#20954 - test result adjustment.
        
        The fix removes those conditions in a where clause that refer to
        tables optimized away by MIN/MAX optimization (opt_sum_query()).
      mysql-test/t/select.test:
        BUG#20954 - added test
      sql/sql_select.cc:
        Fix for BUG#20954: avg(keyval) retuns 0.38 but max(keyval) returns an empty set
        
        When MIN/MAX optimization detects that all tables can be removed,
        also remove all conjuncts in a where clause that refer to these
        tables. As a result of this fix, these conditions are not evaluated
        twice, and in the case of float number comparisons we do not discard
        result rows due to imprecise float representation.
        
        As a side-effect this fix also corrects an unnoticed problem in
        bug 12882.
      585b5bbc
  20. 21 Jul, 2006 1 commit
  21. 20 Jul, 2006 1 commit
    • unknown's avatar
      BUG#20975: Incorrect query result for NOT (subquery): · 68698c04
      unknown authored
        Add implementations of Item_func_{nop,not}_all::neg_transformer
      
      
      mysql-test/r/subselect.result:
        BUG#20975: testcase
      mysql-test/t/subselect.test:
        BUG#20975: testcase
      sql/mysql_priv.h:
        Make chooser_compare_func_creator visible in item.h
      68698c04
  22. 17 Jul, 2006 1 commit
  23. 15 Jul, 2006 2 commits
    • unknown's avatar
      Fixed bug #20869. · 10961504
      unknown authored
      The bug caused a crash of the server if a subquery with
      ORDER BY DESC used the range access method.
      The bug happened because the method QUICK_SELECT_DESC::reset
      was not reworked after MRR interface had been introduced.
      
      
      mysql-test/r/subselect.result:
        Added a test case for bug #20869.
      mysql-test/t/subselect.test:
        Added a test case for bug #20869.
      10961504
    • unknown's avatar
      Fixed bug #20519. · 203d46bb
      unknown authored
      The bug was due to a loss happened during a refactoring made
      on May 30 2005 that modified the function JOIN::reinit.
      As a result of it for any subquery the value of offset_limit_cnt
      was not restored for the following executions. Yet the first 
      execution of the subquery made it equal to 0.
      The fix restores this value in the function JOIN::reinit.  
      
      
      mysql-test/r/subselect.result:
        Added a test case fir bug #20519.
      mysql-test/t/subselect.test:
        Added a test case fir bug #20519.
      203d46bb
  24. 14 Jul, 2006 1 commit
    • unknown's avatar
      Fixed bug #19714. · 1e442594
      unknown authored
      DESCRIBE returned the type BIGINT for a column of a view if the column
      was specified by an expression over values of the type INT.
          
      E.g. for the view defined as follows:
        CREATE VIEW v1 SELECT COALESCE(f1,f2) FROM t1
      DESCRIBE returned type BIGINT for the only column of the view if f1,f2 are
      columns of the INT type.
      At the same time DESCRIBE returned type INT for the only column of the table
      defined by the statement:
        CREATE TABLE t2 SELECT COALESCE(f1,f2) FROM t1.
          
      This inconsistency was removed by the patch.
      
      Now the code chooses between INT/BIGINT depending on the
      precision of the aggregated column type.
       
      Thus both DESCRIBE commands above returns type INT for v1 and t2.
       
      
      
      mysql-test/r/analyse.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/bigint.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/create.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/olap.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_2myisam.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_3innodb.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_4heap.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_5merge.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_6bdb.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/ps_7ndb.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/sp.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/subselect.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/type_ranges.result:
        Adjusted the results after having fixed bug #19714.
      mysql-test/r/view.result:
        Added a test case for bug #19714.
      mysql-test/t/view.test:
        Added a test case for bug #19714.
      1e442594
  25. 11 Jul, 2006 1 commit
    • unknown's avatar
      Fixed bug#18503: Queries with a quantified subquery returning empty set · d2bbf288
      unknown authored
      may return a wrong result.
      
      An Item_sum_hybrid object has the was_values flag which indicates whether any
      values were added to the sum function. By default it is set to true and reset
      to false on any no_rows_in_result() call. This method is called only in
      return_zero_rows() function. An ALL/ANY subquery can be optimized by MIN/MAX
      optimization. The was_values flag is used to indicate whether the subquery
      has returned at least one row. This bug occurs because return_zero_rows() is
      called only when we know that the select will return zero rows before
      starting any scans but often such information is not known.
      In the reported case the return_zero_rows() function is not called and
      the was_values flag is not reset to false and yet the subquery return no rows
      Item_func_not_all and Item_func_nop_all functions return a wrong
      comparison result.
      
      The end_send_group() function now calls no_rows_in_result() for each item
      in the fields_list if there is no rows were found for the (sub)query.
      
      
      mysql-test/t/subselect.test:
        Added test case for bug#18503: Queries with a quantified subquery returning empty set may return a wrong result.
      mysql-test/r/subselect.result:
        Added test case for bug#18503: Queries with a quantified subquery returning empty set may return a wrong result.
      sql/sql_select.cc:
        Fixed bug#18503: Queries with a quantified subquery returning empty set may return a wrong result.
        
        The end_send_group() function now calls no_rows_in_result() for each item
        in the fields_list if there is no matching rows were found.
      d2bbf288
  26. 10 Jul, 2006 1 commit
    • unknown's avatar
      Fixed bug#16302: Quantified subquery without any tables gives wrong results · ad88eabd
      unknown authored
      The ALL/ANY subqueries are the subject of MIN/MAX optimization. The matter
      of this optimization is to embed MIN() or MAX() function into the subquery
      in order to get only one row by which we can tell whether the expression
      with ALL/ANY subquery is true or false.
      But when it is applied to a subquery like 'select a_constant' the reported bug
      occurs. As no tables are specified in the subquery the do_select() function 
      isn't called for the optimized subquery and thus no values have been added 
      to a MIN()/MAX() function and it returns NULL instead of a_constant.
      This leads to a wrong query result.
      
      For the subquery like 'select a_constant' there is no reason to apply
      MIN/MAX optimization because the subquery anyway will return at most one row.
      Thus the Item_maxmin_subselect class is more appropriate for handling such
      subqueries.
      
      The Item_in_subselect::single_value_transformer() function now checks
      whether tables are specified for the subquery. If no then this subselect is
      handled like a UNION using an Item_maxmin_subselect object.
      
      
      mysql-test/t/subselect.test:
        Added test case for bug#16302: Quantified subquery without any tables gives wrong results
      mysql-test/r/subselect.result:
        Added test case for bug#16302: Quantified subquery without any tables gives wrong results
      sql/item_subselect.cc:
        Fixed bug#16302: Quantified subquery without any tables gives wrong results
         
        The Item_in_subselect::single_value_transformer() function now checks
        whether tables are specified for the subquery. If no then this subselect is
        handled like a UNION using an Item_maxmin_subselect object.
      ad88eabd
  27. 27 Jun, 2006 1 commit
    • unknown's avatar
      Bug#17203: "sql_no_cache sql_cache" in views created from prepared statement · 90cb4c03
      unknown authored
      The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
      statement from internal structures based on value set later at runtime, not
      the original value set by the user.
      
      The solution is to remember that original value.
      
      
      mysql-test/r/auto_increment.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_compress.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_math.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_system.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/func_time.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/information_schema.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/query_cache.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_get_lock.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/rpl_master_pos_wait.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/show_check.result:
        Add result for bug#17203.
      mysql-test/r/subselect.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/type_blob.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/variables.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/r/view.result:
        Update result to not report SQL_NO_CACHE if it wasn't there at first place.
      mysql-test/t/show_check.test:
        Add test case for bug#17203.
      sql/sql_lex.cc:
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      sql/sql_lex.h:
        Add SELECT_LEX::sql_cache field to store original user setting.
      sql/sql_select.cc:
        Output SQL_CACHE and SQL_NO_CACHE depending on stored original user setting.
      sql/sql_yacc.yy:
        Make effect of SQL_CACHE and SQL_NO_CACHE mutually exclusive.  Ignore
        SQL_CACHE if SQL_NO_CACHE was used.  Remember what was set by the user.
        Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
      90cb4c03
  28. 25 May, 2006 1 commit
    • unknown's avatar
      Bug #19700: subselect returning BIGINT always returned it as SIGNED · a2f861f5
      unknown authored
        
      The unsigned flag in Item was not propagated through the single value subqueries.
      This caused the result to be treated as signed.
      
      
      mysql-test/r/subselect.result:
        Added testcases for bug #19700
      mysql-test/t/subselect.test:
        Added testcases for bug #19700
      sql/item.h:
        Preserved the unsigned flag in Item_subselect
      sql/item_subselect.cc:
        Preserved the unsigned flag in Item_subselect
      a2f861f5
  29. 17 May, 2006 1 commit
    • unknown's avatar
      Fixed bug#19077: A nested materialized derived table is used before being populated. · 1c6beaee
      unknown authored
      The convert_constant_item() function converts constant items to ints on
      prepare phase to optimize execution speed. In this case it tries to evaluate
      subselect which contains a derived table and is contained in a derived table. 
      All derived tables are filled only after all derived tables are prepared.
      So evaluation of subselect with derived table at the prepare phase will
      return a wrong result.
      
      A new flag with_subselect is added to the Item class. It indicates that
      expression which this item represents is a subselect or contains a subselect.
      It is set to 0 by default. It is set to 1 in the Item_subselect constructor
      for subselects.
      For Item_func and Item_cond derived classes it is set after fixing any argument
      in Item_func::fix_fields() and Item_cond::fix_fields accordingly.
      The convert_constant_item() function now doesn't convert a constant item
      if the with_subselect flag set in it. 
      
      
      mysql-test/t/view.test:
        Added test case for bug#19077: A nested materialized derived table is used before being populated.
      mysql-test/t/subselect.test:
        Added test case for bug#19077: A nested materialized derived table is used before being populated.
      mysql-test/r/view.result:
        Added test case for bug#19077: A nested materialized derived table is used before being populated.
      mysql-test/r/subselect.result:
        Added test case for bug#19077: A nested materialized derived table is used before being populated.
      sql/item_subselect.cc:
        Fixed bug#19077: A nested materialized derived table is used before being populated.
        The Item_subselect class constructor sets new with_subselect flag to 1.
      sql/item_func.cc:
        Fixed bug#19077: A nested materialized derived table is used before being populated.
        
        The Item_func::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
      sql/item_cmpfunc.cc:
        Fixed bug#19077: A nested materialized derived table is used before being populated.
        The convert_constant_item() function now doesn't convert a constant item
        with the with_subselect flag set.
        The Item_cond::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
      sql/item.cc:
        Fixed bug#19077: A nested materialized derived table is used before being populated.
        Set new with_subselect flag to default value - 0 in the Item constructor.
      sql/item.h:
        Fixed bug#19077: A nested materialized derived table is used before being populated.
        A new flag with_subselect is added to the Item class. It indicates that
        expression which this item represents is a subselect or contains a subselect.
        It is set to 0 by default.
      1c6beaee
  30. 11 May, 2006 1 commit
    • unknown's avatar
      BUG#7549: Missing error message for invalid view selection with subquery. · aeaaa456
      unknown authored
      When a view statement is compiled on CREATE VIEW time, most of the 
      optimizations should not be done. Finding the right optimization 
      for a subquery is one of them.
      Unfortunately the optimizer is resolving the column references of 
      the left expression of IN subqueries in the process of deciding 
      witch optimization to use (if needed). So there should be a 
      special case in Item_in_subselect::fix_fields() : check the 
      validity of the left expression of IN subqueries in CREATE VIEW 
      mode and then proceed as normal. 
      
      
      mysql-test/r/subselect.result:
        test case
      mysql-test/r/view.result:
        chnaged explain due to column being resolved
      mysql-test/t/subselect.test:
        test case
      sql/item_subselect.cc:
        overloaded fix_fields to fix the left_expr in prepare_view_mode
      sql/item_subselect.h:
        fix_fields overloaded so it can prepare left_expr
      aeaaa456
  31. 10 May, 2006 1 commit
    • unknown's avatar
      BUG#17379 Wrong reuse of E(#rows(range)) as E(#rows(ref(const))): · 3fa6432b
      unknown authored
      Re-work best_access_path() and find_best() to reuse E(#rows(range access)) as
      E(#rows(ref[_or_null](const) access) only when it is appropriate.
      [This is the final cumulative patch]
      
      
      mysql-test/r/select.result:
        BUG#17379: Testcase
      mysql-test/r/subselect.result:
        BUG#17379: Updated test results
      mysql-test/t/select.test:
        BUG#17379: Testcase
      sql/opt_range.cc:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Make range optimizer together with TABLE::quick_* also return TABLE::quick_n_ranges
      sql/sql_select.cc:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Re-work best_access_path() to reuse E(#rows(range access)) as
        E(#rows(ref[_or_null](const) access) only when it is appropriate.
      sql/table.h:
        BUG#17379: Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):
        Make range optimizer together with TABLE::quick_* also return TABLE::quick_n_ranges
      3fa6432b
  32. 03 May, 2006 1 commit
    • unknown's avatar
      Fixed bug #14292: performance degradation for a benchmark query. · 21d61c2b
      unknown authored
      This performance degradation was due to the fact that some
      cost evaluation code added into 4.1 in the function find_best was
      not merged into the code of the function best_access_path added
      together with other code for greedy optimizer.
      Added a parameter to the function print_plan. The parameter contains
      accumulated cost for a given partial join.
       
      The patch does not include a special test case since this performance
      degradation is hard to reproduse with a simple example.
      
      TODO: make the function find_best use the function best_access_path
      in order to remove duplication of code which might result in incomplete
      merges in the future.
      
      
      mysql-test/r/delete.result:
        Fixed bug #14292: performance degradation for a benchmark query.
        Adjusted test results.
      mysql-test/r/subselect.result:
        Fixed bug #14292: performance degradation for a benchmark query.
        Adjusted test results.
      sql/mysql_priv.h:
        Fixed bug #14292: performance degradation for a benchmark query.
        Added a parameter to the function print_plan. The parameter contains
        accumulated cost for a given partial join.
      sql/sql_select.cc:
        Fixed bug #14292: performance degradation for a benchmark query.
        This performance degradation was due to the fact that some
        cost evaluation code added into 4.1 in the function find_best was
        not merged into the code of the function best_access_path added
        together with other code for greedy optimizer.
      sql/sql_test.cc:
        Fixed bug #14292: performance degradation for a benchmark query.
        Added a parameter to the function print_plan. The parameter contains
        accumulated cost for a given partial join.
      21d61c2b
  33. 28 Apr, 2006 1 commit
    • unknown's avatar
      BUG#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol · 3a0d0b4c
      unknown authored
      In the code that converts IN predicates to EXISTS predicates it is changing
      the select list elements to constant 1. Example :
      SELECT ... FROM ...  WHERE a IN (SELECT c FROM ...)
      is transformed to :
      SELECT ... FROM ... WHERE EXISTS (SELECT 1 FROM ...  HAVING a = c)
      However there can be no FROM clause in the IN subquery and it may not be
      a simple select : SELECT ... FROM ... WHERE a IN (SELECT f(..) AS
      c UNION SELECT ...) This query is transformed to : SELECT ... FROM ...
      WHERE EXISTS (SELECT 1 FROM (SELECT f(..) AS c UNION SELECT ...)
      x HAVING a = c) In the above query c in the HAVING clause is made to be
      an Item_null_helper (a subclass of Item_ref) pointing to the real
      Item_field (which is not referenced anywhere else in the query anymore).
      This is done because Item_ref_null_helper collects information whether
      there are NULL values in the result.  This is OK for directly executed
      statements, because the Item_field pointed by the Item_null_helper is
      already fixed when the transformation is done.  But when executed as
      a prepared statement all the Item instances are "un-fixed" before the
      recompilation of the prepared statement. So when the Item_null_helper
      gets fixed it discovers that the Item_field it points to is not fixed
      and issues an error.  The remedy is to keep the original select list
      references when there are no tables in the FROM clause. So the above
      becomes : SELECT ... FROM ...  WHERE EXISTS (SELECT c FROM (SELECT f(..)
      AS c UNION SELECT ...) x HAVING a = c) In this way c is referenced
      directly in the select list as well as by reference in the HAVING
      clause. So it gets correctly fixed even with prepared statements.  And
      since the Item_null_helper subclass of Item_ref_null_helper is not used
      anywhere else it's taken out.
      
      
      mysql-test/r/ps_11bugs.result:
        Test case for the bug
      mysql-test/r/subselect.result:
        Explain updated because of the tranformation
      mysql-test/t/ps_11bugs.test:
        Testcase for the bug
      sql/item.cc:
        Taking out Item_null_helper as it's no longer needed
      sql/item.h:
        Taking out Item_null_helper as it's no longer needed
      sql/item_subselect.cc:
        The described change to the IN->EXISTS transformation
      3a0d0b4c
  34. 01 Apr, 2006 1 commit
    • unknown's avatar
      Fixed bug #16504. · 5ef6e903
      unknown authored
      Multiple equalities were not adjusted after reading constant tables.
      It resulted in neglecting good index based methods that could be
      used to access of other tables.
      
      
      mysql-test/r/having.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/r/select.result:
        Added a test case for bug #16504.
      mysql-test/r/subselect.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/r/varbinary.result:
        Adjusted a test case results after fix for bug #16504.
      mysql-test/t/select.test:
        Added a test case for bug #16504.
      sql/item.cc:
        Fixed bug #16504.
        An Item_equal object may contain only a constant member.
        It may happen after reading constant tables.
      sql/item_cmpfunc.cc:
        Fixed bug #16504.
        Added method Item_equal::check_const that check appearance of new 
        constant items in a multiple equality.
      sql/item_cmpfunc.h:
        Fixed bug #16504.
        Added method Item_equal::check_const that check appearance of new 
        constant items in a multiple equality.
      sql/sql_select.cc:
        Fixed bug #16504.
        Adjusted multiple equalities after reading constant tables.
        Fixed a few typo in comments.
      5ef6e903
  35. 23 Mar, 2006 1 commit
    • unknown's avatar
      Fix for bug #18306: MySQL crashes and restarts using subquery · abffce9c
      unknown authored
      mysql-test/r/subselect.result:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        test case
      mysql-test/t/subselect.test:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        test case
      sql/opt_range.cc:
        Fix for bug #18306: MySQL crashes and restarts using subquery
        Restore thd->mem_root because
        during the cond->val_int() evaluation we can come across a subselect 
        item which may allocate memory on the thd->mem_root and assumes
        all the memory allocated has the same life span as the subselect
        item itself.
      abffce9c
  36. 13 Mar, 2006 1 commit
    • unknown's avatar
      Fixed bug#17366: Unchecked Item_int results in server crash · 8ba5a687
      unknown authored
      When there is conjunction of conds, the substitute_for_best_equal_field()
      will call the eliminate_item_equal() function in loop to build final
      expression. But if eliminate_item_equal() finds that some cond will always
      evaluate to 0, then that cond will be substituted by Item_int with value ==
      0. In this case on the next iteration eliminate_item_equal() will get that 
      Item_int and treat it as Item_cond. This is leads to memory corruption and
      server crash on cleanup phase.
      
      To the eliminate_item_equal() function was added DBUG_ASSERT for checking
      that all items treaten as Item_cond are really Item_cond.
      The substitute_for_best_equal_field() now checks that if
      eliminate_item_equal() returns Item_int and it's value is 0 then this 
      value is returned as the result of whole conjunction.
      
      
      mysql-test/t/subselect.test:
        Added test for bug#17366: Unchecked Item_int results in server crash
      mysql-test/r/subselect.result:
         Added test for bug#17366: Unchecked Item_int results in server crash
      sql/sql_select.cc:
        Fixed bug#17366: Unchecked Item_int results in server crash
         
        To the eliminate_item_equal() function was added DBUG_ASSERT for checking
        that all items treaten as Item_cond are really Item_cond.
        The substitute_for_best_equal_field() now checks that if
        eliminate_item_equal() returns something other than Item_cond and if it is
        then this value is returned as the result of whole conjunction.
      8ba5a687
  37. 24 Feb, 2006 1 commit
    • unknown's avatar
      Fixes to embedded server to be able to run tests with it · 0afb6ff6
      unknown authored
      (Needed for "list of pushes" web page and autopush)
      
      
      include/mysql.h:
        Fix to embedded server to be able to run tests on it
      libmysql/libmysql.c:
        Fix to embedded server to be able to run tests on it
      libmysqld/emb_qcache.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/embedded_priv.h:
        Fix to embedded server to be able to run tests on it
      libmysqld/lib_sql.cc:
        Fix to embedded server to be able to run tests on it
      libmysqld/libmysqld.c:
        Fix to embedded server to be able to run tests on it
      mysql-test/mysql-test-run.sh:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/binlog.result:
        Updated test for embedded server
      mysql-test/r/ctype_cp932.result:
        Updated test for embedded server
      mysql-test/r/innodb.result:
        Updated test for embedded server
      mysql-test/r/mysqltest.result:
        Updated test for embedded server
      mysql-test/r/query_cache.result:
        Updated test for embedded server
      mysql-test/r/query_cache_notembedded.result:
        Updated test for embedded server
      mysql-test/r/sp-error.result:
        Updated test for embedded server
      mysql-test/r/sp.result:
        Updated test for embedded server
      mysql-test/r/subselect.result:
        Updated test for embedded server
      mysql-test/r/view.result:
        Updated test for embedded server
      mysql-test/r/view_grant.result:
        Updated test for embedded server
      mysql-test/t/backup.test:
        Updated test for embedded server
      mysql-test/t/binlog.test:
        Updated test for embedded server
      mysql-test/t/blackhole.test:
        Updated test for embedded server
      mysql-test/t/compress.test:
        Updated test for embedded server
      mysql-test/t/ctype_cp932.test:
        Updated test for embedded server
      mysql-test/t/delayed.test:
        Updated test for embedded server
      mysql-test/t/handler.test:
        Updated test for embedded server
      mysql-test/t/innodb.test:
        Updated test for embedded server
      mysql-test/t/mysql.test:
        Updated test for embedded server
      mysql-test/t/mysql_client_test.test:
        Updated test for embedded server
      mysql-test/t/mysqltest.test:
        Updated test for embedded server
      mysql-test/t/query_cache.test:
        Updated test for embedded server
      mysql-test/t/query_cache_notembedded.test:
        Updated test for embedded server
      mysql-test/t/read_only.test:
        Updated test for embedded server
      mysql-test/t/skip_grants.test:
        Updated test for embedded server
      mysql-test/t/sp-destruct.test:
        Updated test for embedded server
      mysql-test/t/sp-error.test:
        Updated test for embedded server
      mysql-test/t/sp-threads.test:
        Updated test for embedded server
      mysql-test/t/sp.test:
        Updated test for embedded server
      mysql-test/t/subselect.test:
        Updated test for embedded server
      mysql-test/t/temp_table.test:
        Updated test for embedded server
      mysql-test/t/view.test:
        Updated test for embedded server
      mysql-test/t/view_grant.test:
        Updated test for embedded server
      mysql-test/t/wait_timeout.test:
        Updated test for embedded server
      mysys/mf_dirname.c:
        Review fix: Don't access data outside of array
      mysys/my_bitmap.c:
        Remove compiler warnings
      scripts/mysql_fix_privilege_tables.sql:
        Add flush privileges to .sql script so that one doesn't have to reboot mysqld when one runs the mysql_fix_privilege_script
      sql-common/client.c:
        Updated test for embedded server
      sql/item.cc:
        Remove DBUG_PRINT statement that can cause crashes when running with --debug
      sql/mysqld.cc:
        Fix to embedded server to be able to run tests on it
      sql/protocol.cc:
        Fix to embedded server to be able to run tests on it
        (Trivial reconstruction of code)
      sql/protocol.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_base.cc:
        Better comment
      sql/sql_class.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_class.h:
        Fix to embedded server to be able to run tests on it
      sql/sql_cursor.cc:
        Fix to embedded server to be able to run tests on it
      sql/sql_parse.cc:
        Fix to embedded server to be able to run tests on it
        Don't crash for disabled commands when using embedded server
      sql/sql_prepare.cc:
        Fix to embedded server to be able to run tests on it
      mysql-test/r/ctype_cp932_notembedded.result:
        New BitKeeper file ``mysql-test/r/ctype_cp932_notembedded.result''
      mysql-test/r/innodb_notembedded.result:
        New BitKeeper file ``mysql-test/r/innodb_notembedded.result''
      mysql-test/r/sp.result.orig:
        New BitKeeper file ``mysql-test/r/sp.result.orig''
      mysql-test/r/sp_notembedded.result:
        New BitKeeper file ``mysql-test/r/sp_notembedded.result''
      mysql-test/r/subselect_notembedded.result:
        New BitKeeper file ``mysql-test/r/subselect_notembedded.result''
      mysql-test/t/ctype_cp932_notembedded.test:
        New BitKeeper file ``mysql-test/t/ctype_cp932_notembedded.test''
      mysql-test/t/innodb_notembedded.test:
        New BitKeeper file ``mysql-test/t/innodb_notembedded.test''
      mysql-test/t/sp.test.orig:
        New BitKeeper file ``mysql-test/t/sp.test.orig''
      mysql-test/t/sp_notembedded.test:
        New BitKeeper file ``mysql-test/t/sp_notembedded.test''
      mysql-test/t/subselect_notembedded.test:
        New BitKeeper file ``mysql-test/t/subselect_notembedded.test''
      0afb6ff6
  38. 22 Feb, 2006 1 commit
    • unknown's avatar
      Bug#10460 SHOW CREATE TABLE uses inconsistent upper/lower case · 31a7a0d6
      unknown authored
      mysql-test/r/alter_table.result:
        Update test result
      mysql-test/r/analyse.result:
        Update test result
      mysql-test/r/archive.result:
        Update test result
      mysql-test/r/archive_bitfield.result:
        Update test result
      mysql-test/r/archive_gis.result:
        Update test result
      mysql-test/r/bdb.result:
        Update test result
      mysql-test/r/bdb_gis.result:
        Update test result
      mysql-test/r/bigint.result:
        Update test result
      mysql-test/r/binary.result:
        Update test result
      mysql-test/r/case.result:
        Update test result
      mysql-test/r/cast.result:
        Update test result
      mysql-test/r/constraints.result:
        Update test result
      mysql-test/r/create.result:
        Update test result
      mysql-test/r/ctype_collate.result:
        Update test result
      mysql-test/r/ctype_create.result:
        Update test result
      mysql-test/r/ctype_latin1_de.result:
        Update test result
      mysql-test/r/ctype_many.result:
        Update test result
      mysql-test/r/ctype_mb.result:
        Update test result
      mysql-test/r/ctype_recoding.result:
        Update test result
      mysql-test/r/ctype_sjis.result:
        Update test result
      mysql-test/r/ctype_tis620.result:
        Update test result
      mysql-test/r/ctype_ucs.result:
        Update test result
      mysql-test/r/ctype_ujis.result:
        Update test result
      mysql-test/r/ctype_utf8.result:
        Update test result
      mysql-test/r/default.result:
        Update test result
      mysql-test/r/events.result:
        Update test result
      mysql-test/r/federated.result:
        Update test result
      mysql-test/r/fulltext.result:
        Update test result
      mysql-test/r/func_gconcat.result:
        Update test result
      mysql-test/r/func_group.result:
        Update test result
      mysql-test/r/func_math.result:
        Update test result
      mysql-test/r/func_misc.result:
        Update test result
      mysql-test/r/func_str.result:
        Update test result
      mysql-test/r/func_system.result:
        Update test result
      mysql-test/r/gis-rtree.result:
        Update test result
      mysql-test/r/heap.result:
        Update test result
      mysql-test/r/index_merge_innodb.result:
        Update test result
      mysql-test/r/information_schema.result:
        Update test result
      mysql-test/r/innodb.result:
        Update test result
      mysql-test/r/innodb_gis.result:
        Update test result
      mysql-test/r/key.result:
        Update test result
      mysql-test/r/merge.result:
        Update test result
      mysql-test/r/myisam.result:
        Update test result
      mysql-test/r/mysqldump-max.result:
        Update test result
      mysql-test/r/mysqldump.result:
        Update test result
      mysql-test/r/ndb_bitfield.result:
        Update test result
      mysql-test/r/ndb_gis.result:
        Update test result
      mysql-test/r/ndb_partition_key.result:
        Update test result
      mysql-test/r/null.result:
        Update test result
      mysql-test/r/partition.result:
        Update test result
      mysql-test/r/partition_02myisam.result:
        Update test result
      mysql-test/r/partition_mgm_err.result:
        Update test result
      mysql-test/r/partition_range.result:
        Update test result
      mysql-test/r/ps_2myisam.result:
        Update test result
      mysql-test/r/ps_3innodb.result:
        Update test result
      mysql-test/r/ps_4heap.result:
        Update test result
      mysql-test/r/ps_5merge.result:
        Update test result
      mysql-test/r/ps_6bdb.result:
        Update test result
      mysql-test/r/rpl_mixed_ddl_dml.result:
        Update test result
      mysql-test/r/rpl_multi_engine.result:
        Update test result
      mysql-test/r/rpl_ndb_UUID.result:
        Update test result
      mysql-test/r/show_check.result:
        Update test result
      mysql-test/r/sp-vars.result:
        Update test result
      mysql-test/r/sp.result:
        Update test result
      mysql-test/r/sql_mode.result:
        Update test result
      mysql-test/r/strict.result:
        Update test result
      mysql-test/r/subselect.result:
        Update test result
      mysql-test/r/symlink.result:
        Update test result
      mysql-test/r/synchronization.result:
        Update test result
      mysql-test/r/system_mysql_db.result:
        Update test result
      mysql-test/r/temp_table.result:
        Update test result
      mysql-test/r/trigger.result:
        Update test result
      mysql-test/r/type_binary.result:
        Update test result
      mysql-test/r/type_bit.result:
        Update test result
      mysql-test/r/type_bit_innodb.result:
        Update test result
      mysql-test/r/type_blob.result:
        Update test result
      mysql-test/r/type_decimal.result:
        Update test result
      mysql-test/r/type_enum.result:
        Update test result
      mysql-test/r/type_float.result:
        Update test result
      mysql-test/r/type_nchar.result:
        Update test result
      mysql-test/r/type_newdecimal.result:
        Update test result
      mysql-test/r/type_set.result:
        Update test result
      mysql-test/r/type_timestamp.result:
        Update test result
      mysql-test/r/type_varchar.result:
        Update test result
      mysql-test/r/union.result:
        Update test result
      mysql-test/r/user_var.result:
        Update test result
      mysql-test/r/variables.result:
        Update test result
      sql/sql_show.cc:
        Make ouput from SHOW CREATE TABLE use uppercase for "CHARACTER SET", "COLLATE", "DEFAULT", "ON UPDATE" and "AUTO_INCREMENT"
      31a7a0d6