Commit graph

26012 commits

Author SHA1 Message Date
Sergey Glukhov
0a0f50e4ab Bug#39270 I_S optimization algorithm does not work properly in some cases
backport to Betony
2009-10-23 12:02:55 +05:00
Sergey Glukhov
424af68331 Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
backport to Betony
2009-10-23 11:56:30 +05:00
Sergey Glukhov
0c7e9e3f52 Bug#5299 Remove SHOW COLUMN TYPES, backport to Betony 2009-10-23 11:20:44 +05:00
1fb18b5d4c Bug#46640: output from mysqlbinlog command in 5.1 breaks replication
Added parentheses around assignment used as truth value for suppressing warnings.
2009-10-23 11:13:42 +08:00
Luis Soares
8a60aa18b6 BUG#34582: mysql-5.1-bugteam-bug-branch --> mysql-5.1-bugteam-latest
(automerge)
2009-10-23 01:03:41 +01:00
Luis Soares
58e2fde011 manual merge: mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge
Conflicts
=========

Text conflict in .bzr-mysql/default.conf
Text conflict in libmysqld/CMakeLists.txt
Text conflict in libmysqld/Makefile.am
Text conflict in mysql-test/collections/default.experimental
Text conflict in mysql-test/extra/rpl_tests/rpl_row_sp006.test
Text conflict in mysql-test/suite/binlog/r/binlog_tmp_table.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
Text conflict in mysql-test/suite/rpl/r/rpl_row_create_table.result
Text conflict in mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_log.result
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
Text conflict in mysql-test/t/mysqlbinlog.test
Text conflict in sql/CMakeLists.txt
Text conflict in sql/Makefile.am
Text conflict in sql/log_event_old.cc
Text conflict in sql/rpl_rli.cc
Text conflict in sql/slave.cc
Text conflict in sql/sql_binlog.cc
Text conflict in sql/sql_lex.h
21 conflicts encountered.

NOTE
====
 mysql-5.1-rpl-merge has been made a mirror of mysql-next-mr:
 - "mysql-5.1-rpl-merge$ bzr pull ../mysql-next-mr"

 This is the first cset (merge/...) committed after pulling 
 from mysql-next-mr.
2009-10-22 23:30:28 +01:00
Alexander Nozdrin
08ecfb9a8b Automerge from mysql-next-mr. 2009-10-23 00:20:44 +04:00
Alexander Nozdrin
9d7d67d436 Fix build failure on Linux. 2009-10-22 23:31:06 +04:00
Alexander Nozdrin
4be6228ce8 Automerge from mysql-next-mr-runtime. 2009-10-22 22:25:04 +04:00
Alexander Nozdrin
67dbff680e Backporting a patch for Bug#43138. That patch had been already backported
to 5.1 partially. This patch brings what was left to mysql-next-mr.

Original revisions in 6.0:
------------------------------------------------------------
revno: 2617.31.26
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt-bug43138.3
timestamp: Thu 2009-04-30 19:31:30 +0400
message:
  Fix for Bug#43138: DROP DATABASE failure does not clean up message list.
  
  The problem was that the high-level function mysql_rm_db() invoked
  low-level mysql_rm_table_part2(), which reported low-level error
  (Unknown table) if SE refused to delete a table. Also when
  mysql_rm_table_part2() reported an error, it didn't add corresponding
  warning into the list (because it is used from other places where such
  behaviour is required).
  
  The fix is to
    1. Remove no_warnings_for_error usage from sql_table.cc
    2. Improve internal error handler support in THD, so that
       a stack of error handlers is allowed.
    3. Create an internal error handler (Drop_table_error_handler)
       to silence useless warnings.
    4. Use the handler in DROP DATABASE and DROP TABLE statements.
------------------------------------------------------------
revno: 2617.69.38
committer: Alexander Nozdrin <alik@sun.com>
branch nick: mysql-next-bugfixing-bug37431
timestamp: Mon 2009-08-24 21:52:09 +0400
message:
  A test case for Bug#37431 (DROP TABLE does not report errors correctly).
------------------------------------------------------------
revno: 2617.31.29
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Fri 2009-05-01 17:37:34 +0400
message:
  Follow-up for fix for bug "Bug#43138: DROP DATABASE failure
  does not clean up message list".
  
  Fixed drop.test failure under non-debug server by moving part
  of test dependent on debug-only feature to separate .test file,
  which won't be run for non-debug versions of server.
------------------------------------------------------------
revno: 2617.45.17
committer: Sergei Golubchik <serg@mysql.com>
branch nick: 6.0-maria
timestamp: Wed 2009-05-13 20:08:58 +0200
message:
  followup for bug#43138
  if delete fails with a permission denied error, we want to show it
------------------------------------------------------------

The patch was backported to 5.1 in scope of Bug#42364 by
the following revision:
------------------------------------------------------------
revno: 2497.975.3
committer: Sergey Glukhov <Sergey.Glukhov@sun.com>
branch nick: mysql-5.1-bugteam
timestamp: Fri 2009-07-03 13:22:06 +0500
message:
  Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
  enabled message storing into error message list
  for 'drop table' command
------------------------------------------------------------
2009-10-22 22:22:53 +04:00
Alexander Nozdrin
cec638b590 Automerge from mysql-next-mr. 2009-10-22 22:06:01 +04:00
Mikael Ronstrom
b980d229ff BUG#46183, added character set identifier on character constants in VALUES part for column list partitioned tables to ensure constants are handled properly according to character sets 2009-10-22 18:17:59 +02:00
Mikael Ronstrom
66f056a64c A lot of fixes to make character set work ok, first step to fixing BUG#48163 2009-10-22 16:15:06 +02:00
Alexander Nozdrin
09195da31e Backporting patches for Bug#38347 (ALTER ROUTINE privilege
allows SHOW CREATE TABLE) from 6.0. Original revisions:
------------------------------------------------------------
revno: 2617.31.8
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt-bug38347
timestamp: Thu 2009-03-26 09:08:24 +0300
message:
  Patch for Bug#38347: ALTER ROUTINE privilege allows SHOW CREATE TABLE.
  
  If a user has any of the following privileges for a table (or the database
  if the table), he should be able to issue SHOW CREATE TABLE for the table:
    - CREATE
    - DROP
    - ALTER
    - DELETE
    - INDEX
    - INSERT
    - SELECT
    - UPDATE
    - TRIGGER
    - REFERENCES
    - GRANT OPTION
    - CREATE VIEW
    - SHOW VIEW
  
  Any other privilege (even SUPER) should not allow SHOW CREATE TABLE.
------------------------------------------------------------
revno: 2617.31.11
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt
timestamp: Fri 2009-03-27 21:36:34 +0300
message:
  Additional patch for Bug#38347 (ALTER ROUTINE privilege
  allows SHOW CREATE TABLE).
  
  The problem was that information_schema.test,
  information_schema_parameters.test and information_schema_routines.test
  failed with the first patch. That happened due to limitation in check_access():
  it allows only SELECT_ACL privilege for INFORMATION_SCHEMA tables.
  
  The patch is to request only SELECT_ACL privilege for INFORMATION_SCHEMA tables.
------------------------------------------------------------
2009-10-22 16:51:51 +04:00
Alfranio Correia
9eb7374c57 Post-fix for BUG#47287.
The label "end" was causing compiler warnings as it was no longer used.
To fix the problem we removed it.
2009-10-22 11:18:28 +01:00
Ramil Kalimullin
51ff23f0f0 Autopush 2009-10-22 14:40:15 +05:00
Konstantin Osipov
11f8ddc7b3 Merge with next-mr-runtime. 2009-10-22 12:46:07 +04:00
Konstantin Osipov
d4632dff5a Backport of revno 2630.28.10, 2630.28.31, 2630.28.26, 2630.33.1,
2630.39.1, 2630.28.29, 2630.34.3, 2630.34.2, 2630.34.1, 2630.29.29,
2630.29.28, 2630.31.1, 2630.28.13, 2630.28.10, 2617.23.14 and
some other minor revisions.

This patch implements: 

WL#4264 "Backup: Stabilize Service Interface" -- all the
server prerequisites except si_objects.{h,cc} themselves (they can
be just copied over, when needed).

WL#4435: Support OUT-parameters in prepared statements.

(and all issues in the initial patches for these two
tasks, that were discovered in pushbuild and during testing).

Bug#39519: mysql_stmt_close() should flush all data
associated with the statement.

After execution of a prepared statement, send OUT parameters of the invoked
stored procedure, if any, to the client.

When using the binary protocol, send the parameters in an additional result
set over the wire.  When using the text protocol, assign out parameters to
the user variables from the CALL(@var1, @var2, ...) specification.

The following refactoring has been made:
  - Protocol::send_fields() was renamed to Protocol::send_result_set_metadata();
  - A new Protocol::send_result_set_row() was introduced to incapsulate
    common functionality for sending row data.
  - Signature of Protocol::prepare_for_send() was changed: this operation
    does not need a list of items, the number of items is fully sufficient.

The following backward incompatible changes have been made:
  - CLIENT_MULTI_RESULTS is now enabled by default in the client;
  - CLIENT_PS_MULTI_RESUTLS is now enabled by default in the client.
2009-10-22 00:02:06 +04:00
Mikael Ronstrom
57d455460d Added checks for no NULL values in VALUES LESS THAN, added tests for no MAXVALUE in VALUES IN 2009-10-21 20:53:44 +02:00
Mikael Ronstrom
cb4bf11965 Merge 2009-10-21 20:11:27 +02:00
Mikael Ronstrom
b2c26b8220 Fixed Information schema for column list partitioned tables 2009-10-21 20:04:34 +02:00
Mikael Ronstrom
3c8c881601 Fixed test cases with regards to error codes 2009-10-21 18:27:34 +02:00
Mattias Jonsson
d89e60c343 WL#3352, minor code formatting fixes after code review 2009-10-21 17:45:34 +02:00
Mikael Ronstrom
e541ab3b53 Removed unnecessary call to fix_parser_data 2009-10-21 17:28:10 +02:00
Alexander Nozdrin
28724351d0 Backporting WL#3953 from 6.0. Original revision:
------------------------------------------------------------
revno: 2476.714.9
committer: markleith@medusa.mysql.com
timestamp: Mon 2007-09-03 23:18:50 +0100
message:
  Bug#25822 / WL#3953 - Log Access Denied errors for bad passwords in the error log
  
  Added logging of Access Denied messages on failed new connections to the 
  error log when log-warnings = 2.
  
  This allows a user to log these messages without having to incur the overhead
  of using the general query log on production systems.
------------------------------------------------------------
2009-10-21 18:00:58 +04:00
Alexander Nozdrin
1ea4a9f371 Update errmsg-utf8.txt after automerge. 2009-10-21 17:25:10 +04:00
Mikael Ronstrom
d46abd8b84 Merge 2009-10-21 13:59:11 +02:00
Alexander Barkov
344ddc85fa Merging mysql-next-mr-merge to mysql-next-mr. 2009-10-21 15:48:22 +05:00
Mikael Ronstrom
8ac7705722 Removed column_list and fixed all issues relating to this change 2009-10-21 12:40:21 +02:00
Ramil Kalimullin
256e3ec03b Fix for bug#47019: Assertion failed: 0, file .\rt_mbr.c,
line 138 when forcing a spatial index

Problem: "Spatial indexes can be involved in the search 
for queries that use a function such as MBRContains() 
or MBRWithin() in the WHERE clause".
Using spatial indexes for JOINs with =, <=> etc.
predicates is incorrect.

Fix: disable spatial indexes for such queries.
2009-10-21 14:04:08 +05:00
Georgi Kodinov
dd02c4a12b Bug #47780: crash when comparing GIS items from subquery
If the first argument to GeomFromWKB function is a geometry
field then the function just returns its value.
However in doing so it's not preserving first argument's 
null_value flag and this causes unexpected null value to
be returned to the calling function.
      
Fixed by updating the null_value of the GeomFromWKB function
in such cases (and all other cases that return a NULL e.g.
because of not enough memory for the return buffer).
2009-10-21 11:43:45 +03:00
Tatiana A. Nurnberg
6af83cbc31 auto-merge 2009-10-20 20:38:56 -07:00
Tatiana A. Nurnberg
0329184cf3 auto-merge 2009-10-20 20:37:33 -07:00
Tatiana A. Nurnberg
cf7e2e1db4 manual merge of 28141 2009-10-20 11:00:07 -07:00
Kristofer Pettersson
d18a9e5f54 Bug#27145 EXTRA_ACL troubles
Post merge fix for embedded server.
2009-10-20 15:40:06 +02:00
Mattias Jonsson
06e871b44d WL#3352: Extending Partitioning Types and new partition function
Moved the new errors back to the end of errmsg.txt

Updated two tests with new error message
2009-10-20 14:59:42 +02:00
Luis Soares
454a0c0d20 BUG#34582: FLUSH LOGS does not close and reopen the binlog index
file
      
Issuing 'FLUSH LOGS' does not close and reopen indexfile.
Instead a SEEK_SET is performed.
      
This patch makes index file to be closed and reopened whenever a
rotation happens (FLUSH LOGS is issued or binary log exceeds 
maximum configured size).
2009-10-20 09:39:40 +01:00
Evgeny Potemkin
3b5bc19439 Auto-merged fix for the bug#41760. 2009-10-20 11:32:38 +04:00
Evgeny Potemkin
c4cf9fc0bb #41760 Inserting into multiple-table views is not working
During insert, we are not reading the rows in a referring table but
instead using the last read row that happens to be in table->record[0].

Now INSERT into such view is denied.
2009-10-20 11:30:41 +04:00
Kristofer Pettersson
e131edc9d4 Automerge 2009-10-20 09:00:01 +02:00
Satya B
ae27af00e7 merge mysql-5.0-bugteam to mysql-5.1-bugteam 2009-10-20 12:07:58 +05:30
Kristofer Pettersson
b1647d178b automerge 2009-10-20 08:21:35 +02:00
Satya B
b2cd0a0f15 Fix for Bug #41597 - After rename of user, there are additional grants when
grants are reapplied.


After renaming a user and trying to re-apply grants results in additional
grants.

This is because we use username as part of the key for GRANT_TABLE structure.
When the user is renamed, we only change the username stored and the hash key
still contains the old user name and this results in the extra privileges

Fixed by rebuilding the hash key and updating the column_priv_hash structure
when the user is renamed
2009-10-20 11:47:57 +05:30
Tatiana A. Nurnberg
3f42e4bd24 Bug#28141: Control C on query waiting on lock causes ERROR 1053 (server shutdown)
If a thread is killed in the server, we throw "shutdown" only if one is actually in
progress; otherwise, we throw "query interrupted".

Control-C in the mysql command-line client is "incremental" now.
First Control-C sends KILL QUERY (when connected to 5.0+ server, otherwise, see next)
Next  Control-C sends KILL CONNECTION
Next  Control-C aborts client.

As the first two steps only pertain to an existing query,
Control-C will abort the client right away if no query is running.

client will give more detailed/consistent feedback on Control-C now.
2009-10-19 21:42:10 -07:00
Georgi Kodinov
db944fda03 Bug #47788: Crash in TABLE_LIST::hide_view_error on
UPDATE + VIEW + SP + MERGE + ALTER

When cleaning up the stored procedure's internal 
structures the flag to ignore the errors for 
INSERT/UPDATE IGNORE was not cleaned up.
As a result error ignoring was on during name 
resolution. And this is an abnormal situation : the
SELECT_LEX flag can be on only during query execution.

Fixed by correctly cleaning up the SELECT_LEX flag 
when reusing the SELECT_LEX in a second execution.
2009-10-19 16:55:04 +03:00
Georgi Kodinov
a17fb97b9b Bug #47412: Valgrind warnings / user can read uninitalized memory using
SP variables

A function call may end without throwing an error or without setting 
the return value. This can happen when e.g. an error occurs while 
calculating the return value.

Fixed by setting the value to NULL when error occurs during evaluation
of an expression.
2009-10-26 11:55:57 +02:00
Alexander Nozdrin
3fd2f50b6c Merge from mysql-trunk-merge. 2009-10-19 17:36:19 +04:00
Guilhem Bichot
b1f765a98a Back-port from 6.0 of the fix for
BUG#41759: "Valgrind warning: Invalid read of size 1 open_tables() with ps-protocol"
(from revid:sergefp@mysql.com-20081227013233-f9n2by8romt37hyi)
2009-10-19 15:23:42 +02:00
Alexander Nozdrin
f3457a73d6 Merge from mysql-5.1. 2009-10-19 17:17:08 +04:00
Guilhem Bichot
b1f6a8e72f Back-port from 6.0 of the fix for
BUG#38049 "incorrect rows estimations with references from preceding table"
(from revid:sergefp@mysql.com-20090126194259-ue20il3qro529l4d).
Compared to 6.0 where EXPLAIN indicates "Using index condition", here in join_optimizer.result
we see "Using where"; it's normal; 6.0 shows the same if disabling Index Condition Pushdown.
2009-10-19 15:14:43 +02:00
Sergei Golubchik
ed8aaec764 Bug#34374 mysql generates incorrect warning
backport to next-mr
2009-10-19 15:13:45 +02:00
Sergei Golubchik
6fecc5b726 bug#34741 prepared show master logs without binlogging debug assert
s/return/DBUG_RETURN/
2009-10-19 15:04:27 +02:00
Kristofer Pettersson
4a494eeb52 Automerge 2009-10-19 15:00:38 +02:00
Kristofer Pettersson
b5559f5305 Bug#27145 EXTRA_ACL troubles
The flag EXTRA_ACL is used in conjugation with our access checks, yet it is
not clear what impact this flag has.
This is a code clean up which replaces use of EXTRA_ACL with an explicit
function parameter.
The patch also fixes privilege checks for:
- SHOW CREATE TABLE: The new privilege requirement is any privilege on
  the table-level.
- CHECKSUM TABLE: Requires SELECT on the table level.
- SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level
  (just as the manual claims)
- SHOW INDEX: Requires any privilege on any column combination.
2009-10-19 14:58:13 +02:00
Mattias Jonsson
4ee04f9bfe port of fixes for bug-20577 and 46362 for TO_SECONDS 2009-10-19 13:40:08 +02:00
Evgeny Potemkin
14994d2148 Bug#30302: Tables that were optimized away are printed in the
EXPLAIN EXTENDED warning.

Query optimizer searches for the constant tables and optimizes them away. This
means that fields of such tables are substituted for their values and on later
phases they are treated as constants. After this constant tables are removed
from the query execution plan. Nevertheless constant tables were shown in 
the EXPLAIN EXTENDED warning thus producing query that might be not an
equivalent of the original query.
        
Now the print_join function skips all tables that were optimized away from
printing to the EXPLAIN EXTENDED warning. If all tables were optimized away it
produces the 'FROM dual' clause.
2009-10-19 15:13:26 +04:00
Mikael Ronstrom
f42cc4a67f Merged in latest wl3352 tree, fixed some non-partition build issues 2009-10-19 13:06:21 +02:00
Mattias Jonsson
49c446059c Manual merge mysql-trunk -> mysql-trunk-wl3352 2009-10-19 12:09:52 +02:00
Kristofer Pettersson
ce9f6dda2c Automerge 2009-10-19 11:07:25 +02:00
Kristofer Pettersson
b77578bbf4 Automerge 2009-10-19 11:02:24 +02:00
Alexander Barkov
fa93f34920 Bug#43207 wrong LC_TIME names for romanian locale
A contributed patch by Andrei Boros (SCA signed).
- Fixing locale definition file
- Adding tests
2009-10-19 13:41:52 +05:00
Alexander Barkov
1b26332898 Bug#46633 Obsolete Serbian locale name
- Renaming sr_YU to sr_RS
- Adding test case
2009-10-19 12:52:29 +05:00
Kristofer Pettersson
4d937b6a37 Bug#47627 SET @@{global.session}.local_variable in stored routine causes crash
Adding @@session and @@global prefixes to a
declared variable in a stored procedure the server
would lead to a crash.

The reason was that during the parsing of the
syntactic rule 'option_value' an uninitialized
set_var object was pushed to the parameter stack
of the SET statement. The parent rule
'option_type_value'  interpreted the existence of
variables on the parameter stack as an assignment
and wrapped it in a sp_instr_set object.

As the procedure later was executed an attempt
was made to run the method 'check()' on an
uninitialized member object (NULL value) belonging
to the previously created but uninitialized object.
2009-10-19 09:43:33 +02:00
Mikael Ronstrom
8cf025ec3f Fix for non-partition builds 2009-10-19 09:10:25 +02:00
Ramil Kalimullin
df0b8e93f5 Fix for bug#47963: Wrong results when index is used
Problem: using null microsecond part in a WHERE condition 
(e.g. WHERE date_time_field <= "YYYY-MM-DD HH:MM:SS.0000") 
may lead to wrong results due to improper DATETIMEs 
comparison in some cases.

Fix: comparing DATETIMEs as strings we must trim trailing 0's
in such cases.
2009-10-18 21:26:55 +05:00
Alexey Kopytov
8e931fe53c Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
The problem was in incorrect handling of predicates involving 
NULL as a constant value by the range optimizer. 
 
For example, when creating a SEL_ARG node from a condition of 
the form "field < const" (which would normally result in the 
"NULL < field < const" SEL_ARG),  the special case when "const" 
is NULL was not taken into account, so "NULL < field < NULL" 
was produced for the "field < NULL" condition. 
 
As a result, SEL_ARG structures of this form could not be 
further optimized which in turn could lead to incorrectly 
constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
structures to always form a sequence of ordered disjoint 
intervals could enter an infinite loop under some 
circumstances. 
 
Fixed by changing get_mm_leaf() so that for any sargable 
predicate except "<=>" involving NULL as a constant, "empty" 
SEL_ARG is returned, since such a predicate is always false.
2009-10-17 00:19:51 +04:00
Alexander Nozdrin
519f1aee78 Pull from mysql-next-mr-runtime. 2009-10-16 20:30:20 +04:00
Alexander Nozdrin
27adfa0777 Backporting a patch for Bug#47421 from 6.0:
revno: 2617.68.41
committer: Alexander Nozdrin <alik@sun.com>
branch nick: mysql-6.0-codebase-bugfixing-bug47421
timestamp: Wed 2009-09-23 17:48:11 +0400
message:
  A patch for Bug#47421 (Server crash from -
  SELECT SUM ( DISTINCT <char_column>) in azalea).
  
  The problem was that DBUG_RETURN() macro should have been
  used instead the 'return' operator.
2009-10-16 20:28:45 +04:00
Konstantin Osipov
2b91a639cc Backport of:
----------------------------------------------------------
revno: 2630.22.11
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-records
timestamp: Mon 2008-08-11 16:40:09 +0400
message:
  Move read_record related functions to a new header - records.h
2009-10-16 19:58:26 +04:00
Mikael Ronstrom
1f38322dc4 Merged in latest changes 2009-10-16 17:44:49 +02:00
Mikael Ronstrom
d52305530c Removed GLOBAL INDEX syntax, need to develop GLOBAL indexes before adding syntax for it 2009-10-16 17:41:15 +02:00
Mikael Ronstrom
05d7593fe3 Fixed review comments 2009-10-16 17:08:34 +02:00
Konstantin Osipov
2ae359db4a Backport of:
----------------------------------------------------------
revno: 2630.13.6
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-3288
timestamp: Fri 2008-07-11 20:22:44 +0400
message:
  WL#3288, step 1: ensure that the SQL layer always closes an open
  cursor (rnd or index read) before closing a handler.
2009-10-16 18:37:43 +04:00
Mikael Ronstrom
1ef62bf621 Fixed removal of column_list keyword for VALUES part, retained for PARTITION BY RANGE/LIST COLUMN_LIST, not entirely working yet 2009-10-16 16:16:06 +02:00
Konstantin Osipov
8441517b52 Backport of 2617.65.4 from 6.0-codebase.
A fix and a test case for Bug#34898 "mysql_info() reports 0 warnings
while mysql_warning_count() reports 1"

Review the patch by Chad Miller, implement review comments
(since Chad left) and push the patch.

This bug is actually not a bug. At least according to Monty.
See Bug#841 "wrong number of warnings" reported back in July 2003
and closed as "not a bug".
mysql_info() was printing the number of truncated columns, not
the number of warnings.
But since the message of mysql_info() was "Warnings: <number of truncated
columns>", people would expect to get the number
of warnings in it, not the number of truncated columns.

So a possible fix would be to change the message of mysql_info()
to say Rows changed: <n>, truncated: <m>.

Instead, put the number of warnings there. That is, remove the
feature that thd->cuted_fields (the number of truncated fields)
is exposed to the client. The number of truncated columns can be
calculated on the client, by analyzing SHOW WARNINGS output,
and in future we may remove thd->cuted_fields altogether.
So let's have one less thing to worry about.
2009-10-16 17:41:43 +04:00
Georgi Kodinov
9588bc2207 merge 2009-10-16 16:11:21 +03:00
Konstantin Osipov
311fe126c5 Fix a windows build failure (next-mr-runtime). 2009-10-16 15:39:57 +04:00
Martin Hansson
c6a11dff02 Bug#46019: ERROR 1356 When selecting from within another
view that has Group By
      
When SELECT'ing from a view that mentions another,
materialized, view, access was being denied. The issue was
resolved by lifting a special case which avoided such access
checking in check_single_table_access. In the past, this was
necessary since if such a check were performed, the error
message would be downgraded to a warning in the case of SHOW
CREATE VIEW. The downgrading of errors was meant to handle
only that scenario, but could not distinguish the two as it
read only the error messages.
      
The special case was needed in the fix of bug no 36086.
Before that, views were confused with derived tables.
      
After bug no 35996 was fixed, the manipulation of errors
during SHOW CREATE VIEW execution is not dependent on the
actual error messages in the queue, it rather looks at the
actual cause of the error and takes appropriate
action. Hence the aforementioned special case is now
superfluous and the bug is fixed.
2009-10-16 13:12:21 +02:00
Georgi Kodinov
8f6f3dba21 Bug #40877: multi statement execution fails in 5.1.30
Implemented the server infrastructure for the fix:

1. Added a function LEX_STRING *thd_query_string(THD) to return
a LEX_STRING structure instead of char *.
This is the function that must be called in innodb instead of 
thd_query()

2. Did some encapsulation in THD : aggregated thd_query and 
thd_query_length into a LEX_STRING and made accessor and mutator 
methods for easy code updating. 

3. Updated the server code to use the new methods where applicable.
2009-10-16 13:29:42 +03:00
Georgi Kodinov
6b81bff83c Revert the fix for bug #47123 until test suite failures are resolved. 2009-10-16 11:42:16 +03:00
Alexander Nozdrin
42ea72dbfe Merge from mysql-5.1. 2009-10-15 17:11:13 +04:00
Magne Mahre
673b530e26 Bug #43054 Assertion `!table->auto_increment_field_not_null' failed when
redefining trigger
      
The 'table->auto_increment_field_not_null' flag is only valid within
processing of a single row, and should be set to FALSE before
navigating to the next row, or exiting the operation.
      
This bug was caused by an SQL error occuring while executing a trigger
after the flag had been set, so the normal resetting was bypassed.
The table object was then returned to the table share's cache in
a dirty condition.   When the table object was reused, an assert
caught that the flag was set.
      
This patch explicitly clears the flag on error/abort.


Backported from mysql-6.0-codebase  revid: 2617.52.1
2009-10-15 14:53:06 +02:00
Sergey Glukhov
7741d9b50d WL#751 Error message construction, backport 2009-10-15 17:23:43 +05:00
Magne Mahre
0a92a34416 Bug #38124 (clean-up patch)
The fix for Bug #38124 introuced a bug. If the value given 
for a set_var exceeded the length of the temporary buffer,
we would read behind the end of the buffer.  Using 
c_ptr_safe(), instead of c_ptr(), ensures that we won't
read beyond the buffer limit

mysql-6.0-codebase revid: 2617.44.1
2009-10-15 13:38:21 +02:00
Magne Mahre
6b80cd916a Bug #37433 Deadlock between open_table, close_open_tables,
get_table_share, drop_open_table
            
In the partition handler code, LOCK_open and share->LOCK_ha_data
are acquired in the wrong order in certain cases.  When doing a
multi-row INSERT (i.e a INSERT..SELECT) in a table with auto-
increment column(s). the increments must be in a monotonically
continuous increasing sequence (i.e it can't have "holes"). To
achieve this, a lock is held for the duration of the operation.
share->LOCK_ha_data was used for this purpose.
            
Whenever there was a need to open a view _during_ the operation
(views are not currently pre-opened the way tables are), and
LOCK_open was grabbed, a deadlock could occur.  share->LOCK_ha_data
is other places used _while_ holding LOCK_open.
            
A new mutex was introduced in the HA_DATA_PARTITION structure,
for exclusive use of the autoincrement data fields, so we don't
need to overload the use of LOCK_ha_data here.
            
A module test case has not been supplied, since the problem occurs
as a result of a race condition, and testing for this condition 
is thus not deterministic.   Testing for it could be done by
setting up a test case as described in the bug report.
2009-10-15 13:07:04 +02:00
Alexey Kopytov
f98d11ee24 Manual merge. 2009-10-15 14:42:51 +04:00
Alexander Barkov
f8a54c72ff Backporting WL#4164 Two-byte collation IDs 2009-10-15 15:17:32 +05:00
Magne Mahre
ebb0b02ce5 Bug #38124 "general_log_file" variable silently unset when using expression
When assigning the new string value to the variable, the
Item::str_value member was used.  This is not according to
the protocol.  str_value is an internal member used for
temporary assignments, and is not consistently set for all
string operations.  It is set for constant strings, so it would
work in these cases, but not for string functions (concat,
substr, etc.)
                  
The correct approach is to use Item::val_str(..) to evaluate
and retrieve the string.

Backport from 6.0-codebase

6.0-codebase revno: 2617.31.17
2009-10-15 11:09:31 +02:00
Vladislav Vaintroub
68c55462ef Bug #48047 Can't do normal shutdown
Fix a regression that crept in when downporting Windows improvements.
Instead of a shutdown thread, another thread that  handledsocket connection was created.
2009-10-15 05:18:52 +02:00
Konstantin Osipov
64dbe379d7 Backport of:
----------------------------------------------------------
revno: 2617.22.5
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Tue 2009-01-27 05:08:48 +0300
message:
  Remove non-prefixed use of HASH.
  Always use my_hash_init(), my_hash_inited(), my_hash_search(),
  my_hash_element(), my_hash_delete(), my_hash_free() rather
  than non-prefixed counterparts (hash_init(), etc).
  Remove the backward-compatible defines.
2009-10-14 20:37:38 +04:00
Jorgen Loland
a91b18262c Followup patch for BUG#47280
Temporary tables may set join->group to 0 even though there is 
grouping. Also need to test if sum_func_count>0 when JOIN::exec() 
decides whether to present results in a grouped manner.
2009-10-14 18:20:01 +02:00
Konstantin Osipov
902f99bcba Backport of:
----------------------------------------------------------
revno: 2630.28.1
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Thu 2008-10-23 15:23:44 +0400
message:
  Bug#32738 "mysqld: Two slow log option/variable descriptions are
  inaccurate"
  Update option description per suggestion from the documentation team.
2009-10-14 18:07:50 +04:00
Jon Olav Hauglid
6438ca9f18 Backport of revno: 2617.81.4
Bug #47274 assert in open_table on CREATE TABLE <already existing>

The problem was an assertion during execution of CREATE TABLES. 
This assertion would occur if INSERT DELAYED or REPLACE DELAYED
were used to update a table containing an AUTO_INCREMENT column
and if the inserted row had a user-supplied value for that column.
Any CREATE TABLE statement (including CREATE TABLE SELECT and
CREATE TABLE LIKE) trying to create the same table and 
which followed the INSERT/REPLACED would cause the assertion.

The problem was only noticeable on debug builds of the server
and not present in the mysql-5.1 tree.

The cause of the problem was that the code for delayed insert did
not properly reset the TABLE->auto_increment_if_null flag after 
The flag is used to indicate that a non-null value of an auto_increment field
has been provided by the user or retrieved from a current record.
Open_tables() contains an assertion that tests this flag, and this
was triggered by CREATE TABLE.

This patch fixes the problem by resetting the auto_increment_if_null
field to FALSE once INSERT/REPLACE DELAYED has updated the table, 
similar to what is done already for regular INSERT statements.

Test case added to delayed.test.
2009-10-14 14:50:26 +02:00
Alexander Barkov
583b853092 A postfix for backporting WL#1397 convert XML -> SQL
mysql-test/r/loadxml.result
mysql-test/t/loadxml.test
  Fixing non-deterministic test results

sql/sql_yacc.yy
  Initializing fname_first using get_tok_end() instead of get_ptr().
  The latter is grammar-dependant. The former is not.
2009-10-14 17:10:22 +05:00
Konstantin Osipov
7fc8846718 Backport of:
----------------------------------------------------------
revno: 2630.22.31
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Thu 2008-10-02 19:08:09 +0400
message:
  Bug #34818 --default-table-type option should be removed
  Remove the deprecated option.
2009-10-14 15:34:20 +04:00
Konstantin Osipov
4db335dcee Backport of:
----------------------------------------------------------
revno: 2630.22.8
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Sun 2008-08-10 18:49:52 +0400
message:
  Get rid of typedef struct for the most commonly used types:
  TABLE, TABLE_SHARE, LEX. This simplifies use of tags
  and forward declarations.
2009-10-14 15:14:58 +04:00
Jorgen Loland
bf0aa2bd34 Bug#47280 - strange results from count(*) with order by multiple
columns without where/group
                     
Simple SELECT with implicit grouping used to return many rows if
the query was ordered by the aggregated column in the SELECT
list. This was incorrect because queries with implicit grouping
should only return a single record.
                              
The problem was that when JOIN:exec() decided if execution needed
to handle grouping, it was assumed that sum_func_count==0 meant
that there were no aggregate functions in the query. This
assumption was not correct in JOIN::exec() because the aggregate
functions might have been optimized away during JOIN::optimize().
                  
The reason why queries without ordering behaved correctly was
that sum_func_count is only recalculated if the optimizer chooses
to use temporary tables (which it does in the ordered case).
Hence, non-ordered queries were correctly treated as grouped.
                  
The fix for this bug was to remove the assumption that
sum_func_count==0 means that there is no need for grouping. This
was done by introducing variable "bool implicit_grouping" in the
JOIN object.
2009-10-14 10:46:50 +02:00
Alexander Nozdrin
ca08f10ccd Manual merge from mysql-trunk-merge. 2009-10-14 12:25:39 +04:00
He Zhenxing
c1584c9801 Postfix after merge semi-sync with heartbeat
Use ev_offset instead of 1 as the packet header offset when getting
log position from events for heartbeat

call reset_transmit_packet before calling send_heartbeat_event
2009-10-14 13:24:47 +08:00
0ece5891a2 Bug#46640: output from mysqlbinlog command in 5.1 breaks replication
The BINLOG statement was sharing too much code with the slave SQL thread, introduced with
the patch for Bug#32407. This caused statements to be logged with the wrong server_id, the
id stored inside the events of the BINLOG statement rather than the id of the running 
server.
      
Fix by rearranging code a bit so that only relevant parts of the code are executed by
the BINLOG statement, and the server_id of the server executing the statements will 
not be overrided by the server_id stored in the 'format description BINLOG statement'.
2009-10-14 09:39:05 +08:00
Konstantin Osipov
2f01aa9727 ----------------------------------------------------------
revno: 2630.2.16
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Fri 2008-06-27 13:26:03 +0400
message:
  Fix max_user_connections_func failure on Solaris.
  A connection that failed to log in due to a resource limit could
  be returned to the thread pool with a dangling link to user_connect
  structure of an old user. Later on it could be authenticated
  to a user that doesn't have a resource limit, so this dangling
  link won't be reset. --pool-of-threads mode made the situation
  easy to reproduce, and thus highlighted a bug that has been
  around forever.
  Make sure there are no dangling links.
2009-10-14 00:16:41 +04:00
Konstantin Osipov
3dd1d5983b Backport of the following revision from 6.0-codebase:
----------------------------------------------------------
revno: 2617.1.12
committer: kostja@bodhi.(none)
timestamp: Sun 2008-04-20 11:18:52 +0400
message:
  A fix for Bug#32771 "events_bugs.test fails randomly".
  In Event_scheduler::stop(), which may be called from destructor,
  wait synchronously for the parallel Event_scheduler::stop() to
  complete before returning. This fixes a race between
  MySQL shutdown thread and the scheduler thread who could call
  stop() in parallel.
2009-10-13 22:29:28 +04:00
Konstantin Osipov
ea6a22bfa8 Introduce thd->query_cache_tls (thread
local storage for query cache). 
We need more than one pointer in a thread to
represent the query cache and net->query_cache_query can not be used
any more (due to ABI compatibility issues and to different life
time of NET and THD).
This is a backport of the following patch from 6.0:
----------------------------------------------------------
revno: 2476.1157.2
committer: kostja@bodhi.(none)
timestamp: Sat 2007-06-16 13:29:24 +0400
2009-10-13 22:18:48 +04:00
Gleb Shchepa
bc7c439e6b Backport of fix to bug #33629 into mysql-next-mr-bugfixing.
Bug #33629: last_day function can return null, but has 'not null' flag set for result

LAST_DAY and MAKEDATE functions are documented as
returning NULL value, but actually they was implemented
as returning NOT NULL typed values.

That caused a confusing error "ERROR 1048 (23000): Column
'...' cannot be null" on queries like: 

  SELECT 1 FROM (SELECT LAST_DAY('0')) a;
2009-10-13 21:50:08 +05:00
Alexey Kopytov
5db734a896 Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
The problem was in incorrect handling of predicates involving 
NULL as a constant value by the range optimizer.  
 
For example, when creating a SEL_ARG node from a condition of 
the form "field < const" (which would normally result in the 
"NULL < field < const" SEL_ARG),  the special case when "const" 
is NULL was not taken into account, so "NULL < field < NULL" 
was produced for the "field < NULL" condition. 
 
As a result, SEL_ARG structures of this form could not be 
further optimized which in turn could lead to incorrectly 
constructed SEL_ARG trees. In particular, code assuming SEL_ARG 
structures to always form a sequence of ordered disjoint 
intervals could enter an infinite loop under some 
circumstances. 
 
Fixed by changing get_mm_leaf() so that for any sargable 
predicate except "<=>" involving NULL as a constant, "empty" 
SEL_ARG is returned, since such a predicate is always false.
2009-10-13 19:49:32 +04:00
Alexander Nozdrin
0f51423532 Merge from mysql-5.1. 2009-10-13 13:42:38 +04:00
Ramil Kalimullin
5a23617a80 Fix for bug#47963: Wrong results when index is used
Problem: using null microsecond part (e.g. "YYYY-MM-DD HH:MM:SS.0000") 
in a WHERE condition may lead to wrong results due to improper
DATETIMEs comparison in some cases.

Fix: as we compare DATETIMEs as strings we must trim trailing 0's
in such cases.
2009-10-13 09:43:27 +05:00
He Zhenxing
eb1b89a9ef Auto merge 2009-10-13 12:24:59 +08:00
Sergei Golubchik
df59e27b4e bug#33731 - INSTALL/UNINSTALL PLUGIN: Inconsistent handling of identifier case
indexed column in mysql.plugin table should use case-insensitive collation
for index lookups to work

(backport from 6.0)
2009-10-12 20:15:10 +02:00
Magne Mahre
10390cec03 Bug #33693 general log name and location depend on PID file,
not on predefined values

The default name of the PID file was constructed, as documented, 
based on the hostname.  This name was subsequently used as the
base for the general log file name.   If the name of the PID
file was overridden in the configuration, and no explicit name
was set for the general log file, the path location for the
PID file was used also for the general log file.
                  
A new variable, 'default_logfile_name', has been introduced.  This name
is constructed based on the hostname, and is then used to
construct both the PID file and the general log file.
                  
The general log file will now, unless explicitly set, be
located in the server data directory (as documentated in
the server docs)
2009-10-12 15:35:30 +02:00
Kristofer Pettersson
1574e9cd3f Bug#46944 Internal prepared XA transction XIDs are not
removed if server_id changes

When MySQL crashes (or a snapshot is taken which simulates
a crash), then it is possible that internal XA
transactions (used to sync the binary log and InnoDB)
can be left in a PREPARED state, whereas they should be
rolled back.  This is done when the server_id changes
before the restart occurs.  

This patch releases he restriction that the server_id
should be consistent if the XID is to be considerred
valid. The rollback phase should then be able to
clean up all pending XA transactions.
2009-10-12 14:46:00 +02:00
Alexander Barkov
741a1df4cc WL#1397 convert XML -> SQL 2009-10-12 11:22:53 +05:00
Tatiana A. Nurnberg
bab4889fbb manual merge of Bug#43508 2009-10-09 23:57:43 +02:00
Alexander Nozdrin
132ef2e2ef A backporting patch for WL#4300 (Define privileges for tablespaces).
Original revision in 6.0:
------------------------------------------------------------
revno: 2630.13.11
committer: Alexander Nozdrin <alik@mysql.com>
branch nick: 6.0-rt-wl4300
timestamp: Thu 2008-07-24 11:44:21 +0400
message:
  A patch for WL#4300: Define privileges for tablespaces.
------------------------------------------------------------

per-file messages:
  mysql-test/r/grant.result
    Update result file: new columm 'Create_tablespace_priv' has been added to mysql.user.
  mysql-test/r/ps.result
    Update result file: new columm 'Create_tablespace_priv' has been added to mysql.user.
  mysql-test/r/system_mysql_db.result
    Update result file: new columm 'Create_tablespace_priv' has been added to mysql.user.
  mysql-test/suite/falcon/r/falcon_tablespace_priv.result
    Test case for WL#4300.
  mysql-test/suite/falcon/t/falcon_tablespace_priv.test
    Test case for WL#4300.
  mysql-test/suite/ndb/r/ndb_dd_ddl.result
    Test case for WL#4300.
  mysql-test/suite/ndb/t/ndb_dd_ddl.test
    Test case for WL#4300.
  scripts/mysql_system_tables.sql
    New columm 'Create_tablespace_priv' has been added to mysql.user.
  scripts/mysql_system_tables_data.sql
    'CREATE TABLESPACE' is granted by default to the root user.
  scripts/mysql_system_tables_fix.sql
    Grant 'CREATE TABLESPACE' privilege during system table upgrade
    if a user had SUPER privilege.
  sql/sql_acl.cc
    Added CREATE TABLESPACE privilege.
  sql/sql_acl.h
    Added CREATE TABLESPACE privilege.
  sql/sql_parse.cc
    Check global 'CREATE TABLESPACE' privilege for the following SQL statements:
      - CREATE | ALTER | DROP TABLESPACE
      - CREATE | ALTER | DROP LOGFILE GROUP
  sql/sql_show.cc
    Added CREATE TABLESPACE privilege.
  sql/sql_yacc.yy
    Added CREATE TABLESPACE privilege.
2009-10-10 00:01:10 +04:00
Jon Olav Hauglid
ca77f18064 Bug #34197 CREATE PROCEDURE fails when COMMENT truncated in non
strict SQL mode

The problem was that a COMMENT longer than 64 characters
caused CREATE PROCEDURE to fail.

This patch fixed the problem by changing the COMMENT field in 
mysql.proc from char(64) to text. The corresponding ROUTINE_COMMENT
field in INFORMATION_SCHEMA.ROUTINES is also changed from
varchar(64) to longtext.

mysql_system_tables.sql and mysql_system_tables_fix.sql updated.
Test case added to sp.test and affected result-files updated.
2009-10-09 17:35:07 +02:00
Dmitry Lenev
268da1b1d3 Fix for bug #39932 "create table fails if column for FK is in different
case than in corr index".

Server was unable to find existing or explicitly created supporting
index for foreign key if corresponding statement clause used field
names in case different than one used in key specification and created
yet another supporting index.
In cases when name of constraint (and thus name of generated index)
was the same as name of existing/explicitly created index this led
to duplicate key name error.

The problem was that unlike all other code Key_part_spec::operator==()
compared field names in case sensitive fashion. As result routines
responsible for getting rid of redundant generated supporting indexes
for foreign key were not working properly for versions of field names
using different cases.
2009-10-09 19:18:52 +04:00
Jon Olav Hauglid
43bf01e337 Bug #21099 MySQL 5.0.22 silently creates MyISAM tables even though
InnoDB specified.
            
NO_ENGINE_SUBSTITUTION added to TRADITIONAL sql mode to prevent
silent conversions from InnoDB to MyISAM in that sql mode.

A number of test case results files updated to reflect this change.
Test added to sql_mode.test that checks that TRADITIONAL really 
includes NO_ENGINE_SUBSTITUION.
2009-10-09 16:52:02 +02:00
Dmitry Lenev
d4669dc412 This patch is prerequisite for the 2nd milestone of WL#148 "Foreign keys"
storing and restoring information about foreign keys in the .FRM files and
properly displaying it in SHOW CREATE TABLE output and I_S tables.

The idea of this patch is to change type of Key_part_spec::field_name and
Key::name to LEX_STRING in order to avoid extra strlen() calls during
semantic analysis and statement execution, particularly, in code to be
implemented on the 2nd milestone of WL#148.

Note that since we are not using LEX_STRING everywhere yet (e.g. in
Create_field and KEY) and we want to limit scope of our changes we
have to do strlen() in places where we create Key and Key_part_spec
instances from objects using plain (char*) for strings. These calls
will go away during the process of further (char*) -> LEX_STRING
refactoring.

We have introduced these changes in 6.0 and backported them to 5.5
tree to make people aware of these changes as early as possible and
to simplify merges with mysql-fk and mysql-6.1-fk trees.

No test case is needed since this patch does not introduce any
user visible changes.
2009-10-09 18:29:51 +04:00
Jon Olav Hauglid
0eccb93214 Bug #44651 "have_community_features" variable should be renamed
"have_profiling"

1) Renamed have_community_features server system variable to
have_profiling.
2) Removed eable-community-features configure option and
ENABLE_COMMUNITY_FEATURES macro.
3) Removed COMMUNITY_SERVER macro and replaced its usage by 
ENABLED_PROFILING.

Only --enable-profiling is now needed to enable profiling.
It was the only existing "community feature", so there was
no need for both configure options.

Using --enable-community-features will give a warning message
since it no longer exists.
2009-10-09 15:59:25 +02:00
Staale Smedseng
5eb71aca21 This is a backport of the two patches for Bug #28299:
To-number conversion warnings work differenly with CHAR 
and VARCHAR sp variables.

The original revision-IDs are:
  staale.smedseng@sun.com-20081124095339-2qdvzkp0rn1ljs30
  staale.smedseng@sun.com-20081125104611-rtxic5d12e83ag2o
                                                
The patch provides ER_TRUNCATED_WRONG_VALUE warning messages
for conversion of VARCHAR to numberic values, in line with
messages provided for CHAR conversions. Conversions are
checked for success, and the message is emitted in case
failure.
                                                
The tests are amended to accept the added warning messages,
and explicit conversion of ON/OFF values is added for
statements checking system variables. In test
rpl.rpl_switch_stm_row_mixed checking for warnings is
temporarily disabled for one statement, as this generates
warning messages for strings that vary between executions.
2009-10-09 15:34:07 +02:00
Andrei Elkin
124ad21d01 backporting fixes of bug@45940 to 5.1-rpl+2 to cover failures rpl_heartbeat_* as well. 2009-10-09 16:26:37 +03:00
Alexander Nozdrin
bf1ed58676 Merge from mysql-next-mr-alik (WL#4085). 2009-10-09 17:10:13 +04:00
Alexander Nozdrin
84510f0375 Merge from mysql-next-mr. 2009-10-09 17:09:16 +04:00
Alexander Nozdrin
be37e44946 Merge from mysql-next-mr. 2009-10-09 17:05:11 +04:00
Magne Mahre
e15708d5d2 Bug #31031 ALTER TABLE regression in 5.0
An ALTER TABLE statement which added a column and added
a non-partial index on it failed with:
            
"ERROR 1089 (HY000): Incorrect sub part key; the used
key part isn't a string, the used length is longer than
the key part, or the storage engine doesn't support unique
sub keys"
            
In a check introduced to fix an earlier bug (no. 26794),
to allow for indices on spatial type columns, the
test expression was flawed (a logical OR was used instead
of a logical AND), which led to this regression.
            
The code in question does a sanity check on the key, and
the flawed code mistakenly classified any index created
in the way specified above as a partial index.  Since
many data types does not allow partial indices, the
statement would fail.
2009-10-09 15:04:58 +02:00
Tatiana A. Nurnberg
aa9fa97edf Bug#43508: Renaming timestamp or date column triggers table copy
We set up DATE and TIMESTAMP differently in field-creation than we
did in field-MD creation (for CREATE). Admirably, ALTER TABLE
detected this and didn't damage any data, but it did initiate a
full copy/conversion, which we don't really need to do.

Now we describe Field and Create_field the same for those types.
As a result, ALTER TABLE that only changes meta-data (like a
field's name) no longer forces a data-copy when there needn't
be one.
2009-10-09 14:41:04 +02:00
Alexander Nozdrin
10b43fcdcf Merge RT patches from mysql-next-mr-bugfixing. 2009-10-09 15:45:18 +04:00
Alexander Nozdrin
92bd11a9b0 Merge from mysql-next-mr. 2009-10-09 15:42:31 +04:00
Alexander Nozdrin
0845f51f4f Pull from mysql-next-mr. 2009-10-09 13:50:49 +04:00
Martin Hansson
eded60737d Bug#42846: wrong result returned for range scan when using
covering index
      
When two range predicates were combined under an OR
predicate, the algorithm tried to merge overlapping ranges
into one. But the case when a range overlapped several other
ranges was not handled. This lead to

1) ranges overlapping, which gave repeated results and 
2) a range that overlapped several other ranges was cut off.  

Fixed by 

1) Making sure that a range got an upper bound equal to the
next range with a greater minimum.
2) Removing a continue statement
2009-10-09 11:30:40 +02:00
Konstantin Osipov
62672568bd Backport to 5.4 the following changesets:
revno: 2476.785.24
committer: kostja@bodhi.(none)
timestamp: Tue 2007-10-16 20:19:00 +0400
message:
  Reflect a rename of a member in the client ABI (a compatible change).
----------------------------------------------------------
revno: 2476.423.26
committer: kostja@bodhi.(none)
timestamp: Tue 2007-10-16 20:12:37 +0400
message:
  Update the client ABI to reflect member rename
  (this is a backward-compatible change).
----------------------------------------------------------
revno: 2476.785.22
committer: kostja@bodhi.(none)
timestamp: Tue 2007-10-16 19:37:25 +0400
message:
  Remove some remains of support of 3.22 protocol. This was in fact dead code,
  since the option to talk 3.22 protocol was removed in 4.1 and there
  is no other protocol negotiation mechanism besides this option.
2009-10-09 13:06:41 +04:00
Dmitry Lenev
a7b0148057 Fix for bug #44738 "fill_schema_table_from_frm() opens tables without
lowercasing table name".

In lower_case_table_names > 0 mode some queries to I_S left entries
with incorrect key in table definition cache. This wasted memory and
caused some of the further queries to I_S to produce stale results
in cases when table definition was changed by a DDL statement.
Also in combination with similar problem in CREATE TABLE (which also
has peeked into table definition cache using non-normalized key) this
issue led to to spurious ER_TABLE_EXISTS_ERROR errors when one tried
to create a table with the same name as a previously existing but
dropped table (assuming that table name contained characters in upper
case).

This problem occured due to fact that fill_schema_table_from_frm()
was not properly normalizing (lowercasing) database and table names
which it used for lookups in table definition cache.

This fix adds proper normalization to this function. It also solves
similar problem in CREATE TABLE's code by ensuring that it uses
properly normalized version of table name when it peeks into table
definition cache instead of non-normalized one.
2009-10-09 13:00:18 +04:00
He Zhenxing
090985ffe6 Bug#47323 : mysqlbinlog --verbose displays bad output when events contain subset of columns
Commit the non-NDB specific part (originated by frazer) to 5.1 mainline.
2009-10-09 16:54:48 +08:00
Mattias Jonsson
cd73187378 merge into mysql-5.1-bugteam 2009-10-09 09:56:07 +02:00
Mattias Jonsson
5105fd1cc2 merge into mysql-5.1-bugteam 2009-10-09 09:54:48 +02:00
Frazer Clement
5f8cfacf6c Merge 5.0-bugteam-> 5.1-bugteam 2009-10-08 16:36:36 +01:00
Mattias Jonsson
27b80f9db8 Bug#44059: Incorrect cardinality of indexes on a partitioned table
backport for bug#44059 from mysql-pe to mysql-5.1-bugteam

Using the partition with most rows instead of first partition
to estimate the cardinality of indexes.
2009-10-08 15:58:17 +02:00
Mattias Jonsson
87a4644db8 Bug#46922: crash when adding partitions and open_files_limit
is reached

Problem was bad error handling, leaving some new temporary
partitions locked and initialized and some not yet initialized
and locked, leading to a crash when trying to unlock the not
yet initialized and locked partitions

Solution was to unlock the already locked partitions, and not
include any of the new temporary partitions in later unlocks
2009-10-08 15:36:43 +02:00
Georgi Kodinov
d9ce9f215d automerge 2009-10-08 16:24:58 +03:00
Georgi Kodinov
03904aee4e Addendum to the fix for bug 43029 2009-10-08 16:21:07 +03:00
Ramil Kalimullin
99318017d5 Fix for bug #42803: Field_bit does not have unsigned_flag field,
can lead to bad memory access

Problem: Field_bit is the only field which returns INT_RESULT
and doesn't have unsigned flag. As it's not a descendant of the 
Field_num, so using ((Field_num *) field_bit)->unsigned_flag may lead
to unpredictable results.

Fix: check the field type before casting.
2009-10-08 16:56:31 +05:00
Magnus Blåudd
9279d2a5c0 Merge 2009-10-08 13:36:42 +02:00
Alexander Nozdrin
f4d27e81bb Merge from mysql-next-mr. 2009-10-08 11:42:38 +04:00
Luis Soares
75a4dd3e6a BUG#40611, BUG#44779: reverted in mysql-5.1-rep+2. 2009-10-07 22:13:07 +01:00
Alexander Nozdrin
83177656d9 A backport of a patch for Bug#35297.
Original revision in mysql-6.0-codebase is:

revno: 2617.31.14
committer: Konstantin Osipov <kostja@sun.com>
branch nick: mysql-6.0-runtime
timestamp: Sat 2009-03-28 11:42:55 +0300
message:
  Bug#35297 SHOW CREATE EVENT does not show the DEFINER:
  update test result after a merge from now.
2009-10-08 00:57:03 +04:00
Alexander Nozdrin
4db0f8b832 A backport a patch of Bug#34828.
Original revision is from mysql-6.0-codebase:

revno: 2617.23.13
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt-bug34828
timestamp: Tue 2009-02-24 14:25:46 +0300
message:
  A patch for Bug#34828: OF is taken as OFF and a value of 0
  is set for variable SQL_notes.
  
  The problem was that partial match was allowed for keywords.
  
  A fix is to disable partial match and require full match.
2009-10-07 20:49:26 +04:00
Alexander Nozdrin
104efe86ab A backport of patch for Bug#26704.
Original revision is from mysql-6.0-codebase:

revno: 2630.3.1
committer: Alexander Nozdrin <alik@mysql.com>
branch nick: 6.0-rt-bug26704
timestamp: Thu 2008-05-29 21:04:06 +0400
message:
  A fix for Bug#26704: Failing DROP DATABASE brings
  mysql-client out of sync.

  The problem was that we changed current database w/o caring
  whether it was dropped successfully or not.

  The fix is not to change current database if we failed to drop it.
2009-10-07 20:39:57 +04:00
Georgi Kodinov
5faf23bf55 Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join
buffering is used

FORCE INDEX FOR ORDER BY now prevents the optimizer from 
using join buffering. As a result the optimizer can use
indexed access on the first table and doesn't need to 
sort the complete resultset at the end of the statement.
2009-10-07 18:03:42 +03:00
Mikael Ronstrom
b216aab1c4 BUG#47837, Duplicate field names were allowed in both column list partitioning and key partitioning, added check to give error in this case 2009-10-06 17:01:59 +02:00
Mikael Ronstrom
19ef2eff9c BUG#47838, NULL values in ranges was dropped due to missing else part in store_tuple_to_record 2009-10-06 16:22:15 +02:00