Commit graph

35419 commits

Author SHA1 Message Date
gkodinov/kgeorge@magare.gmz
70d91d43ae Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26207-5.0-opt
2007-03-22 18:49:47 +02:00
gkodinov/kgeorge@magare.gmz
ef1bb48af9 Bug #26207: When making the key image to use
in index search MySQL was not explicitly
 suppressing warnings. And if the context 
 happens to enable warnings (e.g. INSERT ..
 SELECT) the warnings resulting from converting 
 the data the key is compared to are 
 reported to the client.
 Fixed by suppressing warnings when converting
 the data to the same type as the key parts.
2007-03-22 18:44:16 +02:00
mhansson/martin@linux-st28.site
99ac24679d Bug#24791: Union with AVG-groups generates wrong results
Patch appled after doing a pull from the team tree. Additional tests had to be
fixed
2007-03-22 14:58:43 +01:00
mhansson/martin@linux-st28.site
cdf80a269b Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug24791
2007-03-22 13:37:27 +01:00
mhansson/martin@linux-st28.site
749976ee5e Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/5.0o-bug24791
2007-03-22 10:58:16 +01:00
mhansson/martin@linux-st28.site
50077b6db9 Bug #24791: Union with AVG-groups generates wrong results
The problem in this bug is when we create temporary tables. When
temporary tables are created for unions, there is some 
inferrence being carried out regarding the type of the column.
Whenever this column type is inferred to be REAL (i.e. FLOAT or
DOUBLE), MySQL will always try to maintain exact precision, and
if that is not possible (there are hardware limits, since FLOAT
and DOUBLE are stored as approximate values) will switch to
using approximate values. The problem here is that at this point
the information about number of significant digits is not 
available. Furthermore, the number of significant digits should
be increased for the AVG function, however, this was not properly 
handled. There are 4 parts to the problem:

#1: DOUBLE and FLOAT fields don't display their proper display 
lengths in max_display_length(). This is hard-coded as 53 for 
DOUBLE and 24 for FLOAT. Now changed to instead return the 
field_length.

#2: Type holders for temporary tables do not preserve the 
max_length of the Item's from which they are created, and is 
instead reverted to the 53 and 24 from above. This causes 
*all* fields to get non-fixed significant digits.

#3: AVG function does not update max_length (display length)
when updating number of decimals.

#4: The function that switches to non-fixed number of 
significant digits should use DBL_DIG + 2 or FLT_DIG + 2 as 
cut-off values (Since fixed precision does not use the 'e' 
notation)

Of these points, #1 is the controversial one, but this 
change is preferred and has been cleared with Monty. The 
function causes quite a few unit tests to blow up and they had
to b changed, but each one is annotated and motivated. We 
frequently see the magical 53 and 24 give way to more relevant
numbers.
2007-03-22 10:56:47 +01:00
holyfoot/hf@mysql.com/hfmain.(none)
a016f71c45 bug #16546 (DATETIME+0 not always coerced the same way)
fix for cast( AS DATETIME)+0 in 5.0 and above versions.
  val_real now works using val_decimal for DATETIME Items
  Superfluous val_real() methods deleted
2007-03-22 12:44:38 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
da5769fe6a Merge mysql.com:/home/hf/work/mrg/mysql-4.1-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:26:32 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
e0f0507f99 bug #16546 (DATETIME + 0 not always coerced in the same way)
fix for cast( AS DATETIME) + 0 operation.
  I just implemented Item_datetime_typecast::val() method
  as it is usually done in other classes.
  Should be fixed more radically in 5.0
2007-03-22 12:24:56 +04: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@mysql.com/hfmain.(none)
e7040f3691 Merge mysql.com:/home/hf/work/mrg/mysql-4.1-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:02:04 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
74b6ad7c7e Merge mysql.com:/home/hf/work/25492/my50-25492
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-22 12:01:40 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
55d9c2dd07 Merge mysql.com:/home/hf/work/25492/my41-25492
into  mysql.com:/home/hf/work/mrg/mysql-4.1-opt
2007-03-22 12:01:05 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
f602c08da8 Merge mysql.com:/home/hf/work/25492/my41-25492
into  mysql.com:/home/hf/work/25492/my50-25492
2007-03-22 11:59:45 +04:00
igor@olga.mysql.com
03ae298ec3 Fixed bug #27362: crash at evaluation of IN predicate when one
of its argument happened to be a decimal expression returning
the NULL value.
The crash was due to the fact the function in_decimal::set did
not take into account that val_decimal() could return 0 if 
the decimal expression had been evaluated to NULL.
2007-03-22 00:05:36 -07:00
kostja@bodhi.local
c011a25f66 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-21 23:57:12 +03:00
evgen@moonbone.local
e2c9c9cc20 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/23345-bug-5.0-opt-mysql
2007-03-21 22:10:33 +03:00
evgen@moonbone.local
72bf9b4847 Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
INTO clause can be specified only for the last select of a UNION and it
receives the result of the whole query. But it was wrongly allowed in
non-last selects of a UNION which leads to a confusing query result.

Now INTO allowed only in the last select of a UNION.
2007-03-21 21:54:38 +03:00
igor@olga.mysql.com
facd57e5fd Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27257
2007-03-20 12:20:18 -07:00
igor@olga.mysql.com
19da4d3972 Fixed bug #27257: queries containing subqueries with COUNT(*)
aggregated in outer context returned wrong results.
This happened only if the subquery did not contain any references
to outer fields.
As there were no references to outer fields the subquery erroneously
was taken for non-correlated one.
Now any set function aggregated in outer context makes the subquery
correlated.
2007-03-20 11:51:09 -07: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
evgen@moonbone.local
31b9145ab3 sql_insert.cc:
Removed wrong fix for the bug#27006.
  The bug was added by the fix for the bug#19978 and fixed by Monty on 2007/02/21.
trigger.test, trigger.result:
  Corrected test case for the bug#27006.
2007-03-20 00:46:19 +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
evgen@moonbone.local
e84584e2e3 Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.

This bug was caused by fix for bug#19978. It causes AFTER UPDATE triggers
not firing if a row wasn't actually changed by the update part of the
INSERT .. ON DUPLICATE KEY UPDATE.

Now triggers are always fired if a row is touched by the INSERT ... ON
DUPLICATE KEY UPDATE.
2007-03-16 17:23:26 +03:00
gkodinov/kgeorge@magare.gmz
830c134e84 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26261-5.0-opt
2007-03-16 10:50:33 +02:00
gkodinov/kgeorge@macbook.gmz
61d93679c3 Bug #26261:
INSERT uses query_id to verify what fields are
 mentioned in the fields list of the INSERT command.
 However the check for that is made after the 
 ON DUPLICATE KEY is processed. This causes all
 the fields mentioned in ON DUPLICATE KEY to be 
 considered as mentioned in the fields list of 
 INSERT.
 Moved the check up, right after processing the
 fields list.
2007-03-16 10:35:39 +02:00
gluh@mysql.com/eagle.(none)
3912ce7f33 Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-03-16 12:16:15 +04:00
gluh@mysql.com/eagle.(none)
ec4f730ba7 Bug#26285 selecting information_schema crahes server
The crash happens when 'skip-grant-tables' is enabled.
We skip the filling of I_S privilege tables 
if acl_cache is not initialized.
2007-03-16 12:15:51 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
1e01c70351 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-16 12:06:36 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
5cb3d4f173 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-16 11:55:16 +04:00
jbruehe/mysqldev@mysql.com/production.mysql.com
6d99387502 Raise version number after cloning 5.0.38 2007-03-15 22:28:31 +01:00
svoj@mysql.com/april.(none)
8b325697dd Merge mysql.com:/home/svoj/devel/bk/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/bk/mysql-5.0-engines
2007-03-16 01:28:29 +04:00
evgen@moonbone.local
3d0df38f49 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/27033-bug-5.0-opt-mysql
2007-03-15 23:56:21 +03:00
evgen@moonbone.local
92c8558224 Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.

The LAST_INSERT_ID() is reset to 0 if no rows were inserted or changed.
This is the case when an INSERT ... ON DUPLICATE KEY UPDATE updates a row
with the same values as the row contains.

Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
successfully inserted or touched.
The new 'touched' field is added to the COPY_INFO structure. It holds the
number of rows that were touched no matter whether they were actually
changed or not.
2007-03-15 23:21:29 +03:00
holyfoot/hf@mysql.com/hfmain.(none)
2e3ce3c20f Merge mysql.com:/home/hf/work/26833/my50-26833
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-15 16:26:37 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
21847d6890 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-15 16:21:43 +04:00
dlenev@mockturtle.local
e25ea78fd4 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  mockturtle.local:/home/dlenev/src/mysql-4.1-merge
2007-03-15 14:31:34 +03:00
dlenev@mockturtle.local
4f46196db9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mockturtle.local:/home/dlenev/src/mysql-5.0-merge
2007-03-15 14:00:50 +03:00
dlenev@mockturtle.local
e4f88d5215 Merge mockturtle.local:/home/dlenev/src/mysql-4.1-bg25966
into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg25966-2
2007-03-15 11:53:04 +03:00
dlenev@mockturtle.local
01bd08b5d7 Fix for bug #25966 "2MB per second endless memory consumption after LOCK
TABLE ... WRITE".

Memory and CPU hogging occured when connection which had to wait for table
lock was serviced by thread which previously serviced connection that was
killed (note that connections can reuse threads if thread cache is enabled).
One possible scenario which exposed this problem was when thread which
provided binlog dump to replication slave was implicitly/automatically
killed when the same slave reconnected and started pulling data through
different thread/connection.
The problem also occured when one killed particular query in connection
(using KILL QUERY) and later this connection had to wait for some table
lock.

This problem was caused by the fact that thread-specific mysys_var::abort
variable, which indicates that waiting operations on mysys layer should
be aborted (this includes waiting for table locks), was set by kill
operation but was never reset back. So this value was "inherited" by the
following statements or even other connections (which reused the same
physical thread). Such discrepancy between this variable and THD::killed
flag broke logic on SQL-layer and caused CPU and memory hogging.

This patch tries to fix this problem by properly resetting this member.

There is no test-case associated with this patch since it is hard to test
for memory/CPU hogging conditions in our test-suite.
2007-03-15 11:51:35 +03:00
dlenev@mockturtle.local
f2cb664174 Fix for bug #25966 "2MB per second endless memory consumption after LOCK
TABLE ... WRITE".

CPU hogging occured when connection which had to wait for table lock was
serviced by thread which previously serviced connection that was killed
(note that connections can reuse threads if thread cache is enabled).
One possible scenario which exposed this problem was when thread which
provided binlog dump to replication slave was implicitly/automatically
killed when the same slave reconnected and started pulling data through
different thread/connection.
In 5.* versions memory hogging was added to CPU hogging. Moreover in
those versions the problem also occured when one killed particular query
in connection (using KILL QUERY) and later this connection had to wait for
some table lock.

This problem was caused by the fact that thread-specific mysys_var::abort
variable, which indicates that waiting operations on mysys layer should
be aborted (this includes waiting for table locks), was set by kill
operation but was never reset back. So this value was "inherited" by the
following statements or even other connections (which reused the same
physical thread). Such discrepancy between this variable and THD::killed
flag broke logic on SQL-layer and caused CPU and memory hogging.

This patch tries to fix this problem by properly resetting this member.

There is no test-case associated with this patch since it is hard to test
for memory/CPU hogging conditions in our test-suite.
2007-03-15 11:30:17 +03:00
malff/marcsql@weblab.(none)
f87899c50e Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-26503
2007-03-14 14:29:27 -06:00
malff/marcsql@weblab.(none)
bef323b1d6 Bug#26503 (Illegal SQL exception handler code causes the server to crash)
Before this fix, the parser would accept illegal code in SQL exceptions
handlers, that later causes the runtime to crash when executing the code,
due to memory violations in the exception handler stack.

The root cause of the problem is instructions within an exception handler
that jumps to code located outside of the handler. This is illegal according
to the SQL 2003 standard, since labels located outside the handler are not
supposed to be visible (they are "out of scope"), so any instruction that
jumps to these labels, like ITERATE or LEAVE, should not parse.

The section of the standard that is relevant for this is :
  SQL:2003 SQL/PSM (ISO/IEC 9075-4:2003)
  section 13.1 <compound statement>,
  syntax rule 4
<quote>
  The scope of the <beginning label> is CS excluding every <SQL schema
  statement> contained in CS and excluding every
  <local handler declaration list> contained in CS. <beginning label> shall
  not be equivalent to any other <beginning label>s within that scope.
</quote>

With this fix, the C++ class sp_pcontext, which represent the "parsing
context" tree (a.k.a symbol table) of a stored procedure, has been changed
as follows:
- constructors have been cleaned up, so that only building a root node for
the tree is public; building nodes inside a tree is not public.
- a new member, m_label_scope, indicates if a given syntactic context
belongs to a DECLARE HANDLER block,
- label resolution, in the method find_label(), has been changed to
implement the restriction of scope regarding labels used in a compound
statement.

The actions in the parser, when parsing the body of a SQL exception handler,
have been changed as follows:
- the implementation of an exception handler (DECLARE HANDLER) now creates
explicitly a new sp_pcontext, to isolate the code inside the handler from
the containing compound statement context.
- registering exception handlers as a result occurs in the parent context,
see the rule sp_hcond_element
- the code in sp_hcond_list has been cleaned up, to avoid code duplication

In addition, the flags IN_SIMPLE_CASE and IN_HANDLER, declared in sp_head.h
have been removed, since they are unused and broken by design (as seen with
Bug 19194 (Right recursion in parser for CASE causes excessive stack usage,
limitation), representing a stack in a single flag is not possible.

Tests in sp-error have been added to show that illegal constructs are now
rejected.

Tests in sp have been added for code coverage, to show that ITERATE or LEAVE
statements are legal when jumping to a label in scope, inside the body of
an exception handler.
2007-03-14 12:02:32 -06:00
kent@mysql.com/kent-amd64.(none)
eda2d801ef Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-14 18:32:06 +01:00
kent@mysql.com/kent-amd64.(none)
760a73102f Merge mysql.com:/home/kent/bk/tmp/mysql-4.0
into  mysql.com:/home/kent/bk/tmp/mysql-4.1-build
2007-03-14 18:28:52 +01:00
kent@mysql.com/kent-amd64.(none)
7c4385c4ad EXCEPTIONS-CLIENT:
Updated to version 0.6 of the text
2007-03-14 18:28:16 +01:00
gkodinov/kgeorge@magare.gmz
2525db66fa Bug #26794: fixed valgrind warning 2007-03-14 15:58:14 +02:00
kent@mysql.com/kent-amd64.(none)
201e58d14e Merge mysql.com:/home/kent/bk/tmp/mysql-4.1-build
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-14 14:31:44 +01:00
kent@mysql.com/kent-amd64.(none)
aea42a5444 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-14 14:30:54 +01:00