Commit graph

1798 commits

Author SHA1 Message Date
unknown
8479eb1db7 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt


client/mysqldump.c:
  Auto merged
include/config-win.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
myisam/sort.c:
  Auto merged
mysql-test/r/func_sapdb.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
mysql-test/r/type_datetime.result:
  manual merge
mysql-test/r/type_decimal.result:
  manual merge
mysql-test/t/type_datetime.test:
  manual merge
mysql-test/t/type_decimal.test:
  manual merge
sql/item.cc:
  manual merge
2007-10-23 18:51:43 +05:00
unknown
e1dc86b079 type conversions fixed to avoid warnings on Windows
myisam/mi_write.c:
  type conversion fixed
myisam/sort.c:
  type conversion fixed
sql/ha_federated.cc:
  type conversion fixed
sql/ha_heap.cc:
  type conversion fixed
sql/ha_innodb.cc:
  type conversion fixed
sql/ha_myisam.cc:
  type conversion fixed
sql/opt_range.cc:
  type conversion fixed
sql/sql_map.cc:
  type conversion fixed
sql/sql_select.cc:
  type conversion fixed
sql/sql_update.cc:
  type conversion fixed
2007-10-23 14:27:11 +05:00
unknown
1a5f13a12c Fix for bug #31249: Assertion `!table || (!table->write_set ||
bitmap_is_set(table->write_set, fiel

Problem: creating a temporary table we allocate the group buffer if needed
followed by table bitmaps (see create_tmp_table()). Reserving less memory for 
the group buffer than actually needed (used) for values retrieval may lead 
to overlapping with followed bitmaps in the memory pool that in turn leads 
to unpredictable consequences.

As we use Item->max_length sometimes to calculate group buffer size,
it must be set to proper value. In this particular case 
Item_datetime_typecast::max_length is too small.

Another problem is that we use max_length to calculate the group buffer
key length for items represented as DATE/TIME fields which is superfluous.

Fix: set Item_datetime_typecast::max_length properly,
accurately calculate the group buffer key length for items 
represented as DATE/TIME fields in the buffer.


mysql-test/r/type_datetime.result:
  Fix for bug #31249: Assertion `!table || (!table->write_set || 
  bitmap_is_set(table->write_set, fiel
    - test result.
mysql-test/t/type_datetime.test:
  Fix for bug #31249: Assertion `!table || (!table->write_set || 
  bitmap_is_set(table->write_set, fiel
    - test case.
sql/item_timefunc.h:
  Fix for bug #31249: Assertion `!table || (!table->write_set || 
  bitmap_is_set(table->write_set, fiel
    - set Item_datetime_typecast::max_length properly.
sql/sql_select.cc:
  Fix for bug #31249: Assertion `!table || (!table->write_set || 
  bitmap_is_set(table->write_set, fiel
    - the group buffer key length for items represented as 
  DATE/TIME fields in the buffer should be calculated using
  the maximum pack length of such fields (== 8), using 
  max_length here is redundant.
2007-10-09 14:37:21 +05:00
unknown
fd76cce346 fixed a warning in the fix for bug 28702 2007-10-02 17:45:49 +03:00
unknown
37beea410c Fixed a valgrind warning with the fix for bug 28702. 2007-10-02 15:36:07 +03:00
unknown
084cbc7ed8 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/27990-bug-5.0-opt-mysql


sql/field.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
2007-09-28 23:27:23 +00:00
unknown
6a8bd84a82 Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
The change_to_use_tmp_fields function leaves the orig_table member of an
expression's tmp table field filled for the new Item_field being created.
Later orig_table is used by the Field::make_field function to provide some
info about original table and field name to a user. This is ok for a field
but for an expression it should be empty.

The change_to_use_tmp_fields function now resets orig_table member of
an expression's tmp table field to prevent providing a wrong info to a user.
The Field::make_field function now resets the table_name and the org_col_name
variables when the orig_table is set to 0.


sql/field.cc:
  Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
  The Field::make_field function now resets the table_name and the org_col_name
  variables when the orig_table is set to 0.
sql/sql_select.cc:
  Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
  The change_to_use_tmp_fields function now resets orig_table member of
  an expression's tmp table field to prevent providing a wrong info to a user.
tests/mysql_client_test.c:
  The test case for the bug#21635 is altered to test behavior on both const and
  non-const tables.
2007-09-28 23:24:40 +00:00
unknown
ca448acc25 Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
When storing the VIEW the CREATE VIEW command is reconstructed 
from the parse tree. While constructing the command string
the index hints specified should also be printed.
Fixed by adding code to print the index hints when printing a 
table in the FROM clause.


mysql-test/r/view.result:
  Bug #28702: test case
mysql-test/t/view.test:
  Bug #28702: test case
sql/sql_select.cc:
  Bug #28702: preserve index hints in a VIEW definition.
sql/table.h:
  Bug #28702: preserve index hints in a VIEW definition.
2007-09-24 15:34:10 +03:00
unknown
139b563ec4 Merge sita.local:/Users/tsmith/m/bk/50
into  sita.local:/Users/tsmith/m/bk/maint/50


client/mysql.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
mysql-test/Makefile.am:
  Auto merged
sql/sql_select.cc:
  Auto merged
2007-09-24 11:33:27 +02:00
unknown
ad496be063 Bug #31001: ORDER BY DESC in InnoDB not working
The optimizer sets index traversal in reverse order only if there are 
 used key parts that are not compared to a constant.
However using the primary key as an ORDER BY suffix rendered the check
incomplete : going in reverse order must still be used even if 
all the parts of the secondary key are compared to a constant.

Fixed by relaxing the check and set reverse traversal even when all
the secondary index keyparts are compared to a const.
Also account for the case when all the primary keys are compared to a
constant.


mysql-test/r/innodb_mysql.result:
  Bug #31001: test case
mysql-test/t/innodb_mysql.test:
  Bug #31001: test case
sql/sql_select.cc:
  Bug #31001: 
   - account for the case when all the primary key parts are compared
     to a constant
   - force test_if_skip_sort_order to go backwards over the key even 
     when the number of keyparts used is the same as the number of 
     keyparts equal to a constant. (because of the primary key 
     suffix).
2007-09-14 17:43:14 +03:00
unknown
9a75cc814b Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  damien-katzs-computer.local:/Users/dkatz/mysql50


sql/sql_select.cc:
  Auto merged
2007-09-05 15:08:30 -04:00
unknown
bd1f34d932 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30377-5.0-opt


sql/sql_select.cc:
  Auto merged
2007-08-29 12:47:24 +03:00
unknown
bdf19dc73b Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/bugx/my50-bugx


mysql-test/t/innodb_mysql.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  SCCS merged
2007-08-29 10:49:19 +02:00
unknown
310afbd4a9 Bug #30377: EXPLAIN loses last_query_cost when used with UNION
Currently the Last_query_cost session status variable shows
only the cost of a single flat subselect. For complex queries
(with subselects or unions etc) Last_query_cost is not valid
as it was showing the cost for the last optimized subselect.
Fixed by reseting to zero Last_query_cost when the complete
cost of the query cannot be determined.
Last_query_cost will be non-zero only for single flat queries.


mysql-test/r/status.result:
  Bug #30377: test case
mysql-test/t/status.test:
  Bug #30377: test case
sql/sql_lex.h:
  Bug #30377: helper function
sql/sql_select.cc:
  Bug #30377: don't assign cost if not on single level statement
2007-08-28 18:51:03 +03:00
unknown
2368664681 Bug #30596 GROUP BY optimization gives wrong result order
The optimization that uses a unique index to remove GROUP BY, did not 
ensure that the index was actually used, thus violating the ORDER BY
that is impled by GROUP BY.
Fixed by replacing GROUP BY with ORDER BY if the GROUP BY clause contains
a unique index. In case GROUP BY ... ORDER BY null is used, GROUP BY is
simply removed.


BitKeeper/etc/ignore:
  Added support-files/mysqld_multi.server tests/bug25714 cscope.in.out cscope.out cscope.po.out to the ignore list
mysql-test/r/distinct.result:
  Bug#30596: Changed test case. 
  Prior to Bug#16458, These queries use temp table and filesort. The
  bug was that they used a temp table. However, that patch removed
  filesort also, in which case we can no longer gurantee correct ordering.
mysql-test/r/group_by.result:
  Bug#30596: Correct result
mysql-test/r/innodb_mysql.result:
  Bug#30596: Test case for innodb. Here, as opposed to for MyISAM, row 
  lookup is done using index whenever the index covers the group list.
mysql-test/t/group_by.test:
  Bug#30596: Test case
mysql-test/t/innodb_mysql.test:
  Bug#30596: Test case
sql/sql_select.cc:
  Bug#30596: The fix, replacing GROUP BY with ORDER BY unless 
  ORDER BY [NULL|<constant>]
2007-08-27 17:33:41 +02:00
unknown
5b03876f2e sql_select.cc:
Additional fix for the bug#30245.


sql/sql_select.cc:
  Additional fix for the bug#30245.
2007-08-25 17:32:17 +00:00
unknown
e19f49ae5e Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/30245-bug-5.0-opt-mysql


sql/sql_select.cc:
  Auto merged
2007-08-24 22:11:23 +00:00
unknown
792145bae1 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30287
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_select.cc:
  Auto merged
2007-08-21 19:30:32 +05:00
unknown
7c3d5bc5c4 Fixed bug #30287.
The server created temporary tables for filesort in the working directory
instead of the specified tmpdir directory.


sql/item.cc:
  Fixed bug #30287.
  The Item_field::set_field method has been modified to reset the any_privileges
  flag to false in case of system temporary table. This modification prevents the
  server from unnecessary checking of user privileges to access system temporary
  tables.
sql/sql_select.cc:
  Fixed bug #30287.
  Bugfix for #29015 has been removed: TABLE_SHARE::table_name of system
  temporary tables contains full path to table file basename again.
sql/sql_view.cc:
  Fixed bug #30287.
  Commentary has been added.
2007-08-21 01:39:39 +05:00
unknown
d280a06e36 Bug#30245: A wrong type of a BIT field is reported when grouped by it.
HEAP tables can't index BIT fields. Due to this when grouping by such fields is
needed they are converted to a fields of the LONG type when temporary table
is being created. But a side effect of this is that a wrong type of BIT
fields is returned to a client.

Now the JOIN::prepare and the create_distinct_group functions are create
additional hidden copy of BIT fields to preserve original fields untouched.
New hidden fields are used for grouping instead.


mysql-test/t/type_bit.test:
  Added a test case for the bug#30245: A wrong type of a BIT field is reported when grouped by it.
mysql-test/r/type_bit.result:
  Added a test case for the bug#30245: A wrong type of a BIT field is reported when grouped by it.
sql/sql_select.cc:
  Bug#30245: A wrong type of a BIT field is reported when grouped by it.
  Now the JOIN::prepare and the create_distinct_group functions are create
  additional hidden copy of BIT fields to preserve original fields untouched.
  New hidden fields are used for grouping instead.
2007-08-17 18:30:41 +04:00
unknown
a8f8e5483e Fixed bug #30396.
The bug caused memory corruption for some queries with top OR level
in the WHERE condition if they contained equality predicates and 
other sargable predicates in disjunctive parts of the condition.

The corruption happened because the upper bound of the memory
allocated for KEY_FIELD and SARGABLE_PARAM internal structures
containing info about potential lookup keys was calculated incorrectly
in some cases. In particular it was calculated incorrectly when the
WHERE condition was an OR formula with disjuncts being AND formulas
including equalities and other sargable predicates.


mysql-test/r/select.result:
  Added a test case for bug #30396.
mysql-test/t/select.test:
  Added a test case for bug #30396.
sql/item_cmpfunc.h:
  Removed max_members from the COND_EQUAL class as not useful anymore.
sql/sql_base.cc:
  Added the max_equal_elems field to the st_select_lex structure.
sql/sql_lex.cc:
  Added the max_equal_elems field to the st_select_lex structure.
sql/sql_lex.h:
  Added the max_equal_elems field to the st_select_lex structure.
  The field contains the maximal number of elements in multiple equalities
  built for the query conditions.
sql/sql_select.cc:
  Fixed bug #30396.
  The bug caused memory corruption for some queries with top OR level
  in the WHERE condition if they contained equality predicates and 
  other sargable predicates in disjunctive parts of the condition.
  
  The corruption happened because the upper bound of the memory
  allocated for KEY_FIELD and SARGABLE_PARAM internal structures
  containing info about potential lookup keys was calculated incorrectly
  in some cases. In particular it was calculated incorrectly when the
  WHERE condition was an OR formula with disjuncts being AND formulas
  including equalities and other sargable predicates.
   
  The max_equal_elems field to the st_select_lex structure is used now
  to calculate the above mentioned upper bound. The field contains the
  maximal number of elements in multiple equalities built for the query
  conditions.
2007-08-15 10:24:18 -07:00
unknown
3e7b724c69 Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  damien-katzs-computer.local:/Users/dkatz/mysql50


sql/sql_select.cc:
  Auto merged
2007-08-03 14:14:15 -04:00
unknown
a66cb1f27a Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.0-bug29582


sql/sql_select.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
2007-07-31 15:24:22 +04:00
unknown
8a68e7d2dc BUG#29582: huge memory consumption with union, subselect, joins:
- Don't call mysql_select() several times for the select that enumerates
  a temporary table with the results of the UNION. Making this call for
  every subquery execution caused O(#enumerated-rows-in-the-outer-query) 
  memory allocations.
- Instead, call join->reinit() and join->exec(), and
  = disable constant table detection for such joins,  
  = provide special handling for table-less constant subqueries.


sql/sql_select.cc:
  BUG#29582: huge memory consumption with union, subselect, joins:
   - Don't mark tables as constant if JOIN::no_const_tables flag is set
sql/sql_select.h:
  BUG#29582: huge memory consumption with union, subselect, joins:
   - Don't mark tables as constant if JOIN::no_const_tables flag is set
sql/sql_union.cc:
  BUG#29582: huge memory consumption with union, subselect, joins:
  - Don't call mysql_select() several times for the select that enumerates
    a temporary table with UNION results. 
  - Instead, call join->reinit() and join->exec().
  - Provide special handling for table-less constant subqueries.
2007-07-31 15:19:06 +04:00
unknown
2dc02f2424 Merge mysql.com:/home/hf/work/29717/my41-29717
into  mysql.com:/home/hf/work/29717/my50-29717


mysql-test/t/insert_select.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/group_by.result:
  merging
mysql-test/r/insert_select.result:
  merging
mysql-test/t/group_by.test:
  merging
sql/sql_select.h:
  merging
2007-07-31 11:03:31 +05:00
unknown
6b745cf601 Merge mysql.com:/home/hf/work/029717/my41-29717
into  mysql.com:/home/hf/work/29717/my41-29717


sql/sql_select.cc:
  Auto merged
2007-07-31 11:00:19 +05:00
unknown
791584ae0d Bug #29717 INSERT INTO SELECT inserts values even if
SELECT statement itself returns empty.

As a result of this bug 'SELECT AGGREGATE_FUNCTION(fld) ... GROUP BY'
can return one row instead of an empty result set.

When GROUP BY only has fields of constant tables
(with a single row), the optimizer deletes the group_list.
After that we lose the information about whether we had an
GROUP BY statement. Though it's important
as SELECT min(x) from empty_table; and
   SELECT min(x) from empty_table GROUP BY y; have to return
different results - the first query should return one row,
second - an empty result set.
So here we add the 'group_optimized_away' flag to remember this case
when GROUP BY exists in the query and is removed
by the optimizer, and check this flag in end_send_group()


mysql-test/r/group_by.result:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test result
mysql-test/r/insert_select.result:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test result
mysql-test/t/group_by.test:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  This is additional testcase that is more basic than the
  original bug's testcase and has the same reason.
mysql-test/t/insert_select.test:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  test case
sql/sql_select.cc:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  Remember the 'GROUP BY was optimized away' case in the JOIN::group_optimized
  and check this in the end_send_group()
sql/sql_select.h:
  Bug #29717 INSERT INTO SELECT inserts values even if
   SELECT statement itself returns empty.
  
  JOIN::group_optimized member added to remember the 'GROUP BY optimied away'
  case
2007-07-31 10:46:04 +05:00
unknown
575fea4a98 Bug #29419 "Specifying a join_buffer > 4GB on 64 bit machines not possible."
Use size_t instead of uint when calculating join buffer size, because uint can be overflown on 64-bit platforms and join_buffer_size > 4 GB.

The test case for this bug is a part of the test suite for bug #5731.


sql/sql_select.cc:
  Use size_t instead of uint when calculating join buffer size, because uint can be overflown on 64-bit platforms and join_buffer_size > 4G.
2007-07-27 16:26:26 -04:00
unknown
9206f68477 BUG#28591: make the fix work for BDB tables too:
- make ha_berkeley::cmp_ref() take into account that auto-generated PKs 
   are stored in LSB-first order. 
 - Remove the temporary code that made the bugfix work for innodb only 


mysql-test/r/bdb.result:
  Adjust test-results.
sql/ha_berkeley.cc:
  BUG#28591: make the fix work for BDB tables too:
   - make ha_berkeley::cmp_ref() take into account that auto-generated PKs 
     are stored in LSB-first order.
sql/sql_select.cc:
  BUG#28591: Remove "innodb only" clause as the fix now works for BDB too
sql/table.cc:
  BUG#28591: Remove "innodb only" clause as the fix now works for BDB too
2007-07-26 20:52:53 +04:00
unknown
c38fa3f3ac table.cc, sql_select.cc:
Limit the fix for bug 28591 to InnoDB only


sql/sql_select.cc:
  Limit the fix for bug 28591 to InnoDB only
sql/table.cc:
  Limit the fix for bug 28591 to InnoDB only
2007-07-23 06:26:57 +03:00
unknown
240bb90ef1 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B28951-5.0-opt


mysql-test/t/innodb_mysql.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/table.cc:
  Auto merged
mysql-test/r/innodb_mysql.result:
  merge of 5.0-opt
2007-07-22 19:23:29 +03:00
unknown
3520da5b25 Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug29911
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug29911


mysql-test/t/having.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/having.result:
  SCCS merged
2007-07-21 12:34:18 -07:00
unknown
72c6c789cf Fixed bug #29911.
This bug manifested itself for join queries with GROUP BY and HAVING clauses
whose SELECT lists contained DISTINCT. It occurred when the optimizer could
deduce that the result set would have not more than one row.
The bug could lead to wrong result sets for queries of this type because
HAVING conditions were erroneously ignored in some cases in the function
remove_duplicates.   


mysql-test/r/having.result:
  Added a test case for bug #29911.
mysql-test/t/having.test:
  Added a test case for bug #29911.
2007-07-20 22:56:19 -07:00
unknown
95a8c6c327 Bug #28591: MySQL need not sort the records in case of
ORDER BY primary_key on InnoDB table

Queries that use an InnoDB secondary index to retrieve
data don't need to sort in case of ORDER BY primary key
if the secondary index is compared to constant(s).
They can also skip sorting if ORDER BY contains both the
the secondary key parts and the primary key parts (in
that order).
This is because InnoDB returns the rows in order of the
primary key for rows with the same values of the secondary
key columns.
Fixed by preventing temp table sort for the qualifying 
queries.


mysql-test/r/innodb_mysql.result:
  Bug #28591: test case
mysql-test/t/innodb_mysql.test:
  Bug #28591: test case
sql/sql_select.cc:
  Bug #28591: Use the primary key as suffix when testing
  if the key can be used for ORDER BY on supporting engines.
sql/table.cc:
  Bug #28591: can use the primary key
  as a suffix for the secondary keys
2007-07-20 21:05:29 +03:00
unknown
c865b22514 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/ha_myisam.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
2007-07-19 19:57:53 +05:00
unknown
b1e5568043 Fixed bug #29604.
A bug in the restore_prev_nj_state function allowed interleaving 
inner tables of outer join operations with outer tables. With the
current implementation of the nested loops algorithm it could lead
to wrong result sets for queries with nested outer joins.
Another bug in this procedure effectively blocked evaluation of some
valid execution plans for queries with nested outer joins. 


mysql-test/r/join_nested.result:
  Added a test case for bug #29604.
mysql-test/t/join_nested.test:
  Added a test case for bug #29604.
2007-07-11 18:45:35 -07:00
unknown
360a5ebc37 Remove typedef st_table_list TABLE_LIST and always use name 'TABLE_LIST'.
The need arose when working on Bug 26141, where it became
necessary to replace TABLE_LIST with its forward declaration in a few
headers, and this involved a lot of s/TABLE_LIST/st_table_list/.
Although other workarounds exist, this patch is in line
with our general strategy of moving away from typedef-ed names.
Sometime in future we might also rename TABLE_LIST to follow the
coding style, but this is a huge change.


sql/item.cc:
  st_table_list -> TABLE_LIST
sql/item.h:
  st_table_list -> TABLE_LIST
sql/mysql_priv.h:
  st_table_list -> TABLE_LIST
sql/sql_base.cc:
  st_table_list -> TABLE_LIST
sql/sql_lex.cc:
  st_table_list -> TABLE_LIST
sql/sql_lex.h:
  st_table_list -> TABLE_LIST
sql/sql_select.cc:
  st_table_list -> TABLE_LIST
sql/sql_show.cc:
  st_table_list -> TABLE_LIST
sql/sql_udf.h:
  Was not needed.
sql/table.cc:
  st_table_list -> TABLE_LIST
sql/table.h:
  st_table_list -> TABLE_LIST
2007-07-06 16:18:49 +04:00
unknown
c2e961cf2e Bug#27333: subquery grouped for aggregate of outer
query / no aggregate of subquery
 The optimizer counts the aggregate functions that 
 appear as top level expressions (in all_fields) in 
 the current subquery. Later it makes a list of these
 that it uses to actually execute the aggregates in
 end_send_group().
 That count is used in several places as a flag whether
 there are aggregates functions.
 While collecting the above info it must not consider
 aggregates that are not aggregated in the current 
 context. It must treat them as normal expressions 
 instead. Not doing that leads to incorrect data about
 the query, e.g. running a query that actually has no
 aggregate functions as if it has some (and hence is
 expected to return only one row).
 Fixed by ignoring the aggregates that are not aggregated
 in the current context. 
 One other smaller omission discovered and fixed in the 
 process : the place of aggregation was not calculated for
 user defined functions. Fixed by calling 
 Item_sum::init_sum_func_check() and 
 Item_sum::check_sum_func() as it's done for the rest of 
 the aggregate functions.


mysql-test/r/subselect.result:
  Bug #27333: test case
mysql-test/t/subselect.test:
  Bug #27333: test case
sql/item_subselect.cc:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
sql/item_sum.cc:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
sql/item_sum.h:
  Bug#27333: calculate the place of 
   aggregation for user defined functions.
sql/sql_select.cc:
  Bug#27333: When counting the aggregated functions
   and collecting a list of them we must not consider
   the aggregates that are not aggregated in the local
   context as "local" : i.e. we must treat them as 
   normal functions and not add them to the aggregate
   functions list.
sql/sql_select.h:
  Bug#27333: need select_lex to filter out
   aggregates that are not aggregated in
   the current select.
2007-06-29 10:39:17 +03:00
unknown
00b3d3c245 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/dev/shm/mhansson/my50-bug28677


sql/sql_class.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
2007-06-27 14:02:32 +02:00
unknown
f30db30991 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25602


sql/sql_select.cc:
  Auto merged
2007-06-24 10:50:24 -07:00
unknown
e009b764b9 Fixed bug #25602. A query with DISTINCT in the select list to which
the loose scan optimization for grouping queries was applied returned 
a wrong result set when the query was used with the SQL_BIG_RESULT
option.

The SQL_BIG_RESULT option forces to use sorting algorithm for grouping
queries instead of employing a suitable index. The current loose scan
optimization is applied only for one table queries when the suitable
index is covering. It does not make sense to use sort algorithm in this
case. However the create_sort_index function does not take into account
the possible choice of the loose scan to implement the DISTINCT operator
which makes sorting unnecessary. Moreover the current implementation of
the loose scan for queries with distinct assumes that sorting will
never happen. Thus in this case create_sort_index should not call
the function filesort.


mysql-test/r/group_min_max.result:
  Added a test case for bug #25602.
mysql-test/t/group_min_max.test:
  Added a test case for bug #25602.
2007-06-23 23:33:55 -07:00
unknown
1bab1ddc55 Fixed bug #29095.
INSERT into table from SELECT from the same table
with ORDER BY and LIMIT was inserting other data
than sole SELECT ... ORDER BY ... LIMIT returns.

One part of the patch for bug #9676 improperly pushed
LIMIT to temporary table in the presence of the ORDER BY
clause.
That part has been removed.


sql/sql_select.cc:
  Fixed bug #29095.
  One part of the patch for bug #9676 improperly pushed
  LIMIT to temporary table in the presence of the ORDER BY
  clause.
  That part has been removed.
mysql-test/t/insert_select.test:
  Expanded the test case for bug #9676.
  Created a test case for bug #29095.
mysql-test/r/insert_select.result:
  Expanded the test case for bug #9676.
  Created a test case for bug #29095.
2007-06-24 01:20:14 +05:00
unknown
e2aa6ee13e Merge gleb.loc:/home/uchum/work/bk/5.0-opt-28898
into  gleb.loc:/home/uchum/work/bk/5.0-opt


sql/sql_select.cc:
  Auto merged
2007-06-20 13:06:24 +05:00
unknown
e855bf33b3 Fixed bug #28898.
For a join query with GROUP BY and/or ORDER BY and a view reference
in the FROM list the metadata erroneously showed empty table aliases
and database names for the view columns.



sql/item.h:
  Fixed bug #28898.
  Body of Item_ref::get_tmp_table_item method has been moved
  to item.cc file.
mysql-test/t/metadata.test:
  Updated test case for bug #28898.
sql/item.cc:
  Fixed bug #28898.
  The Item_ref::get_tmp_table_item method has been modified
  to copy pointers to the table alias and database name to the new
  Item_field object created for a field stored in the temporary
  table.
mysql-test/r/metadata.result:
  Updated test case for bug #28898.
sql/sql_select.cc:
  Fixed bug #28898.
  The change_to_use_tmp_fields function has been modified to
  to copy pointers to the table alias and database name from
  the Item_ref objects to the new Item_field objects created
  for fields stored in the temporary table.
2007-06-20 12:25:07 +05:00
unknown
3d31e3d641 Bug#28677: SELECT on missing column gives extra error
The method select_insert::send_error does two things, it rolls back a statement
being executed and outputs an error message. But when a 
nonexistent column is referenced, an error message has been published already and
there is no need to publish another.
Fixed by moving all functionality beyond publishing an error message into 
select_insert::abort() and calling only that function.


mysql-test/r/errors.result:
  Bug#28677: test result
mysql-test/t/errors.test:
  Bug#28677: test case
sql/sql_class.h:
  Bug#28677: overriding abort()
sql/sql_insert.cc:
  Bug#28677: 
  - moved everything beyond producing an error message out of select_insert::send_error 
  and into new override select_insert::abort() 
  - made corresponding move of code from select_create::send_error to select_create::abort
sql/sql_select.cc:
  Bug#28677: No need to pusblish an error here
2007-06-18 16:35:01 +03:00
unknown
cb93ff4d02 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/50


configure.in:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/binlog.result:
  Auto merged
mysql-test/r/have_log_bin.require:
  Auto merged
BitKeeper/deleted/.del-ctype_cp932_notembedded.test:
  Auto merged
mysql-test/t/binlog.test:
  Auto merged
mysql-test/t/ctype_cp932_binlog.test:
  Auto merged
mysql-test/t/ctype_ucs_binlog.test:
  Auto merged
mysql-test/t/flush_block_commit_notembedded.test:
  Auto merged
mysql-test/t/insert_select-binlog.test:
  Auto merged
mysql-test/t/mysqlbinlog-cp932.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/sp_trans.test:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/mix_innodb_myisam_binlog.result:
  Use local
mysql-test/t/blackhole.test:
  manual merge
mysql-test/t/drop_temp_table.test:
  manual merge
mysql-test/t/mix_innodb_myisam_binlog.test:
  Use local
mysql-test/t/mysqlbinlog.test:
  Use local
2007-06-14 23:23:30 +02:00
unknown
6f168d1255 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt


client/mysqltest.c:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/innodb_mysql.result:
  merging
mysql-test/t/innodb_mysql.test:
  merging
sql/sql_select.cc:
  merging
2007-06-14 16:41:10 +05:00
unknown
d447929a02 Merge polly.local:/home/kaa/src/maint/bug28895/my50-bug28895
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint


sql/sql_select.cc:
  Auto merged
2007-06-12 11:42:39 +04:00
unknown
1c4ab3106e Fix for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long"
In create_tmp_table() don't set full table path as a table name. Other code assumes table names to not exceed NAME_LEN bytes.


sql/sql_select.cc:
  In create_tmp_table() don't set full table path as a table name. Other code assumes table names to not exceed NAME_LEN bytes.
mysql-test/r/long_tmpdir.result:
  Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long"
mysql-test/t/long_tmpdir-master.opt:
  Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long"
mysql-test/t/long_tmpdir-master.sh:
  Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long"
mysql-test/t/long_tmpdir.test:
  Added testcase for bug #29015 "Stack overflow in processing temporary table name when tmpdir path is long"
2007-06-11 23:06:20 +04:00
unknown
89d96dd48e Fixed bug #28449: a crash may happen at some rare conditions when
a temporary table has grown out of heap memory reserved for it and 
the remaining disk space is not big enough to store the table as
a MyISAM table.

The crash happens because the function create_myisam_from_heap
does not handle safely the mem_root structure associated 
with the converted table in the case when an error has occurred.


sql/sql_select.cc:
  Fixed bug #28449: a crash may happen at some rare conditions when
  a temporary table has grown out of heap memory reserved for it and 
  the remaining disk space is not big enough to store the table as
  a MyISAM table.
  
  The crash happens because the function create_myisam_from_heap
  does not handle safely the mem_root structure associated 
  with the converted table in the case when an error has occurred.
  
  As it's hard to create a sitiation that would throw an error 
  a special code has been added that raises an error for a newly 
  created test called error_simulation.
mysql-test/r/error_simulation.result:
  New BitKeeper file ``mysql-test/r/error_simulation.result''
  
  Added a test case for bug #28449.
mysql-test/t/error_simulation-master.opt:
  New BitKeeper file ``mysql-test/t/error_simulation-master.opt''
mysql-test/t/error_simulation.test:
  New BitKeeper file ``mysql-test/t/error_simulation.test''
  
  Added a test case for bug #28449.
2007-06-07 00:59:08 -07:00