Commit graph

25116 commits

Author SHA1 Message Date
Sergey Glukhov
aa5441e1c6 automerge 2009-03-05 15:58:04 +04:00
Guangbao Ni
d65f6b54ca Auto merged 2009-03-05 19:01:46 +00:00
Guangbao Ni
4f0f021c33 BUG#41980 SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 !
When binlog_format is STATEMENT and the statement is unsafe before,
the unsafe warning/error message was issued without checking
whether the SQL_LOG_BIN was turned on or not.
      
Fixed with adding a sql_log_bin_toplevel flag in THD to check
whether SQL_LOG_BIN is ON in current session whatever the current is in sp or not.


mysql-test/suite/binlog/r/binlog_unsafe.result:
  Test case result for unsafe warning/error message
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Test case for unsafe message warning/error
sql/set_var.cc:
  Adding a function set_option_log_bin_bit() which specailly handles to
  the change of SQL_LOG_BIN bit in order to set sql_log_bin_toplevel
  according to SQL_LOG_BIN current value at the same time.
sql/sql_class.cc:
  Initialize the flag sql_log_bin_toplevel in THD::init(),
  and add the condition to check whether unsafe ror message was issued.
sql/sql_class.h:
  Add a sql_log_bin_toplevel flag in THD to indicate whether the toplevel SQL_LOG_BIN is
2009-03-05 18:39:02 +00:00
Sergey Glukhov
3ef86918a2 Bug#41030 Wrong meta data (incorrect fieldlen)
set user variable max length on
fix_length_and_dec() stage
using real value length.


mysql-test/r/variables.result:
  test result
mysql-test/t/variables.test:
  test case
sql/item_func.cc:
  set user variable max length on
  fix_length_and_dec() stage
  using real value length.
2009-03-05 15:34:02 +04:00
Sergey Glukhov
326de4957a Bug#42758 INFORMATION_SCHEMA.COLUMNS is inconsistent
remove 'unsigned', 'zerofill' attributes
from DATA_TYPE column value.


mysql-test/suite/funcs_1/r/is_columns_innodb.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_memory.result:
  result fix
mysql-test/suite/funcs_1/r/is_columns_myisam.result:
  result fix
sql/sql_show.cc:
  remove 'unsigned', 'zerofill' attributes 
  from DATA_TYPE column value.
2009-03-05 15:15:47 +04:00
Kristofer Pettersson
5c42a6cf54 Bug#37416 When SQL_NO_CACHE is used, MySQL still lookup into the query cache
The query cache module did not check for the SQL_NO_CACHE keyword before
attempting to query the hash lookup table. This had a small performance impact.

By introducing a check on the query string before obtaining the hash mutex
we can gain some performance if the SQL_NO_CACHE directive is used often.


sql/sql_cache.cc:
  * Introduced new helper function, has_no_cache_directive, for checking the
    existance of a SQL_NO_CACHE directive before actual parsing of the query.
2009-03-05 11:41:19 +01:00
He Zhenxing
b4fdb8aec1 BUG#37051 Replication rules not evaluated correctly
Backporting patch to 5.0.
2009-03-05 18:10:44 +08:00
Narayanan V
31443a6f73 Bug#42790 Test 'main.innodb' fails from "InnoDB: Error: in ALTER TABLE"
The problem here seem to be that when mysql
is redirecting stderr to a file, stderr becomes 
buffered, whereas it is unbuffered by definition.

The solution is to unbuffer it by setting buffer
to null.

sql/log.cc:
  use setbuf(stderr, NULL) to set the buffer to null.
sql/mysqld.cc:
  use setbuf(stderr, NULL) to set the buffer to null.
2009-03-05 15:18:03 +05:30
Staale Smedseng
f08d47b4f3 Addendum to previous patch for Bug#29458. A number
of system errnos when opening a table are masked 
as ER_FILE_NOT_FOUND. This patch handles this as
"Operation failed" as well.
2009-03-05 09:41:00 +01:00
Timothy Smith
c3fec5d22f Applying InnoDB snashot 5.0-ss4007, part 2. Fixes
Bug #18828: If InnoDB runs out of undo slots, it returns misleading 'table is full'

This is a backport of code already in 5.1+.  The error message change referred
to in the detailed revision comments is still pending.

Detailed revision comments:

r3937 | calvin | 2009-01-15 03:11:56 +0200 (Thu, 15 Jan 2009) | 17 lines
branches/5.0:

Backport the fix for Bug#18828. Return DB_TOO_MANY_CONCURRENT_TRXS
when we run out of UNDO slots in the rollback segment. The backport
is requested by MySQL under bug#41529 - Safe handling of InnoDB running
out of undo log slots.

This is a partial fix since the MySQL error code requested to properly
report the error condition back to the client has not yet materialized.
Currently we have #ifdef'd the error code translation in ha_innodb.cc.
This will have to be changed as and when MySQl add the new requested
code or an equivalent code that we can then use.

Given the above, currently we will get the old behavior, not the
"fixed" and intended behavior.

Approved by:	Heikki (on IM)
2009-03-02 17:57:09 -07:00
Leonard Zhou
63c9bb320f BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE
Set wrong sql_mode when creating a procedure. 
So that the sql_mode can't be writen into binary log correctly.
      
Restore the current session sql_mode right before generating the binlog event
when creating a procedure.

mysql-test/suite/binlog/r/binlog_sql_mode.result:
  Test result
mysql-test/suite/binlog/t/binlog_sql_mode.test:
  Test file for sql_mode testing
sql/sp.cc:
  Restore the current session sql_mode right before generating the binlog event.
2009-02-28 09:35:18 +08:00
Tatiana A. Nurnberg
fe09326edf automerge 2009-02-27 21:43:43 +01:00
Staale Smedseng
a2231e59c5 Commit after merge from 5.0-bugteam 2009-02-27 18:07:58 +02:00
Staale Smedseng
d61f114f7f Commit after merge from 5.1-bugteam 2009-02-27 18:03:32 +02:00
Georgi Kodinov
2bc070a05a merged the fix for bug 41610 to 5.1-bugteam 2009-02-27 17:07:27 +02:00
Staale Smedseng
8eb09f0149 Commit for merge and push 2009-02-27 17:06:23 +02:00
Staale Smedseng
97b68934bc Recommit for merging and pushing 2009-02-27 16:11:15 +02:00
Georgi Kodinov
15760fe9d8 Bug #41610: key_infix_len can be overwritten causing some group by queries to
return no rows

The algorithm of determining the best key for loose index scan is doing a loop
over the available indexes and selects the one that has the best cost.
It retrieves the parameters of the current index into a set of variables.
If the cost of using the current index is lower than the best cost so far it 
copies these variables into another set of variables that contain the 
information for the best index so far.
After having checked all the indexes it uses these variables (outside of the 
index loop) to create the table read plan object instance.
The was a single omission : the key_infix/key_infix_len variables were used 
outside of the loop without being preserved in the loop for the best index 
so far.
This causes these variables to get overwritten by the next index(es) checked.
Fixed by adding variables to hold the data for the current index, passing 
the new variables to the function that assigns values to them and copying 
the new variables into the existing ones when selecting a new current best 
index.
To avoid further such problems moved the declarations of the variables used 
to keep information about the current index inside the loop's compound 
statement.

mysql-test/r/group_min_max.result:
  Bug #41610: test case
mysql-test/t/group_min_max.test:
  Bug #41610: test case
sql/opt_range.cc:
  Bug #41610: copy the infix data for the current best index
2009-02-27 15:25:06 +02:00
Magnus Svensson
fd0aaee2b5 Merge 2009-02-27 11:26:55 +01:00
Tatiana A. Nurnberg
71913e350a Bug#40657: assertion with out of range variables and traditional sql_mode
In STRICT mode, out-of-bounds values caused an error message
to be queued (rather than just a warning), without any further
error-like processing happening. (The error is queued during
update, at which time it's too late. For it to be processed
properly, it would need to be queued during check-stage.)
The assertion rightfully complains that we're trying to send
an OK while having an error queued.

Changeset breaks a lot of tests out into check-stage. This also
allows us to send more correct warnings/error messages.

sql/set_var.cc:
  cleanup: fold get_unsigned() and fix_unsigned() into one,
  as well as all the semi-common code from the ::check
  functions.
2009-02-27 10:27:00 +01:00
Georgi Kodinov
f7f0e8b41f merged 5.0-bugteam -> 5.1-bugteam.
Fixed a warning in 5.1 caused by missing type cast.
2009-02-27 10:03:47 +02:00
Georgi Kodinov
a9d707037a Bug #41354: Access control is bypassed when all columns
of a view are selected by * wildcard

Backported a part of the fix for 36086 to 5.0

mysql-test/r/view_grant.result:
  Bug #41354: test case
mysql-test/t/view_grant.test:
  Bug #41354: test case
sql/sql_acl.cc:
  Bug #41354: return table error when no access and *
sql/sql_base.cc:
  Bug #41354: backported the check in bug 36086 to 5.0
2009-02-26 19:00:44 +02:00
Magnus Svensson
a7fe00afb5 Bug#43215 6 error codes changed from 5.1 to 6.0
sql/share/errmsg.txt:
  - Reserve released error codes in 5.1
2009-02-26 15:01:57 +01:00
Ramil Kalimullin
cd5744db13 Auto-merge 2009-02-26 16:14:33 +04:00
Ramil Kalimullin
c9e1884cd6 Fix for bug#19829:make test Failed in mysql_client_test
*with --with-charset=utf8*

Problem: wrong LONG TEXT field length is sent to a client 
when multibyte server character set used.

Fix: always limit field length sent to a client to 2^32,
as we store it in 4 byte slot.

Note: mysql_client_test changed accordingly.


sql/protocol.cc:
  Fix for bug#19829:make test Failed in mysql_client_test 
  *with --with-charset=utf8*
    - limit field length sent to client to UINT_MAX32 as 
      it may exceeds 32 bit slot for LONG TEXT fields if
      thd_charset->mbmaxlen > 1.
tests/mysql_client_test.c:
  Fix for bug#19829:make test Failed in mysql_client_test
  *with --with-charset=utf8*
    - checking field members have in mind that field length
      is limited to UINT_MAX32.
2009-02-26 12:34:15 +04:00
Sergey Glukhov
89fbca2813 5.0-bugteam->5.1-bugteam merge 2009-02-25 16:18:24 +04:00
Sergey Glukhov
5d2fc53354 Bug#40345 MySQLDump prefixes view name with database name when view references other db
print compact view name if the view belongs to the current database


mysql-test/r/information_schema_db.result:
  result fix
mysql-test/r/mysqldump.result:
  result fix
mysql-test/r/view_grant.result:
  result fix
sql/sql_show.cc:
  print compact view name if the view belongs to the current database
2009-02-25 15:44:50 +04:00
Sergey Glukhov
2bc4ad4f1f Bug#30305 Create routine in wrong context in SHOW PRIVILEGES
Changed context of Create routine to Databases.


mysql-test/r/grant.result:
  result fix
mysql-test/r/sp.result:
  result fix
sql/sql_show.cc:
  Changed context of Create routine to Databases.
2009-02-25 14:20:20 +04:00
Georgi Kodinov
620438fdae backport the fix for bug #37191 to 5.1-bugteam 2009-02-25 12:19:29 +02:00
Alexey Kopytov
cfa529fc3f Automerge. 2009-02-25 10:49:02 +02:00
Alexey Kopytov
318f23c712 Automerge. 2009-02-25 10:39:28 +02:00
Alexey Kopytov
0f6e7f1176 Fixed a build failure on Ubuntu 8.10 introduced by the patch
for bug #15936.

On some platforms fenv.h may #undef the min/max macros
defined in my_global.h.

Fixed by moving the #include directive for fenv.h from
mysqld.cc to my_global.h before definitions for min/max.

include/my_global.h:
  Moved #include <fenv.h> from mysqld.cc.
sql/mysqld.cc:
  Moved #include <fenv.h> to my_global.h.
2009-02-25 10:36:11 +02:00
Tatiana A. Nurnberg
7099d7bc2b Bug#40657: assertion with out of range variables and traditional sql_mode
In STRICT mode, out-of-bounds values caused an error message
to be queued (rather than just a warning), without any further
error-like processing happening. (The error is queued during
update, at which time it's too late. For it to be processed
properly, it would need to be queued during check-stage.)
The assertion rightfully complains that we're trying to send
an OK while having an error queued.

Changeset breaks a lot of tests out into check-stage. This also
allows us to send more correct warnings/error messages.


sql/set_var.cc:
  cleanup: fold get_unsigned() and fix_unsigned() into one,
  as well as all the semi-common code from the ::check
  functions.
2009-02-24 16:42:18 +01:00
Andrei Elkin
5b0721786e merging bug#37313fixes from 5.0-bt to 5.1-bt 2009-02-24 16:59:46 +02:00
Andrei Elkin
a6ac350b3a merging from 5.0-bt rep to a local branch 2009-02-24 16:35:45 +02:00
Andrei Elkin
d091deaf89 fixing compilation warning and adding flush logs to test of bug#37313 2009-02-24 16:17:34 +02:00
Alexey Kopytov
315748a41d Automerge. 2009-02-25 10:48:05 +02:00
Alexey Botchkov
a34bb2b8d8 merging. 2009-02-24 15:29:49 +04:00
Alexey Botchkov
f94eafb262 merging. 2009-02-24 15:22:37 +04:00
Davi Arnaut
e4f4765391 Bug#41110: crash with handler command when used concurrently with alter table
Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table

The problem is that the server wasn't handling robustly failures
to re-open a table during a HANDLER .. READ statement. If the
table needed to be re-opened due to it's storage engine being
altered to one that doesn't support HANDLER, a reference (dangling
pointer) to a closed table could be left in place and accessed in
later attempts to fetch from the table using the handler. Also,
if the server failed to set a error message if the re-open
failed. These problems could lead to server crashes or hangs.

The solution is to remove any references to a closed table and
to set a error if reopening a table during a HANDLER .. READ
statement fails.

mysql-test/include/handler.inc:
  Add test case for Bug#41110 and Bug#41112
mysql-test/r/handler_innodb.result:
  Add test case result for Bug#41110 and Bug#41112
mysql-test/r/handler_myisam.result:
  Add test case result for Bug#41110 and Bug#41112
sql/sql_handler.cc:
  Remove redundant reopen check.
  Set errors even if reopening table.
  Reset TABLE_LIST::table reference when the table is closed.
2009-02-24 10:49:18 +01:00
Davi Arnaut
11b20f27af Bug#41110: crash with handler command when used concurrently with alter table
Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table

The problem is that the server wasn't handling robustly failures
to re-open a table during a HANDLER .. READ statement. If the
table needed to be re-opened due to it's storage engine being
altered to one that doesn't support HANDLER, a reference (dangling
pointer) to a closed table could be left in place and accessed in
later attempts to fetch from the table using the handler. Also,
if the server failed to set a error message if the re-open
failed. These problems could lead to server crashes or hangs.

The solution is to remove any references to a closed table and
to set a error if reopening a table during a HANDLER .. READ
statement fails.

There is no test case in this change set as the test depends on
a testing feature only available on 5.1 and later.

sql/sql_handler.cc:
  Remove redundant reopen check.
  Set errors even if reopening table.
  Reset TABLE_LIST::table reference when the table is closed.
2009-02-24 10:15:21 +01:00
Sergey Petrunia
cb6581d894 - Backport @@optimizer_switch support from 6.0
- Add support for setting it as a server commandline argument
- Add support for those switches:
  = no_index_merge
  = no_index_merge_union
  = no_index_merge_sort_union
  = no_index_merge_intersection

mysql-test/r/index_merge_myisam.result:
  Testcases for index_merge related @@optimizer_switch flags.
mysql-test/t/index_merge_myisam.test:
  Testcases for index_merge related @@optimizer_switch flags.
sql/set_var.cc:
  - Backport @@optimizer_switch support from 6.0
  - Add support for setting it as a server commandline argument
sql/sql_class.h:
  - Backport @@optimizer_switch support from 6.0
sql/sql_select.h:
  - Backport @@optimizer_switch support from 6.0
2009-02-23 19:16:48 +03:00
Alexey Kopytov
144763db0c Manual merge mysql-5.0-bugteam -> mysql-5.1-bugteam. 2009-02-23 17:16:46 +02:00
Alexey Kopytov
c893a5f0e2 Automerge. 2009-02-23 14:54:43 +02:00
Alexey Kopytov
d86c8af30e Automerge. 2009-02-23 14:53:51 +02:00
Alexey Kopytov
8ae8162403 Manual merge to 5.1. 2009-02-23 14:42:31 +02:00
Alexey Kopytov
0e62c9aa63 Fix for bug #15936: "round" differs on Windows to Unix
Both of our own implementations of rint(3) were inconsistent with the
most common behavior of rint() on those platforms that have it: round
to nearest, break ties by rounding to nearest even.

Fixed by leaving just one implementation of rint() in our source tree,
and changing its behavior to match the most common native
implementations on other platforms.

configure.in:
  Added checks for fenv.h and fesetround().
include/config-win.h:
  Removed the incorrect implementation of rint() for Windows.
include/my_global.h:
  Added an rint() implementation for platforms that do not have it.
mysql-test/r/func_math.result:
  Added a test case for bug #15936.
mysql-test/t/func_math.test:
  Added a test case for bug #15936.
sql/mysqld.cc:
  Explicitly set the FPU rounding mode with fesetround().
2009-02-23 14:28:26 +02:00
Leonard Zhou
2b3dfbc176 merge 2009-02-23 16:29:39 +08:00
Leonard Zhou
61d706a4f0 Bug#40013 mixed replication: row based format could lead to stale tmp tables on the
slave.

In mixed mode, if we create a temporary table and do some update which switch to ROW format,
the format will keep in ROW format until the session ends or the table is dropped explicitly. 
When the session ends, the temp table is dropped automaticly at cleanup time.
but it checks only current binlog format and so skip insertion of DROP TABLE instructions into binlog.
So the temp table can't be dropped correctly at slave.

Our solution is that when closing temp tables at cleanup time we check both binlog format and binlog mode,
and we could write DROP TABLE instructions into binlog if current binlog format is ROW but in MIX mode.

mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
  Test result file.
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
  Test file.
sql/sql_base.cc:
  Didn't do binloging when both current format and default format are ROW.
2009-02-23 11:26:38 +08:00
Alfranio Correia
2d3ac117a4 Post-fix for BUG#38174. 2009-02-22 13:40:52 +00:00
Alfranio Correia
d822ab8957 BUG#38174 secure-file-priv breaks LOAD DATA INFILE replication in statement mode
If secure-file-priv was set on slave, it became unable to execute
LOAD DATA INFILE statements sent from master using mixed or
statement-based replication.
                  
This patch fixes the issue by ignoring this security restriction
and checking if the files are created and read by the slave in the
--slave-load-tmpdir while executing the SQL Thread.
2009-02-21 09:36:07 +00:00
Mattias Jonsson
e7e5443a01 Backport of patch for bug#40003 from 6.0 to 5.1,
related to the backport of the patch for bug#38719

sql/ha_partition.cc:
  bug#40003, archive does not handle dup_key.
2009-02-20 16:56:32 +01:00
Andrei Elkin
4712e6b9b8 Bug #37313 BINLOG Contains Incorrect server id
Signed integer format specifier forced to print the binlog header with server_id
negative if the unsigned value sets the sign-bit ON.
  
Fixed with correcting the specifier to correspond to typeof(server_id) == ulong.

mysql-test/r/mysqlbinlog.result:
  results changed.
mysql-test/t/mysqlbinlog.test:
  displaying the expected unsignedly formatted server_id value, bug#37313.
sql/log_event.cc:
  Format specifier is corrected to correspond to typeof(server_id).
2009-02-20 13:55:43 +02:00
Mattias Jonsson
9eaa51099c merge of updated 51-bugteam before pushing... 2009-02-20 11:45:57 +01:00
Mattias Jonsson
330f9fb5a5 merge into an updated 5.1-bugteam. 2009-02-20 11:21:45 +01:00
Georgi Kodinov
30bb35bcda auto merge 2009-02-20 11:57:33 +02:00
Georgi Kodinov
1f6d6fa905 merged 5.0-bugteam -> 5.1-bugteam 2009-02-20 11:50:50 +02:00
Georgi Kodinov
c1ddc60c69 fixed a warning 2009-02-20 11:42:35 +02:00
Davi Arnaut
664bb23a30 Bug#41098: Query Cache returns wrong result with concurrent insert
The problem is that select queries executed concurrently with
a concurrent insert on a MyISAM table could be cached if the
select started after the query cache invalidation but before
the unlock of tables performed by the concurrent insert. This
race could happen because the concurrent insert was failing
to prevent cache of select queries happening at the same time.

The solution is to add a 'uncacheable' status flag to signal
that a concurrent insert is being performed on the table and
that queries executing at the same time shouldn't cache the
results.

mysql-test/r/query_cache_debug.result:
  Add test case result for Bug#41098
mysql-test/t/disabled.def:
  Re-enable test case.
mysql-test/t/query_cache_debug.test:
  Add test case for Bug#41098
sql/sql_cache.cc:
  Debug sync point for regression testing purposes.
sql/sql_insert.cc:
  Remove meaningless query cache invalidate. There is already
  a preceding invalidate for queries that started before the
  concurrent insert.
storage/myisam/ha_myisam.cc:
  Check for a active concurrent insert.
storage/myisam/mi_locking.c:
  Signal the start of a concurrent insert. Flag is zeroed once
  the state is updated back.
storage/myisam/myisamdef.h:
  Add flag to signal a active concurrent insert.
2009-02-19 18:09:35 -03:00
Georgi Kodinov
901427b241 merged 5.0-bugteam -> 5.1-bugteam 2009-02-19 20:30:05 +02:00
Georgi Kodinov
cf42f6689f merged bug 42419 to 5.0-bugteam 2009-02-19 18:26:19 +02:00
Georgi Kodinov
29476d879f Bug #42419: Server crash with "Pure virtual method called" on two concurrent
connections
The problem is that tables can enter open table cache for a thread without 
being properly cleaned up. This can happen if make_join_statistics() fails 
to read a const table because of e.g. a deadlock. It does set a member of 
TABLE structure to a value it allocates, but doesn't clean-up this setting 
on error nor does it set the rest of the members in JOIN to allow for 
automatic cleanup.
As a result when such an error occurs and the next statement depends re-uses 
the table from the open tables cache it will get it with this 
TABLE::reginfo.join_tab pointing to a memory area that's freed.
Fixed by making sure make_join_statistics() cleans up TABLE::reginfo.join_tab 
on error.

mysql-test/r/innodb_mysql.result:
  Bug #42419: test case
mysql-test/t/innodb_mysql-master.opt:
  Bug #42419: increase the timeout so it covers te conservative 
  sleep 3 in the test
mysql-test/t/innodb_mysql.test:
  Bug #42419: test case
sql/sql_select.cc:
  Bug #42419: clean up the members of TABLE on failure in 
          make_join_statisitcs()
2009-02-19 17:30:03 +02:00
Sergey Glukhov
e89fddc636 automerge 2009-02-19 18:52:49 +04:00
Sergey Glukhov
fafeaf460b 5.0-bugteam->5.1-bugteam merge 2009-02-19 17:59:00 +04:00
Sergey Glukhov
c2e23208ef Bug#37601 Cast Is Not Done On Row Comparison
In case of ROW item each compared pair does not
check if argumet collations can be aggregated and
thus appropiriate item conversion does not happen.
The fix is to add the check and convertion for ROW
pairs.


mysql-test/r/row.result:
  test result
mysql-test/t/row.test:
  test case
sql/item.cc:
  added agg_item_set_converter() function which was a part of
  agg_item_charsets() func. The only difference is that
  agg_item_set_converter() checks and converts items 
  using already known collation.
sql/item.h:
  added agg_item_set_converter() function
sql/item_cmpfunc.cc:
  In case of ROW item each compared pair does not
  check if argumet collations can be aggregated and
  thus appropiriate item conversion does not happen.
  The fix is to add the check and convertion for ROW
  pairs.
2009-02-19 17:20:44 +04:00
Alexey Kopytov
c814ccbf41 Automerge. 2009-02-19 12:03:23 +03:00
Alexey Kopytov
0c96241b15 Automerge. 2009-02-19 12:02:11 +03:00
Alexey Kopytov
45e3327f9f Automerge. 2009-02-19 11:56:16 +03:00
Alexey Kopytov
321646095d Fix for bug #41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch()
returns short string value. 
 
Multibyte character sets were not taken into account when 
calculating max_length in Item_param::convert_str_value(). As a 
result, string parameters of a prepared statement could be 
truncated later when calculating string length in characters by 
dividing length in bytes by the charset's mbmaxlen value (e.g. in 
Field_varstring::store()). 
 
Fixed by taking charset's mbmaxlen into account when calculating 
max_length in Item_param::convert_str_value().


sql/item.cc:
  Multiply string's length in characters by charset's mbmaxlen when 
  calculating max_length.
tests/mysql_client_test.c:
  Added a test case for bug #41078.
2009-02-19 11:49:35 +03:00
Mattias Jonsson
830c42a06a Backport of bug#38719 from 6.0 to 5.1
handler::get_dup_key used the called handler for the
info call, but used table->file handler for errkey.
Fixed by using table->file->info instead.

mysql-test/r/partition_error.result:
  Bug#38719: Partitioning returns a different error code for
  a duplicate key error
  
  Added test for verification
mysql-test/t/partition_error.test:
  Bug#38719: Partitioning returns a different error code for
  a duplicate key error
  
  Added test for verification
2009-02-18 21:29:30 +01:00
Mattias Jonsson
85cc17d3cd Bug#36001: Partitions: spelling and using some error messages
Backport from 6.0

Changed error message to show that it is partitioning
that does not support foreign keys yet.

Changed spelling from British english to American english.

mysql-test/r/partition.result:
  Bug#36001: Partitions: spelling and using some error messages
  
  Backport from 6.0
  
  Changed spelling from British english to American english.
mysql-test/r/partition_mgm_err.result:
  Bug#36001: Partitions: spelling and using some error messages
  
  Backport from 6.0
  
  Changed spelling from British english to American english.
mysql-test/t/partition.test:
  Bug#36001: Partitions: spelling and using some error messages
  
  Backport from 6.0
  
  Added test for verifying error message
sql/share/errmsg.txt:
  Bug#36001: Partitions: spelling and using some error messages
  
  Backport from 6.0
  
  Changed spelling from British english to American english.
sql/sql_table.cc:
  Bug#36001: Partitions: spelling and using some error messages
  
  Backport from 6.0
  
  Using a better error message.
2009-02-18 21:10:19 +01:00
Sergey Glukhov
d0ece331a2 5.0->bugteam->5.1-bugteam merge 2009-02-18 16:09:46 +04:00
Sergey Glukhov
544fa7593b Bug#25830 SHOW TABLE STATUS behaves differently depending on table name(for 5.0 only)
replace wild_case_compare with my_wildcmp which is multibyte safe function


mysql-test/r/lowercase_utf8.result:
  test result
mysql-test/t/lowercase_utf8-master.opt:
  test case
mysql-test/t/lowercase_utf8.test:
  test case
sql/sql_show.cc:
  replace wild_case_compare with my_wildcmp which is multibyte safe function
2009-02-17 18:22:48 +04:00
Davi Arnaut
d3a10ec6ef Bug#41077: Warning contains wrong future version
Substitute all references of MySQL version "5.2" to "6.0" in
deprecation warning messages.Deprecated constructs are being
removed in the 6.0 tree.
2009-02-16 08:38:15 -03:00
Ramil Kalimullin
c647f777b8 Auto-merge 2009-02-14 14:47:33 +04:00
Ramil Kalimullin
0e4333f6cc Fix for bug#21476: stack overflow crashes server; error-message
stack reservation too small

Problem: some tests fail on HP-UX due to insufficient stack reservation.

Fix: increase stack reservation.


sql/mysql_priv.h:
  Fix for bug#21476: stack overflow crashes server; error-message
  stack reservation too small
    - raised STACK_MIN_SIZE to pass execution_constants.test on HP-UX.
2009-02-14 14:40:22 +04:00
Alexey Kopytov
d8ac91387b Merge from dev tree. 2009-02-14 12:11:32 +03:00
Alexey Kopytov
fb3e5910ec Merge from dev tree. 2009-02-14 12:09:35 +03:00
Alexey Kopytov
dd35a152f9 Merge mysql-5.0-bugteam -> mysql-5.1-bugteam. 2009-02-13 19:20:56 +03:00
Alexey Kopytov
9373b1b880 Merge from dev tree. 2009-02-13 19:17:07 +03:00
Georgi Kodinov
cc5809f055 merged additional fix for bug 33813 to 5.1-bugteam 2009-02-12 17:30:38 +02:00
Georgi Kodinov
47c53135fd merged 5.0-bugteam to a working tree 2009-02-12 16:39:33 +02:00
Georgi Kodinov
1c5fa3b6a9 Bug #33813: Schema names are case-sensitive in DROP FUNCTION
Additional fix:
 1. Revert the unification of DROP FUNCTION
and DROP PROCEDURE, because DROP FUNCTION can be used to
drop UDFs (that have a non-qualified name and don't require
database name to be present and valid).
 2. Fixed the case sensitivity problem by adding a call to 
check_db_name() (similar to the sp_name production).
2009-02-12 16:36:43 +02:00
Sergey Vojtovich
e994c4f97b Merge 5.0-bugteam -> 5.1-bugteam. 2009-02-12 14:10:07 +04:00
Georgi Kodinov
ccca4feca8 merged bug 33813 to 5.1-bugteam 2009-02-12 11:52:01 +02:00
Sergey Vojtovich
5803e10628 BUG#36737 - having + full text operator crashes mysql
MATCH() function accepts column list as an argument. It was possible to override
this requirement with aliased non-column select expression. Which results in
server crash.

With this fix aliased non-column select expressions are not accepted by MATCH()
function, returning an error.

mysql-test/r/fulltext.result:
  A test case for BUG#36737.
mysql-test/t/fulltext.test:
  A test case for BUG#36737.
sql/item_func.cc:
  Only accept fields as arguments to MATCH().
2009-02-12 13:49:44 +04:00
Georgi Kodinov
7df0e72c7f merged bug 33813 to 5.0-bugteam 2009-02-12 11:27:06 +02:00
Chad MILLER
b8149f09d6 Merge from bug tree. 2009-02-11 23:44:32 -05:00
Chad MILLER
d880862549 Bug#30261: "mysqld --help" no longer possible for root
The check for root-ness would signal an error.  Errors would make the
server exit before usage (help) information was printed.

Now, test for whether we want help regardless of whether we're going
to exit with an error.  If plugins are not initialized by the time we 
print usage information, inform the user that some parameters are 
missing.
2009-02-10 09:41:55 -05:00
Alexey Kopytov
1571f06196 Merge into dev tree. 2009-02-10 16:27:35 +03:00
Alexey Kopytov
fd8bf58ca9 Fix for bug #41868: crash or memory overrun with concat + upper,
date_format functions

String::realloc() did not check whether the existing string data fits in
the newly allocated buffer for cases when reallocating a String object
with external buffer (i.e.alloced == FALSE).  This could lead to memory
overruns in some cases.

client/sql_string.cc:
  Fixed String::realloc() to check whether the existing string data fits
  in the newly allocated buffer for cases when reallocating a String
  object with external buffer.
mysql-test/r/func_str.result:
  Added a test case for bug #41868.
mysql-test/t/func_str.test:
  Added a test case for bug #41868.
sql/sql_class.cc:
  After each call to Item::send() in select_send::send_data() reset
  buffer to its original state to reduce unnecessary malloc() calls. See
  comments for bug #41868 for detailed analysis.
sql/sql_string.cc:
  Fixed String::realloc() to check whether the existing string data fits
  in the newly allocated buffer for cases when reallocating a String
  object with external buffer.
2009-02-10 15:38:56 +03:00
Luis Soares
b7b6773f69 BUG#13684: SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine does not exist
There is an inconsistency with DROP DATABASE IF EXISTS, DROP
TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even
if the DB or TABLE does not exist, whereas DROP PROCEDURE IF
EXISTS does not. It would be nice or at least consistent if DROP
PROCEDURE/STATEMENT worked the same too.
      
Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to
write_bin_log in mysql_execute_command. Checked also if all
documented "DROP (...) IF EXISTS" get binlogged. Left out DROP
SERVER IF EXISTS because it seems that it only gets binlogged when
using row event (see BUG#25705).
2009-02-10 11:52:19 +01:00
Georgi Kodinov
0669b79363 Bug #33813: Schema names are case-sensitive in DROP FUNCTION
The parser was not using the correct fully-qualified-name
production for DROP FUNCTION.
Fixed by copying the production from DROP PROCEDURE.
Tested in the windows specific suite to make sure it's 
tested on a case-insensitive file system.

mysql-test/r/windows.result:
  Bug #33813: test case
mysql-test/t/windows.test:
  Bug #33813: test case
sql/sql_yacc.yy:
  Bug #33813: use the correct production for the name in
  DROP PROCEDURE
2009-02-10 11:58:19 +02:00
Ramil Kalimullin
13b564e461 Fix for bug #40757: Starting server on Windows with
innodb_flush_method=wrong_value causes crash

Problem: after a failed plugin initialization, incompletely 
initialized data remained in the plugin and handlerton data 
structures. These were used later and caused the crash.

Fix: clean-up plugin related data if initialization failed.

Note: no test case added, hand tested.


sql/handler.cc:
  Fix for bug #40757: Starting server on Windows with 
  innodb_flush_method=wrong_value causes crash
    - free allocated hton and set plugin->data 
      (pointing to handlerton) to NULL if plugin->init() fails,
      as we use it as a sign that ha_initialize_handlerton() is failed,
      which is used in ha_finalize_handlerton().
    - do the same if there's no free slot for a plugin in the
      hton2plugin[] array or there are too many storage engines.
    - call plugin->deinit() in such cases as we successfully
      called plugin->init() before.
2009-02-10 12:37:27 +04:00
Mats Kindahl
8a98664d3b Merging with 5.1-bugteam. 2009-02-09 23:51:59 +01:00
Davi Arnaut
86a11e6a39 Merge from upstream 5.1-bugteam. 2009-02-09 16:27:45 -02:00
Davi Arnaut
bab4ff1ae5 Bug#42634: % character in query can cause mysqld signal 11 segfault
The problem is that a unfiltered user query was being passed as
the format string parameter of sql_print_warning which later
performs printf-like formatting, leading to crashes if the user
query contains formatting instructions (ie: %s). Also, it was
using THD::query as the source of the user query, but this
variable is not meaningful in some situations -- in a delayed
insert, it points to the table name.

The solution is to pass the user query as a parameter for the
format string and use the function parameter query_arg as the
source of the user query.

mysql-test/suite/binlog/r/binlog_unsafe.result:
  Add test case result for Bug#42634
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Add test case for Bug#42634
sql/sql_class.cc:
  Don't pass the user query as a format string.
2009-02-09 16:17:58 -02:00
Sergey Glukhov
4d0557a2e6 Bug#42610 Dynamic plugin broken in 5.1.31
added ignore-builtin-innodb option which disabled
initialization of builtin InnoDB plugin

mysql-test/r/innodb_ignore_builtin.result:
  test case
mysql-test/t/innodb_ignore_builtin-master.opt:
  test case
mysql-test/t/innodb_ignore_builtin.test:
  test case
sql/mysql_priv.h:
  added ignore-builtin-innodb option which disabled
  initialization of builtin InnoDB plugin
sql/mysqld.cc:
  added ignore-builtin-innodb option which disabled
  initialization of builtin InnoDB plugin
sql/set_var.cc:
  added ignore-builtin-innodb option which disabled
  initialization of builtin InnoDB plugin
sql/sql_plugin.cc:
  added ignore-builtin-innodb option which disabled
  initialization of builtin InnoDB plugin
2009-02-09 19:03:52 +04:00
Timothy Smith
3ba87c3700 Auto-merge up from 5.0 2009-02-07 16:50:31 +01:00
Tatiana A. Nurnberg
0eca4824c3 auto-merge 2009-02-06 18:47:54 +01:00