Commit graph

28050 commits

Author SHA1 Message Date
Georgi Kodinov
1680a56657 merge 2011-01-12 17:10:12 +02:00
Alexey Botchkov
405fb864c5 merging. 2011-01-12 17:11:31 +04:00
Dmitry Lenev
bc8e89c926 Merged fix for bug #58499 "DEFINER-security view selecting from
INVOKER-security view access check wrong" into mysql-5.5 tree.
2011-01-12 16:28:33 +03:00
Dmitry Lenev
94fbedd3e3 Fix for bug #58499 "DEFINER-security view selecting from
INVOKER-security view access check wrong".

When privilege checks were done for tables used from an 
INVOKER-security view which in its turn was used from 
a DEFINER-security view connection's active security
context was incorrectly used instead of security context
with privileges of the second view's creator.

This meant that users which had enough rights to access
the DEFINER-security view and as result were supposed to 
be able successfully access it were unable to do so in 
cases when they didn't have privileges on underlying tables 
of the INVOKER-security view.

This problem was caused by the fact that for INVOKER-security
views TABLE_LIST::security_ctx member for underlying tables
were set to 0 even in cases when particular view was used from 
another DEFINER-security view. This meant that when checks of
privileges on these underlying tables was done in
setup_tables_and_check_access() active connection security 
context was used instead of context corresponding to the 
creator of caller view.

This fix addresses the problem by ensuring that underlying
tables of an INVOKER-security view inherit security context
from the view and thus correct security context is used for
privilege checks on underlying tables in cases when such view 
is used from another view with DEFINER-security.
2011-01-12 16:08:30 +03:00
Alexey Botchkov
e073e2c0be Bug #57321 crashes and valgrind errors from spatial types
Item_func_spatial_collection::fix_length_and_dec didn't call parent's method, so
        the maybe_null was set to '0' after it. But in this case the result was
        just NULL, that caused wrong behaviour.

per-file comments:
  mysql-test/r/gis.result
Bug #57321 crashes and valgrind errors from spatial types 
        test result updated.

  mysql-test/t/gis.test
Bug #57321 crashes and valgrind errors from spatial types 
        test case added.
  sql/item_geofunc.h
Bug #57321 crashes and valgrind errors from spatial types 
        Item_func_geometry::fix_length_and_dec() called in
        Item_func_spatial_collection::fix_length_and_dec().
2011-01-12 17:02:41 +04:00
Ole John Aske
003e87fef0 Fix for bug#58818: Incorrect result for IN/ANY subquery
If the ::single_value_transformer() find an existing HAVING condition it used
to do the transformation:
            
  1) HAVING cond -> (HAVING Cond) AND (cond_guard (Item_ref_null_helper(...))
      
As the AND condition in 1) is Mc'Carty evaluated, the
right side of the AND cond should be executed only if the 
original 'HAVING evaluated' to true.
      
However, as we failed to set 'top_level' for the tranformed HAVING condition,
'abort_on_null' was FALSE after transformation. An
UNKNOWN having condition will then not terminate evaluation of the
transformed having condition, and we incorrectly continued
into the Item_ref_null_helper() part.
2011-01-12 13:15:22 +01:00
Oystein Grovlen
a648063319 Merge fix for Bug#59211 to mysql-5.5-security 2011-01-12 11:27:31 +01:00
Oystein Grovlen
541e0fa8bf Bug#59211: Select Returns Different Value for min(year) Function
get_year_value() contains code to convert 2-digits year to
4-digits.  The fix for Bug#49910 added a check on the size of
the underlying field so that this conversion is not done for
YEAR(4) values. (Since otherwise one would convert invalid
YEAR(4) values to valid ones.)

The existing check does not work when Item_cache is used, since
it is not detected when the cache is based on a Field.  The
reported change in behavior is due to Bug#58030 which added
extra cached items in min/max computations.

The elegant solution would be to implement
Item_cache::real_item() to return the underlying Item.
However, some side effects are observed (change in explain
output) that indicates that such a change is not straight-
forward, and definitely not appropriate for an MRU.

Instead, a Item_cache::field() method has been added in order
to get access to the underlying field.  (This field() method
eliminates the need for Item_cache::eq_def() used in
test_if_ref(), but in order to limit the scope of this fix,
that code has been left as is.)
2011-01-12 10:37:15 +01:00
Martin Hansson
b48abbc5e1 Merge of fix for Bug#58207. 2011-01-12 10:31:41 +01:00
Alfranio Correia
c04979b841 BUG#59267 LOAD DATA LOCAL INFILE not executed on slave with SBR
On windows, an #endif in a wrong place was causing an early
return from mysql_load and thus the LOAD DATA LOCAL was not
executed. This problem was fixed by moving the #endif to the
right place.

The following code was missing
    
  if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
    is_fifo = 1;

which is required to properly configure and read from the
IO_CACHE when a named pipe is used. So it was re-introduced
before the #endif.
2011-01-12 09:31:32 +00:00
Martin Hansson
fc42cbaca3 Bug#58207: invalid memory reads when using default column value and
tmptable needed

The function DEFAULT() works by modifying the the data buffer pointers (often
referred to as 'record' or 'table record') of its argument. This modification
is done during name resolution (fix_fields().) Unfortunately, the same
modification is done when creating a temporary table, because default values
need to propagate to the new table.

Fixed by skipping the pointer modification for fields that are arguments to
the DEFAULT function.
2011-01-12 09:55:31 +01:00
Dmitry Shulga
1304d8d53b Auto-merge mysql-5.1 -> mysql-5.5 for bug#58887. 2011-01-11 21:26:31 +06:00
Dmitry Shulga
5bd50b80a7 Fixed Bug#58887 - server not throwing "Packet too large" error
if max_allowed_packet >= 16M.

This bug was introduced by patch for bug#42503.

This patch restores behaviour that there was before patch
for bug#42503 was applied.
2011-01-11 21:18:25 +06:00
Jan Wedvik
b7e3f45011 Merge of fix for bug#58553, "Queries with pushed conditions causes 'explain
extended' to crash mysqld" (see http://lists.mysql.com/commits/128409).
2011-01-11 12:33:28 +01:00
Jan Wedvik
f4adb7c6e4 Fix for bug#58553, "Queries with pushed conditions causes 'explain extended'
to crash mysqld". 
      
handler::pushed_cond was not always properly reset when table objects where
recycled via the table cache.
      
handler::pushed_cond is now set to NULL in handler::ha_reset(). This should 
prevent pushed conditions from (incorrectly) re-apperaring in later queries.
2011-01-11 12:09:54 +01:00
Magne Mahre
ebd24626ca Remove configuration preprocessor symbols 'THREAD'
and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
2011-01-11 10:07:37 +01:00
Mattias Jonsson
208a0fab56 merge 2011-01-10 16:13:12 +01:00
Mattias Jonsson
1a46e493dd Manual merge from 5.1 2011-01-10 15:08:31 +01:00
Jon Olav Hauglid
04823e3329 Bug #58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
OPTIMIZE TABLE

OPTIMIZE TABLE for InnoDB tables is handled as recreate + analyze.
The triggered assert checked that an error had been reported if either
recreate or analyze failed. However the assert failed to take into
account that they could have failed because OPTIMIZE TABLE had been
victim of KILL QUERY, KILL CONNECTION or server shutdown.

This patch adjusts the assert to take this possibility into account.
The problem was only noticeable on debug versions of the server.

Test case added to innodb_mysql_sync.test.
2011-01-10 14:12:23 +01:00
Georgi Kodinov
7fd0c36b7b merge 2011-01-10 15:09:57 +02:00
Georgi Kodinov
afe532317a merge 2011-01-10 15:08:33 +02:00
Magne Mahre
0a2a470b08 Bug#58970 Problem Subquery (without referencing a table)
and Order By
      
When having a UNION statement in a subquery, with no
referenced tables (or only a reference to the virtual
table 'dual'), the UNION did not allow an ORDER BY clause.
      
      i.e:
          SELECT(SELECT 1 AS a UNION 
                 SELECT 0 AS a 
                 ORDER BY a) AS b  or
          SELECT(SELECT 1 AS a FROM dual UNION 
                 SELECT 0 as a 
                 ORDER BY a) AS b
      
      
In addition, an ORDER BY / LIMIT clause was not accepted
in subqueries even for single SELECT statements with no 
referenced tables (or with 'dual' as table reference)
      
   i.e: 
      SELECT(SELECT 1 AS a ORDER BY a) AS b  or
      SELECT(SELECT 1 AS a FROM dual ORDER BY a) AS b
      
The fix was to allow an optional ORDER BY/LIMIT clause to
the grammar for these cases.
      
See also: Bug#57986
2011-01-10 13:43:12 +01:00
Magne Mahre
4d6928095a Bug#57986 ORDER BY clause is not used after a UNION,
if embedded in a SELECT
            
An ORDER BY clause was bound to the incorrect
(sub-)statement when used in a UNION context.
            
In a query like:
SELECT * FROM a UNION SELECT * FROM b ORDER BY c
the result of SELECT * FROM b is sorted, and then
combined with a.  The correct behaviour is that
the ORDER BY clause should be applied on the
final set.   Similar behaviour was seen on LIMIT
clauses as well.
            
In a UNION statement, there will be a select_lex
object for each of the two selects, and a 
select_lex_unit object that describes the UNION
itself.  Similarly, the same behaviour was also
seen on derived tables.
            
The bug was caused by using a grammar rule for
ORDER BY and LIMIT that bound these elements
to thd->lex->current_select, which points to the
last of the two selects, instead of to the 
fake_select_lex member of the master select_lex_unit
object.
2011-01-10 13:16:50 +01:00
Mattias Jonsson
99e95e8dab merge 2011-01-10 12:56:27 +01:00
Mattias Jonsson
945f6faae6 merge 2011-01-10 12:53:24 +01:00
Vasil Dimov
1d3fd9d931 Merge mysql-5.5-innodb -> mysql-5.5 2011-01-08 17:00:48 +02:00
Vasil Dimov
4e8ba0838f Merge mysql-5.1-innodb -> mysql-5.1 2011-01-08 16:59:23 +02:00
Davi Arnaut
0918a3a2ab Bug#58765: Warning in item.h on Windows
Truncate the maximum result length (64-bit wide type) to fit into
the item maximum length (32-bit wide type). This is possible as
this specific branch is only used if the maximum result length
is less than 0x1000000 (MAX_BLOB_WIDTH), which fits comfortably
in a 32-bit wide type.
2011-01-07 17:32:41 -02:00
Davi Arnaut
ff3f14db61 Merge of mysql-5.1 into mysql-5.5. 2011-01-07 17:30:52 -02:00
Davi Arnaut
78b6ca55cb Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files
From a user perspective, the problem is that a FLUSH LOGS or SIGHUP
signal could end up associating the stdout and stderr to random
files. In the case of this bug report, the streams would end up
associated to InnoDB ibd files.

The freopen(3) function is not thread-safe on FreeBSD. What this
means is that if another thread calls open(2) during freopen()
is executing that another thread's fd returned by open(2) may get
re-associated with the file being passed to freopen(3). See FreeBSD
PR number 79887 for reference:

  http://www.freebsd.org/cgi/query-pr.cgi?pr=79887

This problem is worked around by substituting a internal hook within
the FILE structure. This avoids the loss of atomicity by not having
the original fd closed before its duplicated.

Patch based on the original work by Vasil Dimov.
2011-01-07 16:33:36 -02:00
Georgi Kodinov
23d1eef773 automerge 2011-01-07 15:30:54 +02:00
Georgi Kodinov
666d84c006 automerge 2011-01-07 15:30:42 +02:00
Vasil Dimov
b192c11c08 Merge mysql-5.5 -> mysql-5.5-innodb 2011-01-07 13:49:06 +02:00
Vasil Dimov
d8a01ff5b7 Merge mysql-5.1 -> mysql-5.1-innodb 2011-01-07 13:46:21 +02:00
kevin.lewis@oracle.com
66d50854af 43818 - Patch for mysql-5.1-innodb
Avoid handler::info() call for three Information Schema tables;
TABLE_CONSTRAINTS, KEY_COLUMN_USAGE, & REFERENTIAL_CONTRAINTS
2011-01-04 12:34:39 -06:00
Mattias Jonsson
16994abf9a merge 2011-01-04 14:13:20 +01:00
Mikael Ronstrom
7313acfef7 merge 2011-01-03 15:59:04 +01:00
Tor Didriksen
6d92e631c6 Add mysys to mysqld dependencies, trying to un-break the build on debian 2011-01-03 14:08:48 +01:00
27b4d039e7 Bug #50914 mysqlbinlog not handling drop of current default database
mysqlbinlog only prints "use $database" statements to its output stream
when the active default database changes between events. This will cause
"No Database Selected" error when dropping and recreating that database.
      
To fix the problem, we clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.
2010-12-29 13:22:52 +08:00
dbb832c02e Bug #50914 mysqlbinlog not handling drop of current default database
mysqlbinlog only prints "use $database" statements to its output stream
when the active default database changes between events. This will cause
"No Database Selected" error when dropping and recreating that database.

To fix the problem, we clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.
2010-12-29 11:52:57 +08:00
Kent Boortz
94cde4c951 Merge 2010-12-29 01:26:31 +01:00
Kent Boortz
920d185fd8 Merge 2010-12-29 00:47:05 +01:00
Kent Boortz
fddb1f1b13 - Added/updated copyright headers
- Removed files specific to compiling on OS/2
- Removed files specific to SCO Unix packaging
- Removed "libmysqld/copyright", text is included in documentation
- Removed LaTeX headers for NDB Doxygen documentation
- Removed obsolete NDB files
- Removed "mkisofs" binaries
- Removed the "cvs2cl.pl" script
- Changed a few GPL texts to use "program" instead of "library"
2010-12-28 19:57:23 +01:00
Vasil Dimov
18e211279d Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-12-27 19:24:05 +02:00
Sergey Glukhov
26763a57a3 5.1-bugteam->5.5-bugteam merge 2010-12-24 14:21:44 +03:00
Sergey Glukhov
b69b46c775 Bug#57810 case/when/then : Assertion failed: length || !scale
ASSERT happens due to improper calculation of the max_length
in Item_func_div object, if dividend has max_length == 0 then
Item_func_div::max_length is set to 0 under some circumstances.
The fix:
If decimals == NOT_FIXED_DEC then set
Item_func_div::max_length to max possible
DOUBLE length value.
2010-12-24 14:05:04 +03:00
Georgi Kodinov
959cb0af9e merge 2010-12-23 12:49:08 +02:00
Georgi Kodinov
457441bf1e merge 2010-12-23 12:40:40 +02:00
Mattias Jonsson
9918153522 Bug#54483: valgrind errors when making warnings for
multiline inserts into partition
Bug#57071: EXTRACT(WEEK from date_col) cannot be
allowed as partitioning function

Renamed function according to reviewers comments.
2010-12-22 15:45:17 +01:00
Mattias Jonsson
966d0ebaf3 Bug#54483: valgrind errors when making warnings for multiline inserts into partition
Bug#57071: EXTRACT(WEEK from date_col) cannot be allowed as partitioning function

There were functions allowed as partitioning functions
that implicit allowed cast. That could result in unacceptable
behaviour.

Solution was to check that the arguments of date and time functions
have allowed types (field and date/datetime/time depending on function).
2010-12-22 10:50:36 +01:00