Commit graph

14145 commits

Author SHA1 Message Date
gkodinov/kgeorge@magare.gmz
846cbf3cd0 Bug #32400: Complex SELECT query returns correct result
only on some occasions

Referencing an element from the SELECT list in a WHERE 
clause is not permitted. The namespace of the WHERE
clause is the table columns only. This was not enforced
correctly when resolving outer references in sub-queries.

Fixed by not allowing references to aliases in a 
sub-query in WHERE.
2007-11-20 19:18:21 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
f434cb6066 test case added for the bug #31155 2007-11-20 17:04:24 +04:00
evgen@moonbone.local
6f6fe52ad2 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/31048-bug-5.0-opt-mysql
2007-11-19 21:15:53 +00:00
evgen@moonbone.local
67cae0d48d Bug#31048: Many nested subqueries may cause server crash.
This bug is actually two. The first one manifests itself on an EXPLAIN
SELECT query with nested subqueries that employs the filesort algorithm.
The whole SELECT under explain is marked as UNCACHEABLE_EXPLAIN to preserve
some temporary structures for explain. As a side-effect of this values of
nested subqueries weren't cached and subqueries were re-evaluated many
times. Each time buffer for filesort was allocated but wasn't freed because
freeing occurs at the end of topmost SELECT. Thus all available memory was
eaten up step by step and OOM event occur.
The second bug manifests itself on SELECT queries with conditions where
a subquery result is compared with a key field and the subquery itself also
has such condition. When a long chain of such nested subqueries is present
the stack overrun occur. This happens because at some point the range optimizer
temporary puts the PARAM structure on the stack. Its size if about 8K and
the stack is exhausted very fast.

Now the subselect_single_select_engine::exec function allows subquery result
caching when the UNCACHEABLE_EXPLAIN flag is set.
Now the SQL_SELECT::test_quick_select function calls the check_stack_overrun
function for stack checking purposes to prevent server crash.
2007-11-19 20:00:25 +00:00
gshchepa/uchum@gleb.loc
fedeec6c8a Fixed bug #32282: TEXT silently truncates when value is exactly 65536
bytes length.

The server has been modified to report warnings on truncation to
65536 bytes as usual.
2007-11-19 21:34:21 +04:00
gshchepa/uchum@gleb.loc
6f7755f058 Merge gleb.loc:/work/bk/5.0-opt-32335
into  gleb.loc:/work/bk/5.0-opt
2007-11-18 00:08:41 +04:00
gshchepa/uchum@gleb.loc
f93b5a9c41 Fixed bug #32335.
Comparison of a BIGINT NOT NULL column with a constant arithmetic
expression that evaluates to NULL caused error 1048: "Column '...'
cannot be null".

Made convert_constant_item() check if the constant expression is NULL
before attempting to store it in a field. Attempts to store NULL in a
NOT NULL field caused query errors.
2007-11-18 00:02:55 +04:00
holyfoot/hf@hfmain.(none)
80e39eb44e Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/31158/my50-31158
2007-11-17 20:23:15 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
67ce52fd66 merging 2007-11-17 17:11:05 +04:00
holyfoot/hf@hfmain.(none)
7588fa52b6 Merge mysql.com:/home/hf/work/31158/my41-31158
into  mysql.com:/home/hf/work/31158/my50-31158
2007-11-17 16:48:57 +04:00
kaa@polly.(none)
7b38492a4c Merge polly.(none):/home/kaa/src/opt/bug32241/my50-bug29131
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-16 14:24:06 +03:00
kaa@polly.(none)
82125f281f Fix for bug #32241: memory corruption due to large index map in 'Range
checked for each record'

The problem was in incorrectly calculated length of the buffer used to
store a hexadecimal representation of an index map in
select_describe(). This could result in buffer overrun and stack
corruption under some circumstances.

Fixed by correcting the calculation.
2007-11-16 13:58:09 +03:00
gkodinov/kgeorge@magare.gmz
85fab707c5 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31928-5.0-opt
2007-11-15 17:30:08 +02:00
gluh@mysql.com/eagle.(none)
b56f668ca3 after merge fix 2007-11-14 18:56:14 +04:00
gluh@eagle.(none)
246c6c35a9 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-11-14 17:26:22 +04:00
holyfoot/hf@hfmain.(none)
acd198d5fa Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/31305/my50-31305
2007-11-13 23:13:59 +04:00
gkodinov/kgeorge@magare.gmz
eea70871f1 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31562-5.0-opt
2007-11-13 19:00:45 +02:00
gkodinov/kgeorge@magare.gmz
3384d3e96c Bug #31562: HAVING and lower case
The columns in HAVING can reference the GROUP BY and 
SELECT columns. There can be "table" prefixes when
referencing these columns. And these "table" prefixes
in HAVING use the table alias if available.
This means that table aliases are subject to the same
storage rules as table names and are dependent on 
lower_case_table_names in the same way as the table 
names are.
Fixed by :
1. Treating table aliases as table names
and make them lowercase when printing out the SQL
statement for view persistence.
2. Using case insensitive comparison for table 
aliases when requested by lower_case_table_names
2007-11-13 11:39:52 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
7d111abf0e Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_length parameter for BLOB-returning functions must be big enough
for any possible content. Otherwise the field created for a table
will be too small.
2007-11-13 10:51:47 +04:00
mattiasj@mattiasj-laptop.(none)
7491e15f21 Merge mattiasj@bk-internal.mysql.com:/home/bk/mysql-5.0-engines
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.0-engines_with_main
2007-11-12 22:47:48 +01:00
mattiasj@mattiasj-laptop.(none)
f4c100135b Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.0-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.0-engines_with_main
2007-11-12 21:42:27 +01:00
svoj@june.mysql.com
9799d6c479 Merge mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-5.0-engines
2007-11-12 21:54:04 +04:00
svoj@mysql.com/june.mysql.com
ed8f506d29 symlink.test, symlink.result:
Use proper variable for test.
2007-11-12 21:52:30 +04:00
svoj@june.mysql.com
5e44309422 Merge mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-5.0-engines
2007-11-12 15:16:00 +04:00
svoj@mysql.com/june.mysql.com
40a78cd390 After merge fix. 2007-11-12 15:15:16 +04:00
svoj@mysql.com/june.mysql.com
a6def1f4ab Merge mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.0
into  mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.1-engines
2007-11-12 15:02:42 +04:00
kaa@polly.(none)
bf2a90f14b Merge polly.(none):/home/kaa/src/opt/bug30666/my50-bug29131
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-12 12:29:20 +03:00
holyfoot/hf@hfmain.(none)
83a2781894 Merge mysql.com:/home/hf/work/31305/my41-31305
into  mysql.com:/home/hf/work/31305/my50-31305
2007-11-12 13:06:27 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
91e2f91897 Bug #31305 myisam tables crash when they are near capacity.
When we insert a record into MYISAM table which is almost 'full',
we first write record data in the free space inside a file, and then
check if we have enough space after the end of the file.
So if we don't have the space, table will left corrupted.
Similar error also happens when we updata MYISAM tables.

Fixed by modifying write_dynamic_record and update_dynamic_record functions
to check for free space before writing parts of a record
2007-11-12 13:00:22 +04:00
gshchepa/uchum@gleb.loc
8b21045f9b Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-11-11 00:01:24 +04:00
gshchepa/uchum@gleb.loc
e5394523d3 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-28076
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-11-10 23:58:22 +04:00
kaa@polly.(none)
b745305b20 Merge polly.(none):/home/kaa/src/opt/bug32202/my50-bug26215
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-10 22:46:25 +03:00
gshchepa/uchum@gleb.loc
0aabb89ee1 Fixed bug #28076: inconsistent binary/varbinary comparison.
After adding an index the <VARBINARY> IN (SELECT <BINARY> ...)
clause returned a wrong result: the VARBINARY value was illegally padded
with zero bytes to the length of the BINARY column for the index search.
(<VARBINARY>, ...) IN (SELECT <BINARY>, ... ) clauses are affected too.
2007-11-10 23:44:48 +04:00
tnurnberg@white.intern.koehntopp.de
d97dd5a4e5 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/scratch/tnurnberg/31800/50-31800
2007-11-10 13:35:35 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
dd7452c280 Bug#31800: Date comparison fails with timezone and slashes for greater than comparison
BETWEEN was more lenient with regard to what it accepted as a DATE/DATETIME
in comparisons than greater-than and less-than were. ChangeSet makes < >
comparisons similarly robust with regard to trailing garbage (" GMT-1")
and "missing" leading zeros. Now all three comparators behave similarly
in that they throw a warning for "junk" at the end of the data, but then
proceed anyway if possible. Before < > fell back on a string- (rather than
date-) comparison when a warning-condition was raised in the string-to-date
conversion. Now the fallback only happens on actual errors, while warning-
conditions still result in a warning being to delivered to the client.
2007-11-10 13:33:42 +01:00
tnurnberg@white.intern.koehntopp.de
0cd82301fb Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/misc/mysql/31990/50-31990
2007-11-10 03:12:57 +01:00
kaa@polly.(none)
8c19367881 Fix for bug #32202: ORDER BY not working with GROUP BY
The bug is a regression introduced by the fix for bug30596. The problem
was that in cases when groups in GROUP BY correspond to only one row,
and there is ORDER BY, the GROUP BY was removed and the ORDER BY
rewritten to ORDER BY <group_by_columns> without checking if the
columns in GROUP BY and ORDER BY are compatible. This led to
incorrect ordering of the result set as it was sorted using the
GROUP BY columns. Additionaly, the code discarded ASC/DESC modifiers
from ORDER BY even if its columns were compatible with the GROUP BY
ones.

This patch fixes the regression by checking if ORDER BY columns form a
prefix of the GROUP BY ones, and rewriting ORDER BY only in that case,
preserving the ASC/DESC modifiers. That check is sufficient, since the
GROUP BY columns contain a unique index.
2007-11-09 19:12:12 +03:00
kaa@polly.(none)
6320cdedb2 Merge polly.(none):/home/kaa/src/opt/bug32020/my50-bug31445
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-09 13:41:50 +03:00
kaa@polly.(none)
e703c6a78c Fix for bug #32020: loading udfs while --skip-grant-tables is enabled
causes out of memory errors

The code in mysql_create_function() and mysql_drop_function() assumed
that the only reason for UDFs being uninitialized at that point is an
out-of-memory error during initialization. However, another possible 
reason for that is the --skip-grant-tables option in which case UDF 
initialization is skipped and UDFs are unavailable.

The solution is to check whether mysqld is running with
--skip-grant-tables and issue a proper error in such a case.
2007-11-09 13:29:43 +03:00
kaa@polly.(none)
d27375aff5 Merge polly.(none):/home/kaa/src/opt/bug32103/my50-bug26215
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-08 12:06:14 +03:00
kaa@polly.(none)
8efd7ef146 Merge polly.(none):/home/kaa/src/opt/bug32103/my41-bug26215
into  polly.(none):/home/kaa/src/opt/bug32103/my50-bug26215
2007-11-08 11:46:58 +03:00
tnurnberg@mysql.com/white.intern.koehntopp.de
5a5ed2a509 Bug#31990: MINUTE() and SECOND() return bogus results when used on a DATE
HOUR(), MINUTE(), ... returned spurious results when used on a DATE-cast.
This happened because DATE-cast object did not overload get_time() method
in superclass Item. The default method was inappropriate here and
misinterpreted the data.

Patch adds missing method; get_time() on DATE-casts now returns SQL-NULL
on NULL input, 0 otherwise. This coincides with the way DATE-columns
behave.
2007-11-08 06:08:44 +01:00
gkodinov/kgeorge@magare.gmz
767dca6251 Bug #31928: Search fails on '1000-00-00' date after sql_mode change
When constructing a key image stricter date checking (from sql_mode)
should not be enabled, because it will reject invalid dates that the
server would otherwise accept for searching when there's no index.
 
Fixed by disabling strict date checking when constructing a key image.
2007-11-07 18:02:12 +02:00
kaa@polly.(none)
f1a3c36403 Fix for bug #32103: optimizer crash when join on int and mediumint with
variable in where clause.

Problem: the new_item() method of Item_uint used an incorrect
constructor. "new Item_uint(name, max_length)" calls
Item_uint::Item_uint(const char *str_arg, uint length) which assumes the
first argument to be the string representation of the value, not the
item's name. This could result in either a server crash or incorrect
results depending on usage scenarios.

Fixed by using the correct constructor in new_item():
Item_uint::Item_uint(const char *str_arg, longlong i, uint length).
2007-11-07 18:45:04 +03:00
kaa@polly.(none)
4aa0402224 Fix for bug #30666: Incorrect order when using range conditions on 2
tables or more

The problem was that the optimizer used the join buffer in cases when
the result set is ordered by filesort. This resulted in the ORDER BY
clause being ignored, and the records being returned in the order
determined by the order of matching records in the last table in join.

Fixed by relaxing the condition in make_join_readinfo() to take
filesort-ordered result sets into account, not only index-ordered ones.
2007-11-07 14:00:45 +03:00
svoj@mysql.com/june.mysql.com
d06e2f9223 BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
RENAME TABLE against a table with DATA/INDEX DIRECTORY overwrites
the file to which the symlink points.

This is security issue, because it is possible to create a table with
some name in some non-system database and set DATA/INDEX DIRECTORY
to mysql system database. Renaming this table to one of mysql system
tables (e.g. user, host) would overwrite the system table.

Return an error when the file to which the symlink points exist.
2007-11-06 18:09:33 +04:00
istruewing@stella.local
0c9c041fde Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2007-11-06 13:56:15 +01:00
istruewing@stella.local
30b409bd6f Bug#4692 - DISABLE/ENABLE KEYS waste a space
Disabling and enabling indexes on a non-empty table grows the
index file.

Disabling indexes just sets a flag per non-unique index and does not
free the index blocks of the affected indexes. Re-enabling indexes
creates new indexes with new blocks. The old blocks remain unused
in the index file.

Fixed by dropping and re-creating all indexes if non-empty disabled
indexes exist when enabling indexes. Dropping all indexes resets
the internal end-of-file marker to the end of the index file header.
It also clears the root block pointers of every index and clears the
deleted blocks chains. This way all blocks are declared as free.
2007-11-06 13:41:32 +01:00
malff@lambda.hsd1.co.comcast.net.
00f1af47e4 Merge lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-base
into  lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.0-rt-merge
2007-11-05 09:50:09 -07:00
holyfoot/hf@hfmain.(none)
9e2a652856 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/31758/my50-31758
2007-11-05 19:07:03 +04:00