Commit graph

2267 commits

Author SHA1 Message Date
dkatz@damien-katzs-computer.local
f672f5dcd2 Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  damien-katzs-computer.local:/Users/dkatz/mysql50
2007-09-05 15:08:30 -04:00
gkodinov/kgeorge@magare.gmz
625c44fe67 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30377-5.0-opt
2007-08-29 12:47:24 +03:00
mhansson/martin@linux-st28.site
f672e5bca6 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/bugx/my50-bugx
2007-08-29 10:49:19 +02:00
gkodinov/kgeorge@magare.gmz
acf0ebe69f Merge magare.gmz:/home/kgeorge/mysql/work/B30377-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B30377-5.1-opt
2007-08-29 11:38:05 +03:00
mhansson/martin@linux-st28.site
2df0485d93 Merge mhansson@bk-internal:/home/bk/mysql-5.1-opt
into  linux-st28.site:/home/martin/mysql/src/5.1o-bug30596
2007-08-28 18:17:44 +02:00
mhansson/martin@linux-st28.site
98d34d620c 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 implied by GROUP BY.
Fixed by replacing GROUP BY with ORDER BY if the GROUP BY clause contains
a unique index over non-nullable field(s). In case GROUP BY ... ORDER BY 
null is used, GROUP BY is simply removed.
2007-08-28 18:01:29 +02:00
gkodinov/kgeorge@magare.gmz
cfaa0983c8 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.
2007-08-28 18:51:03 +03:00
mhansson/martin@linux-st28.site
a4d5d9204d 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.
2007-08-27 17:33:41 +02:00
gshchepa/uchum@gleb.loc
2adf3ee743 Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-08-25 23:28:23 +05:00
gshchepa/uchum@gleb.loc
ced93cb35e Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-08-25 22:32:18 +05:00
evgen@moonbone.local
36a2950016 sql_select.cc:
Additional fix for the bug#30245.
2007-08-25 17:32:17 +00:00
evgen@moonbone.local
2ee3efc240 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/30245-bug-5.0-opt-mysql
2007-08-24 22:11:23 +00:00
jani@a88-113-38-195.elisa-laajakaista.fi
b25dacbdee Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-08-24 15:25:02 +03:00
df@pippilotta.erinye.com
6d068a5ac7 Merge dfischer@bk-internal.mysql.com:/home/bk/mysql-5.1-build
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
2007-08-24 10:13:03 +02:00
gshchepa@bk-internal.mysql.com
46e58466cb Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/users/gshchepa/mysql-5.1-opt
2007-08-23 21:38:24 +02:00
joerg@trift2.
d4d4f8528e Manual merge of parallel development in separate team trees. 2007-08-22 17:13:42 +02:00
jani@hynda.mysql.fi
6519de0469 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-08-22 17:29:38 +03:00
joerg@trift2.
20ce606797 Merge trift2.:/MySQL/M51/target-5.1.22
into  trift2.:/MySQL/M51/push-5.1

Includes manual merges.
2007-08-22 16:08:55 +02:00
jani@hynda.mysql.fi
2fd7a743e4 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-08-21 19:03:28 +03:00
gshchepa/uchum@gleb.loc
f5f65c40f1 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30287
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-08-21 19:46:29 +05:00
gshchepa/uchum@gleb.loc
c652d3df95 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30287
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-08-21 19:30:32 +05:00
gshchepa/uchum@gleb.loc
5d3809c264 Fixed bug #30287.
The server created temporary tables for filesort in the working directory
instead of the specified tmpdir directory.
2007-08-21 01:39:39 +05:00
malff/marcsql@weblab.(none)
1c27dd1d67 Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-08-20 11:13:31 -06:00
evgen@moonbone.local
9a83ddda69 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.
2007-08-17 18:30:41 +04:00
igor@olga.mysql.com
ff3f6e806b Merge olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug30396
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt-bug30396
2007-08-16 17:22:50 -07:00
igor@olga.mysql.com
d790ec42e1 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.
2007-08-15 10:24:18 -07:00
kostja@bodhi.(none)
2537a87fb5 Provide initial module structure to Doxygen. 2007-08-15 19:08:44 +04:00
monty@narttu.mysql.fi
9d609a59fd Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-08-14 00:22:34 +03:00
monty@mysql.com/nosik.monty.fi
e53a73e26c Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db

I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read()      -> index_read_map()
index_read_idx()  -> index_read_idx_map()
index_read_last() -> index_read_last_map()
2007-08-13 16:11:25 +03:00
gshchepa/uchum@gleb.loc
db6ec3f71f Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-08-11 02:00:51 +05:00
igor@olga.mysql.com
a5e4e70100 Merge olga.mysql.com:/home/igor/mysql-5.1
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt-merge
2007-08-04 22:36:54 -07:00
igor@olga.mysql.com
fd3be5034e Removed warnings after fix for bug 28404. 2007-08-04 20:31:48 -07:00
igor@olga.mysql.com
d51731a322 Fixed a memory leak in the patch for bug 28404. 2007-08-03 21:10:57 -07:00
dkatz@damien-katzs-computer.local
f64ef11906 Merge dkatz@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  damien-katzs-computer.local:/Users/dkatz/mysql50
2007-08-03 14:14:15 -04:00
igor@olga.mysql.com
9c09b7d523 Merge olga.mysql.com:/home/igor/mysql-5.1-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt-bug28404
2007-08-03 08:46:01 -07:00
df@pippilotta.erinye.com
493634e4c7 Merge bk-internal:/home/bk/mysql-5.1-marvel
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build-marvel-engines
2007-08-03 17:15:23 +02:00
gluh@mysql.com/eagle.(none)
27ab885525 WL#3732 Information schema optimization 2007-08-03 03:14:05 +05:00
igor@olga.mysql.com
cf39429295 Fixed bug#28404.
This patch adds cost estimation for the queries with ORDER BY / GROUP BY
and LIMIT. 
If there was a ref/range access to the table whose rows were required
to be ordered in the result set the optimizer always employed this access
though a scan by a different index that was compatible with the required 
order could be cheaper to produce the first L rows of the result set.
Now for such queries the optimizer makes a choice between the cheapest
ref/range accesses not compatible with the given order and index scans
compatible with it.
2007-08-02 12:45:56 -07:00
evgen@moonbone.local
9c8673de05 Merge moonbone.local:/mnt/gentoo64/work/24989-bug-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-08-02 18:42:56 +04:00
monty@nosik.monty.fi
93f0771fca Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-08-02 07:55:33 +03:00
tsmith@ramayana.hindu.god
b13de9343f Merge 50 -> 51 (-opt changesets) 2007-08-01 18:59:41 -06:00
tsmith@ramayana.hindu.god
a52a078f75 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/51
2007-08-01 18:40:02 -06:00
tsmith@ramayana.hindu.god
70e14610d6 Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/jul31/51
2007-07-31 17:36:19 -06:00
dkatz@damien-katzs-computer.local
1919076d47 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.
2007-07-31 16:36:29 -04:00
sergefp@pylon.mylan
3c9594b0c6 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.0-bug29582
2007-07-31 15:24:22 +04:00
sergefp@mysql.com
c37f9b9e79 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.
2007-07-31 15:19:06 +04:00
holyfoot/hf@hfmain.(none)
d72a6b1227 Merge mysql.com:/home/hf/work/29717/my50-29717
into  mysql.com:/home/hf/work/29717/my51-29717
2007-07-31 11:12:23 +05:00
holyfoot/hf@hfmain.(none)
0ff0ed2732 Merge mysql.com:/home/hf/work/29717/my41-29717
into  mysql.com:/home/hf/work/29717/my50-29717
2007-07-31 11:03:31 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
288ab1aa41 Merge mysql.com:/home/hf/work/029717/my41-29717
into  mysql.com:/home/hf/work/29717/my41-29717
2007-07-31 11:00:19 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
f1ee2d0687 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()
2007-07-31 10:46:04 +05:00
monty@mysql.com/nosik.monty.fi
b16289a5e0 Slow query log to file now displays queries with microsecond precission
--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init()
2007-07-30 11:33:50 +03:00
dkatz@damien-katzs-computer.local
7c2c8f07e4 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.
2007-07-27 16:26:26 -04:00
gshchepa/uchum@gleb.loc
e6c7e7d630 Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-27 13:38:11 +05:00
sergefp@mysql.com
9c8262da33 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
2007-07-26 20:52:53 +04:00
gshchepa/uchum@gleb.loc
dfbfeeceb3 table.cc, sql_select.cc:
Post-merge fix.
2007-07-26 04:41:48 +05:00
gshchepa/uchum@gleb.loc
f129754096 sql_select.cc:
Post-merge fix.
2007-07-26 04:08:58 +05:00
gshchepa/uchum@gleb.loc
3595bbb34c Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-26 01:23:39 +05:00
monty@mysql.com/nosik.monty.fi
dd81895e45 Added support for 'internal temporary tables' in HEAP tables.
Now we don't take any mutexes when creating or dropping internal HEAP tables during SELECT.
Change buffer sizes to size_t to make keycache 64 bit safe on platforms where sizeof(ulong) != sizeof(size_t)
2007-07-25 01:58:12 +03:00
gkodinov/kgeorge@magare.gmz
bc1a6ba954 table.cc, sql_select.cc:
Limit the fix for bug 28591 to InnoDB only
2007-07-23 06:26:57 +03:00
gkodinov/kgeorge@magare.gmz
7402fd6e79 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B28951-5.0-opt
2007-07-22 19:23:29 +03:00
igor@olga.mysql.com
43dab6b5de 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
2007-07-21 12:34:18 -07:00
igor@olga.mysql.com
07e0cd2f4e 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.
2007-07-20 22:56:19 -07:00
gkodinov/kgeorge@magare.gmz
8fc401e21f 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.
2007-07-20 21:05:29 +03:00
gshchepa/uchum@gleb.loc
35a2a20160 Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-19 20:01:13 +05:00
gshchepa/uchum@gleb.loc
d5f2133bc3 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-19 19:57:53 +05:00
kostja@bodhi.(none)
88fc7cab26 Merge bodhi.(none):/opt/local/work/mysql-5.0-runtime
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-07-16 23:31:36 +04:00
gshchepa/uchum@gleb.loc
1674d8dc35 Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-13 19:36:10 +05:00
igor@olga.mysql.com
7f64144bf0 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.
2007-07-11 18:45:35 -07:00
kostja@bodhi.(none)
a33bc2c247 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.
2007-07-06 16:18:49 +04:00
igor@olga.mysql.com
259fdbf9ca Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt
2007-06-30 20:49:28 -07:00
gkodinov/kgeorge@magare.gmz
38172240e3 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.
2007-06-29 10:39:17 +03:00
mhansson@dl145s.mysql.com
a90ff73738 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/dev/shm/mhansson/my50-bug28677
2007-06-27 14:02:32 +02:00
mhansson@dl145s.mysql.com
bba87ad34e Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  dl145s.mysql.com:/dev/shm/mhansson/my51-bug28677
2007-06-25 12:50:12 +02:00
igor@olga.mysql.com
31bd1715db Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt
2007-06-24 19:06:09 -07:00
gshchepa/uchum@gleb.loc
a1ebc8590c Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-06-25 03:40:30 +05:00
igor@olga.mysql.com
da41606087 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25602
2007-06-24 10:50:24 -07:00
igor@olga.mysql.com
59b9077ce4 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.
2007-06-23 23:33:55 -07:00
gshchepa/uchum@gleb.loc
2cd4abebfb Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-06-24 03:35:27 +05:00
gshchepa/uchum@gleb.loc
fbbb30a622 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.
2007-06-24 01:20:14 +05:00
gshchepa/uchum@gleb.loc
5d056de5ff Merge gleb.loc:/home/uchum/work/bk/5.0-opt-28898
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-06-20 13:06:24 +05:00
gshchepa/uchum@gleb.loc
2379f9778d 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.
2007-06-20 12:25:07 +05:00
kostja@bodhi.(none)
68632318dc Manual merge. 2007-06-19 15:02:08 +04:00
mhansson/martin@linux-st28.site
26371209bf Merge linux-st28.site:/home/martin/mysql/src/bug28677/my50-bug28677
into  linux-st28.site:/home/martin/mysql/src/bug28677/my51-bug28677
2007-06-18 17:22:21 +03:00
mhansson/martin@linux-st28.site
cc2d534ab1 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.
2007-06-18 16:35:01 +03:00
malff/marcsql@weblab.(none)
7e36d37eb0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-06-15 11:36:31 -06:00
tsmith@quadxeon.mysql.com
918090030b Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-build
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/51
2007-06-15 01:57:33 +02:00
tsmith@quadxeon.mysql.com
87fdad4ce8 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/50
2007-06-14 23:23:30 +02:00
holyfoot/hf@hfmain.(none)
1e9373fd60 Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-06-14 16:42:43 +05:00
holyfoot/hf@hfmain.(none)
8ccc50b303 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
2007-06-14 16:41:10 +05:00
kaa@polly.local
120dae4c21 Merge polly.local:/home/kaa/src/maint/bug28895/my51-bug28895
into  polly.local:/home/kaa/src/maint/mysql-5.1-maint
2007-06-12 11:48:43 +04:00
kaa@polly.local
780a3dae0c Merge polly.local:/home/kaa/src/maint/bug28895/my50-bug28895
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint
2007-06-12 11:42:39 +04:00
kaa@polly.local
80f839a36e Merge polly.local:/home/kaa/src/maint/bug28895/my50-bug28895
into  polly.local:/home/kaa/src/maint/bug28895/my51-bug28895
2007-06-12 09:42:19 +04:00
malff/marcsql@weblab.(none)
e6f9d712aa Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-06-11 15:57:59 -06:00
kaa@polly.local
0f5a1e5910 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.
2007-06-11 23:06:20 +04:00
evgen@moonbone.local
a52c981d6a Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-06-11 00:16:00 +04:00
kostja@bodhi.(none)
6c352d16d9 Follow up after work on Bug 4968
Coding style: classes start with a capital letter.
Rename some classes related to parsing:
create_field -> Create_field
foreign_key -> Foreign_key
key_part_spec -> Key_part_spec
2007-06-10 14:43:57 +04:00
igor@olga.mysql.com
569960410f 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.
2007-06-07 00:59:08 -07:00
tsmith@quadxeon.mysql.com
0ca0984f59 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/51
2007-06-05 23:06:43 +02:00
tsmith@quadxeon.mysql.com
d2fe24d1ef Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/50
2007-06-05 23:04:40 +02:00
tsmith@quadxeon.mysql.com
4b93804592 Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/51
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/51
2007-06-05 17:51:30 +02:00
igor@olga.mysql.com
a5011de0a8 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt-merge
2007-06-04 03:16:17 -07:00
igor@olga.mysql.com
ca49b83d5a Merge olga.mysql.com:/home/igor/mysql-5.1
into  olga.mysql.com:/home/igor/mysql-5.1-opt-merge
2007-06-03 22:52:02 -07:00
igor@olga.mysql.com
5cbebf0a18 Fixed bug #28728: a crash when executing EXPLAIN EXTENDED for a query
using a derived table over a grouping subselect.

This crash happens only when materialization of the derived tables 
requires creation of auxiliary temporary table, for example when
a grouping operation is carried out with usage of a temporary table.

The crash happened because EXPLAIN EXTENDED when printing the query
expression made an attempt to use the objects created in the mem_root
of the temporary table which has been already freed by the moment
when printing is called.

This bug appeared after the method Item_field::print() had been 
introduced.
2007-06-02 11:44:16 -07:00
kostja@bodhi.(none)
16633169e4 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-06-01 12:12:06 +04:00
ibabaev@bk-internal.mysql.com
d460dc700a Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-opt
2007-06-01 06:33:37 +02:00
gshchepa/uchum@gleb.loc
78a5f9e6b9 sql_select.cc:
Patch to eliminate compilation error.
2007-05-31 20:32:18 +05:00
kaa@polly.local
1239481b13 Merge polly.local:/home/kaa/src/maint/bug27643/my51-bug27643
into  polly.local:/home/kaa/src/maint/mysql-5.1-maint
2007-05-31 15:05:11 +04:00
kaa@polly.local
054da00167 Merge polly.local:/home/kaa/src/maint/bug27643/my50-bug27643
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint
2007-05-31 15:01:49 +04:00
kaa@polly.local
16f7290359 Merge polly.local:/home/kaa/src/maint/bug27643/my50-bug27643
into  polly.local:/home/kaa/src/maint/bug27643/my51-bug27643
2007-05-31 14:58:22 +04:00
kaa@polly.local
d435b3ed74 Fix for bug #27643 "query failed : 1114 (The table '' is full)
Problem:

HASH indexes on VARCHAR columns with binary collations did not ignore trailing spaces from strings before comparisons. This could result in duplicate records being successfully inserted into a MEMORY table with unique key constraints.

As a direct consequence of the above, internal MEMORY tables used for GROUP BY calculation in testcases for bug #27643 contained duplicate rows which resulted in duplicate key errors when converting those temporary tables to MyISAM. Additionally, that error was incorrectly converted to the 'table is full' error.

Solution:

- ignore trailing spaces in VARCHAR fields with binary collations when calculating hashes.
- return a proper error from create_myisam_from_heap() when conversion fails.
2007-05-31 14:54:44 +04:00
holyfoot/hf@hfmain.(none)
cdda302fc1 Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-05-31 14:23:45 +05:00
gshchepa/uchum@gleb.loc
be69f13dff Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/mysql-5.0-opt-28598
2007-05-31 12:43:59 +05:00
gshchepa/uchum@gleb.loc
e16953dfd8 Fixed bug #28598.
mysqld crashed when a long-running explain query was killed from
another connection.

When the current thread caught a kill signal executing the function
best_extension_by_limited_search it just silently returned to  
the calling function greedy_search without initializing elements of
the join->best_positions array.
However, the greedy_search function ignored thd->killed status
after a calls to the best_extension_by_limited_search function, and
after several calls the greedy_search function used an uninitialized
data from the join->best_positions[idx] to search position in the
join->best_ref array. 
That search failed, and greedy_search tried to call swap_variables
function with NULL argument - that caused a crash.
2007-05-31 12:10:21 +05:00
evgen@moonbone.local
75afe5cab5 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-05-30 19:35:35 +04:00
gkodinov/kgeorge@magare.gmz
a5b04a3ba9 Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a
Integer values with 10 digits may or may not fit into an int column 
(e.g. 2147483647 vs 6147483647).
Thus when creating a temp table column for such an int we must
use bigint instead.
Fixed to use bigint.
Also subsituted a "magic number" with a named constant.
2007-05-30 09:55:38 +03:00
gkodinov/kgeorge@macbook.gmz
fe03f6bbe0 Bug #27531: 5.1 part of the fix
- Renamed "Using join cache" to "Using join buffer".
- "Using join buffer" is now printed on the last
  table that "reads" from the join buffer cache.
2007-05-29 15:58:18 +03:00
gshchepa/uchum@gleb.loc
fae737b426 Merge gleb.loc:/home/uchum/work/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/mysql-5.1-opt
2007-05-28 00:22:44 +05:00
igor@olga.mysql.com
bed482c2f9 Avoided warnings on Windows. 2007-05-26 13:19:36 -07:00
igor@olga.mysql.com
fbebb47efe Fixed bug #28571. Outer join queries with ON conditions over
constant outer tables did not return null complemented
rows when conditions were evaluated to FALSE.
Wrong results were returned because the conditions over constant
outer tables, when being pushed down, were erroneously enclosed 
into the guard function used for WHERE conditions.
2007-05-26 10:33:01 -07:00
kostja@vajra.(none)
0162745cff Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  vajra.(none):/opt/local/work/mysql-5.1-runtime
2007-05-24 19:34:14 +04:00
jani@a88-113-38-195.elisa-laajakaista.fi
fc3b3a0a86 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-05-24 13:24:36 +03:00
igor@olga.mysql.com
428d2b6547 Fixed bug #28561: assertion abort for update on multi-table view with
CHECK OPTION and a subquery in WHERE condition.
The abort was triggered by setting the value of join->tables for
subqueries in the function JOIN::cleanup. This function was called
after an invocation of the JOIN::join_free method for subqueries
used in WHERE condition.
2007-05-23 19:04:12 -07:00
malff/marcsql@weblab.(none)
782096dbcc Bug#21554 (sp_cache.cc: violates C++ aliasing rules)
The problem reported is a compile bug,
reported by the development GCC team with GCC 4.2.

The original issue can no longer be reproduced in MySQL 5.1,
since the configure script no longer define HAVE_ATOMIC_ADD,
which caused the Linux atomic functions to be used (and cause a problem
with an invalid cast).

This patch implements some code cleanup for 5.1 only, which was identified
during the investigation of this issue.

With this patch, statistics maintained in THD::status_var are by definition
owned by the running thread, and do not need to be protected against race
conditions. These statistics are maintained by the status_var_* helpers,
which do not require any lock.
2007-05-22 13:41:40 -06:00
mhansson@dl145s.mysql.com
debb054d4a Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/users/mhansson/mysql/autopush/mysql-5.0o-pushee
2007-05-22 18:30:23 +02:00
gkodinov/kgeorge@magare.gmz
604ef46327 Bug #28476: force index on a disabled myisam index gives error 124
When processing the USE/FORCE index hints
the optimizer was not checking if the indexes 
specified are enabled (see ALTER TABLE).
Fixed by:
 Backporting the fix for bug 20604 to 5.0
2007-05-22 15:58:30 +03:00
mhansson@dl145s.mysql.com
d6cf093408 Merge dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/my50-bug23856
into  dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/mysql-5.0o-pushee
2007-05-22 14:48:49 +02:00
mhansson@dl145s.mysql.com
6870631ed4 Merge dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/my51-bug23856
into  dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/mysql-5.1o-pushee
2007-05-22 09:54:04 +02:00
mhansson@dl145s.mysql.com
2abc880b82 Merge dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/my50-bug23856
into  dl145s.mysql.com:/users/mhansson/mysql/push/bug23856/my51-bug23856
2007-05-21 14:28:31 +02:00
mhansson@dl145s.mysql.com
6530f6806a bug#23856 2007-05-21 10:27:33 +02:00
holyfoot/hf@hfmain.(none)
85d5dfedf6 Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-05-18 20:00:49 +05:00
igor@olga.mysql.com
fea67e6868 Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug28272
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug28272
2007-05-15 13:16:10 -07:00
gluh@mysql.com/eagle.(none)
579cce54ab WL#3823 Modify VARIABLE_VALUE columns to VARCHAR within INFORMATION_SCHEMA STATUS tables 2007-05-15 12:45:50 +05:00
igor@olga.mysql.com
268be06874 Fixed bug #28272: crash that occurs when running an EXPLAIN command
for a query over an empty table right after its creation. 
The crash is the result of an attempt made by JOIN::optimize to evaluate
the WHERE condition when no records have been actually read.
The added test case can reproduce the crash only with InnoDB tables and
only with 5.0.x.
2007-05-14 23:55:18 -07:00
holyfoot/hf@hfmain.(none)
a475a84564 Merge mysql.com:/home/hf/work/27957/my50-27957
into  mysql.com:/home/hf/work/27957/my51-27957
2007-05-11 17:48:20 +05:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

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

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

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

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
igor@olga.mysql.com
53888b4282 Fixed bug #28189: in some rare cases optimizer preferred a more expensive
ref access to a less expensive range access. 
This occurred only with InnoDB tables.
2007-05-10 00:06:24 -07:00
cmiller@zippy.cornsilk.net
79d652408d Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-unified02
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-comeng-unification
2007-05-07 16:59:03 -04:00
acurtis/antony@ltamd64.xiphis.org
b8301263f3 Merge xiphis.org:/home/antony/work2/mysql-5.1-engines
into  xiphis.org:/home/antony/work2/mysql-5.1-merge
2007-05-07 12:32:09 -07:00
holyfoot/hf@hfmain.(none)
763d4bf22e Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-05-07 16:12:42 +05:00
acurtis/antony@ltamd64.xiphis.org
a4dbc0990c Merge xiphis.org:/home/antony/work2/mysql-5.1-engines
into  xiphis.org:/home/antony/work2/mysql-5.1-engines.merge
2007-05-04 23:35:14 -07:00
gkodinov/kgeorge@magare.gmz
13e55b8a21 bug #27531:
fixed coverage of out-of-mem errors
2007-05-04 18:55:01 +03:00
gkodinov/kgeorge@magare.gmz
306371a850 bug #27531: 5.1 part of the fix:
- added join cache indication in EXPLAIN (Extra column).
 - prefer filesort over full scan over 
   index for ORDER BY (because it's faster).
 - when switching from REF to RANGE because
   RANGE uses longer key turn off sort on
   the head table only as the resulting 
   RANGE access is a candidate for join cache
   and we don't want to disable it by sorting
   on the first table only.
2007-05-04 18:06:06 +03:00
gkodinov/kgeorge@magare.gmz
19b9c7a8cd Merge magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27531-5.1-opt-after-merge
2007-05-04 17:46:13 +03:00
gkodinov/kgeorge@magare.gmz
cead246f7a Merge magare.gmz:/home/kgeorge/mysql/work/B27531-4.1-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt
2007-05-04 16:47:58 +03:00
gkodinov/kgeorge@magare.gmz
d11e1f248b Bug #27531: the 4.1 fix.
When checking for applicability of join cache
we must disable its usage only if there is no
temp table in use.
When a temp table is used we can use join
cache (and it will not make the result-set 
unordered) to fill the temp table. The filesort() 
operation is then applied to the data in the temp 
table and hence is not affected by join cache
usage.
Fixed by narrowing the condition for disabling 
join cache to exclude the case where temp table
is used.
2007-05-04 16:43:29 +03:00
gkodinov/kgeorge@magare.gmz
ee624171eb Merge magare.gmz:/home/kgeorge/mysql/work/B27531-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27531-5.1-opt
2007-05-04 16:37:30 +03:00
gkodinov/kgeorge@magare.gmz
27624ee4e8 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B27807-5.0-opt
2007-05-04 10:57:14 +03:00
gkodinov/kgeorge@magare.gmz
6badb08ce3 Bug #27807.
Non-correlated scalar subqueries may get executed
in EXPLAIN at the optimization phase if they are
part of a right hand sargable expression.
If the scalar subquery uses a temp table to 
materialize its results it will replace the 
subquery structure from the parser with a simple
select from the materialization table.
As a result the EXPLAIN will crash as the 
temporary materialization table is not to be shown
in EXPLAIN at all.
Fixed by preserving the original query structure
right after calling optimize() for scalar subqueries
with temp tables executed during EXPLAIN.
2007-05-04 10:48:51 +03:00
igor@olga.mysql.com
1a0cf6db7c Fixed bug #28188: performance degradation for outer join queries to which
'not exists' optimization is applied.

In fact 'not exists' optimization did not work anymore after the patch
introducing the evaluate_join_record function had been applied.

Corrected the evaluate_join_record function to respect the 'not_exists'
optimization.
2007-05-01 23:34:14 -07:00
holyfoot/hf@hfmain.(none)
53cdf37af1 Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-05-01 13:38:59 +05:00
igor@olga.mysql.com
2cf753a1e8 Post-merge fix. 2007-04-29 20:14:35 -07:00
igor@olga.mysql.com
f9ac5b43cc Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug24856
2007-04-29 18:32:59 -07:00
igor@olga.mysql.com
ce0be732d0 Fixed bug #24856: the result set of a ROLLUP query with DISTINCT could lack
some rollup rows (rows with NULLs for grouping attributes) if GROUP BY
list contained constant expressions.

This happened because the results of constant expressions were not put
in the temporary table used for duplicate elimination. In fact a constant
item from the GROUP BY list of a ROLLUP query can be replaced for an
Item_null_result object when a rollup row is produced . 

Now the JOIN::rollup_init function wraps any constant item referenced in
the GROYP BY list of a ROLLUP query into an Item_func object of a special
class that is never detected as constant item. This ensures creation of
fields for such  constant items in temporary tables and guarantees right
results when the result of the rollup operation first has to be written
into a temporary table, e.g. in the cases when duplicate elimination is
required.
2007-04-29 16:04:43 -07:00
holyfoot/hf@hfmain.(none)
2fcebef31f Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-04-29 13:19:32 +05:00
cmiller@zippy.cornsilk.net
71a0ecee6e Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-enterprise-formergecomm
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-unified02
2007-04-27 16:45:01 -04:00
istruewing@chilla.local
e327818c28 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into  chilla.local:/home/mydev/mysql-5.1-wl2936-two
2007-04-27 19:09:39 +02:00
evgen@moonbone.local
72e53ede3a Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/27590-bug-5.0-opt-mysql
2007-04-27 21:07:05 +04:00
evgen@moonbone.local
4747fa0c03 Bug#27590: Wrong DATE/DATETIME comparison.
DATE and DATETIME can be compared either as strings or as int. Both
methods have their disadvantages. Strings can contain valid DATETIME value
but have insignificant zeros omitted thus became non-comparable with
other DATETIME strings. The comparison as int usually will require conversion
from the string representation and the automatic conversion in most cases is
carried out in a wrong way thus producing wrong comparison result. Another
problem occurs when one tries to compare DATE field with a DATETIME constant.
The constant is converted to DATE losing its precision i.e. losing time part.

This fix addresses the problems described above by adding a special
DATE/DATETIME comparator. The comparator correctly converts DATE/DATETIME
string values to int when it's necessary, adds zero time part (00:00:00)
to DATE values to compare them correctly to DATETIME values. Due to correct
conversion malformed DATETIME string values are correctly compared to other
DATE/DATETIME values.

As of this patch a DATE value equals to DATETIME value with zero time part.
For example '2001-01-01' equals to '2001-01-01 00:00:00'.

The compare_datetime() function is added to the Arg_comparator class.
It implements the correct comparator for DATE/DATETIME values.
Two supplementary functions called get_date_from_str() and get_datetime_value()
are added. The first one extracts DATE/DATETIME value from a string and the
second one retrieves the correct DATE/DATETIME value from an item.
The new Arg_comparator::can_compare_as_dates() function is added and used
to check whether two given items can be compared by the compare_datetime()
comparator.
Two caching variables were added to the Arg_comparator class to speedup the
DATE/DATETIME comparison.
One more store() method was added to the Item_cache_int class to cache int
values.
The new is_datetime() function was added to the Item class. It indicates
whether the item returns a DATE/DATETIME value.
2007-04-27 00:12:09 +04:00
cmiller@zippy.cornsilk.net
9dd7812fec Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-formerge51
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-enterprise-formergecomm
2007-04-25 08:14:46 -04:00
gkodinov/kgeorge@magare.gmz
429371f9d5 - addendum of the fix for bug 27786:
applied the new function is_union() to places
  in the code that check the same condition.
- 5.0->5.1 merge fixes
2007-04-23 14:16:49 +03:00
sergefp@mysql.com
479c8cdaad Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.0-bug27939
2007-04-20 17:30:15 +04:00
mhansson@dl145s.mysql.com
f0fc4b88e0 Bug #24778: Innodb: No result when using ORDER BY
This bug was intruduced by the fix for bug#17212 (in 4.1). It is not 
ok to call test_if_skip_sort_order since this function will 
alter the execution plan. By contract it is not ok to call 
test_if_skip_sort_order in this context.

This bug appears only in the case when the optimizer has chosen 
an index for accessing a particular table but finds a covering 
index that enables it to skip ORDER BY. This happens in 
test_if_skip_sort_order.
2007-04-20 11:01:53 +02:00
sergefp@mysql.com
83e6352cc9 BUG#27939: Early NULLs filtering doesn't work for eq_ref access
- Turn it on for JT_EQ_REF access method
2007-04-19 03:04:23 +04:00
serg@sergbook.mysql.com
6bc9bc92df Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.1-wl2936
2007-04-16 10:37:50 +02:00
evgen@moonbone.local
392fb72f5c Merge moonbone.local:/mnt/gentoo64/work/27321-bug-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
2007-04-15 12:05:13 +04:00
evgen@moonbone.local
922a5a969c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/27321-bug-5.0-opt-mysql
2007-04-15 08:41:35 +04:00
evgen@moonbone.local
3113ce6383 Bug#27321: Wrong subquery result in a grouping select.
The Item_outer_ref class based on the Item_direct_ref class was always used
to represent an outer field. But if the outer select is a grouping one and the 
outer field isn't under an aggregate function which is aggregated in that
outer select an Item_ref object should be used to represent such a field.
If the outer select in which the outer field is resolved isn't grouping then
the Item_field class should be used to represent such a field.
This logic also should be used for an outer field resolved through its alias
name.

Now the Item_field::fix_outer_field() uses Item_outer_field objects to
represent aliased and non-aliased outer fields for grouping outer selects
only.
Now the fix_inner_refs() function chooses which class to use to access outer
field - the Item_ref or the Item_direct_ref. An object of the chosen class
substitutes the original field in the Item_outer_ref object.
The direct_ref and the found_in_select_list fields were added to the
Item_outer_ref class.
2007-04-15 08:31:34 +04:00
igor@olga.mysql.com
e04289704d Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt
2007-04-11 15:12:49 -07:00
gkodinov/kgeorge@magare.gmz
aefc060fe5 Bug #27659:
The optimizer transforms DISTINCT into a GROUP BY
when possible.
It does that by constructing the same structure
(a list of ORDER instances) the parser makes when
parsing GROUP BY.
While doing that it also eliminates duplicates.
But if a duplicate is found it doesn't advance the
pointer to ref_pointer array, so the next 
(and subsequent) ORDER structures point to the wrong
element in the SELECT list.
Fixed by advancing the pointer in ref_pointer_array
even in the case of a duplicate.
2007-04-10 16:55:48 +03:00
cmiller@zippy.cornsilk.net
5f4dfdd5fe Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-04-03 09:20:22 -04:00
ibabaev@bk-internal.mysql.com
898ec87e14 Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
2007-04-02 03:56:39 +02:00
igor@olga.mysql.com
5534f099f1 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt
2007-04-01 14:00:56 -07:00
lars/lthalmann@mysql.com/dl145h.mysql.com
cec17aa0ba Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-03-31 12:36:50 +02:00
igor@olga.mysql.com
0c5ba6246b Fixed bug #27154: memory corruption when using row equalities in where
conditions.
When allocating memory for KEY_FIELD/SARGABLE_PARAM structures the
function update_ref_and_keys did not take into account the fact that
a single row equality could be replaced by several simple equalities.
Fixed by adjusting the counter cond_count accordingly for each subquery
when performing substitution of a row equality for simple equalities.
2007-03-31 00:23:03 -07:00
evgen@moonbone.local
f470ac2000 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
2007-03-31 02:42:40 +04:00
lars/lthalmann@mysql.com/dl145j.mysql.com
9c6dc8c853 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-03-31 00:15:20 +02:00
gkodinov/kgeorge@magare.gmz
fca2a0c4ac Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26815-5.0-opt
2007-03-29 19:20:33 +03:00
lars/lthalmann@mysql.com/dl145h.mysql.com
75668471d1 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-03-29 12:25:28 +02:00
gkodinov/kgeorge@magare.gmz
c3eb3f7093 Bug #27300:
Geometry fields have a result type string and a 
  special subclass to cater for the differences
  between them and the base class (just like 
  DATE/TIME).
  When creating temporary tables for results of 
  functions that return results of type GEOMETRY
  we must construct fields of the derived class 
  instead of the base class.
  Fixed by creating a GEOMETRY field (Field_geom) 
  instead of a generic BLOB (Field_blob) in temp 
  tables for the results of GIS functions that 
  have GEOMETRY return type (Item_geometry_func).
2007-03-28 14:35:23 +03:00
gkodinov/kgeorge@magare.gmz
4f2ec8f3de Bug #26815:
When creating a temporary table the concise column type
 of a string expression is decided based on its length:
 - if its length is under 512 it is stored as either 
   varchar or char.
 - otherwise it is stored as a BLOB.
 
 There is a flag (convert_blob_length) to create_tmp_field 
 that, when >0 allows to force creation of a varchar if the
 max blob length is under convert_blob_length.
 However it must be verified that convert_blob_length 
 (settable through a SQL option in some cases) is 
 under the maximum that can be stored in a varchar column.
 While performing that check for expressions in 
 create_tmp_field_from_item the max length of the blob was
 used instead. This causes blob columns to be created in the
 heap temp table used by GROUP_CONCAT (where blobs must not
 be created in the temp table because of the constant 
 convert_blob_length that is passed to create_tmp_field() ).
 And since these blob columns are not expected in that place
 we get wrong results.
 Fixed by checking that the value of the flag variable is 
 in the limits that fit into VARCHAR instead of the max length
 of the blob column.
2007-03-27 19:28:04 +03:00
gkodinov/kgeorge@magare.gmz
bd3a0ce1d9 Merge magare.gmz:/home/kgeorge/mysql/work/WL3527-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/WL3527-5.1-opt
2007-03-26 17:03:57 +03:00
igor@olga.mysql.com
18ea806864 This is a fix for the memory corruption occurred in one of test cases
from func_group.test after the patch for bug #27229 had been applied.
The memory corruption happened because in some rare cases the function
count_field_types underestimated the number of elements in
in the array param->items_to_copy.
2007-03-25 23:44:06 -07:00
igor@olga.mysql.com
92d1d74037 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27229
2007-03-22 14:51:20 -07:00
igor@olga.mysql.com
8f9178e857 Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Ensured correct setting of the depended_from field in references
generated for set functions aggregated in outer selects.
A wrong value of this field resulted in wrong maps returned by 
used_tables() for these references.
Made sure that a temporary table field is added for any set function
aggregated in outer context when creation of a temporary table is 
needed to execute the inner subquery.
2007-03-22 14:48:03 -07:00
guilhem@gbichot3.local
f0a95a4e20 - renaming TMP_TABLE to NON_TRANSACTIONAL_TMP_TABLE because this is
what it actually means (Monty approved the renaming)
- correcting description of transaction_alloc command-line options
(our manual is correct)
- fix for a failure of rpl_trigger.
2007-03-22 15:07:32 +01:00
holyfoot/hf@mysql.com/hfmain.(none)
1f9fd51c6d Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:21:06 +04:00
holyfoot/hf@hfmain.(none)
59bcb87766 Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-22 12:20:51 +04:00
holyfoot/hf@hfmain.(none)
d24fb40374 Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-22 11:43:23 +04:00
gkodinov/kgeorge@magare.gmz
354c364ad4 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B24484-5.0
2007-03-20 19:49:38 +02:00
gkodinov/kgeorge@macbook.local
28962a76a3 Bug #24484:
To correctly decide which predicates can be evaluated with a given table
the optimizer must know the exact set of tables that a predicate depends 
on. If that mask is too wide (refer to non-existing tables) the optimizer
can erroneously skip a predicate.
One such case of wrong table usage mask were the aggregate functions.
The have a all-1 mask (meaning depend on all tables, including non-existent
ones).
Fixed by making a real used_tables mask for the aggregates. The mask is
constructed in the following way :
1. OR the table dependency masks of all the arguments of the aggregate.
2. If all the arguments of the function are from the local name resolution 
  context and it is evaluated in the same name resolution
  context where it is referenced all the tables from that name resolution 
  context are OR-ed to the dependency mask. This is to denote that an
  aggregate function depends on the number of rows it processes.
3. Handle correctly the case of an aggregate function optimization (such that
  the aggregate function can be pre-calculated and made a constant).

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

One other flaw was revealed and fixed in the process : references were 
not calling the recalculation method for used_tables of their targets.
2007-03-20 19:46:02 +02:00
kostja@bodhi.local
bdb10baec1 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-03-20 00:42:11 +03:00
kostja@bodhi.local
a9065201d5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-19 23:59:53 +03:00
serg@janus.mylan
68fd66e853 wl#3700 - post-review fixes:
s/ulonglong/key_part_map/, comments
2007-03-17 00:13:25 +01:00
serg@janus.mylan
55a548cf4d Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  janus.mylan:/usr/home/serg/Abk/mysql-5.1
2007-03-16 20:33:27 +01:00
serg@janus.mylan
f813272125 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  janus.mylan:/usr/home/serg/Abk/mysql-5.1
2007-03-16 14:09:30 +01:00
malff/marcsql@weblab.(none)
e677c6e70f Manual merge from 5.0-runtime to 5.1-runtime 2007-03-14 17:38:06 -06:00
mhansson/martin@linux-st28.site
e61cce4d6b Bug #24778: Innodb: No result when using ORDER BY
This bug was intruduced by the fix for bug#17212 (in 4.1). It is not 
ok to call test_if_skip_sort_order since this function will 
alter the execution plan. By contract it is not ok to call 
test_if_skip_sort_order in this context.

This bug appears only in the case when the optimizer has chosen 
an index for accessing a particular table but finds a covering 
index that enables it to skip ORDER BY. This happens in 
test_if_skip_sort_order.
2007-03-14 12:15:14 +01:00
gkodinov/kgeorge@magare.gmz
f2ce1445e1 group_by.result:
WL3527: disable wrong optimization.
sql_select.cc:
  WL#3527: disable wrong optimization.
2007-03-12 13:20:46 +02:00
gkodinov/kgeorge@magare.gmz
a474f33494 WL3527: post-merge updates
sql_yacc.yy:
  WL3527: updated the diff to use correct parser words
table.cc:
  WL3527: exteneded the fix for bug #20604 to fit the new variables
sql_select.cc:
  WL3527: renamed used_keys to covering_keys
2007-03-11 14:31:43 +02:00
gkodinov/kgeorge@magare.gmz
c03a483c51 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/WL3527-5.1-opt
2007-03-09 17:54:13 +02:00