Commit graph

26054 commits

Author SHA1 Message Date
Marc Alff
2497093ad4 Bug#38968 Unused mutex LOCK_bytes_sent, LOCK_bytes_received
Backport for 5.5
2009-10-29 09:21:16 -06:00
Marc Alff
8826df67a3 Bug#38967 Unused mutex LOCK_Acl
Backport to 5.5
2009-10-29 09:07:29 -06:00
Mikael Ronstrom
840d7eb4f8 BUG#48397, set key_part->length to key_part->store_length isn't correct, store_length is a bit longer 2009-10-29 13:08:35 +01:00
Kristofer Pettersson
2d6a356abf Bug#38551 query cache can still consume [very little] cpu time even when it is off.
When the query cache is disabled, the server shouldn't attempt to take the 
query cache mutex.
                             
By using the command line option --query_cache_type=0, the user can disable
   
(backport from mysql-pe)
2009-10-29 12:19:36 +01:00
Alexander Barkov
59ccc26197 A postfix for Bug#46633 Obsolete Serbian locale name
Re-Allowing sr_YU with a "deprecated" warning.
2009-10-29 15:10:36 +04:00
Mikael Ronstrom
8e31ec1deb Fixed code review change to ensure that VALUES constants are of the same result type as the field they are constants for 2009-10-28 19:20:32 +01:00
Mikael Ronstrom
2d1c1f8280 Merge 2009-10-28 18:32:48 +01:00
Mikael Ronstrom
d9e05040f4 Merged WL#3352 into mysql-next-mr 2009-10-28 18:22:36 +01:00
Mattias Jonsson
07f9da5d5d merge 2009-10-28 17:30:58 +01:00
Sergey Vojtovich
d6f27e58b7 BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
XA START may cause assertion failure/server crash when it is called
after unilateral roll back issued by the Resource Manager (both
in regular transaction and after XA transaction).

The problem was that rm_error variable wasn't set/reset properly.
2009-10-28 19:39:08 +04:00
Konstantin Osipov
fdcf0aff02 A patch and a test case for
Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT FOR UPDATE.

If a transaction was rolled back inside InnoDB due to a deadlock
or lock wait timeout, and the statement had IGNORE clause,
the server could crash at the end of the statement or on shutdown.

This was caused by the error handling infrastructure's attempt to 
ignore a non-ignorable error.

When a transaction rollback request is raised, switch off 
current_select->no_error flag, so that the following error
won't be ignored.

Instead, we could add !thd->is_fatal_sub_stmt_error to
my_message_sql(), but since in write_record() we switch
off no_error, the same approach is used in 
thd_mark_transaction_to_rollback().

@todo: call thd_mark_transaction_to_rollback() from 
handler::print_error(), then we can easily make sure
that the error reported by print_error is not ignored.
2009-10-28 17:49:56 +03:00
Tor Didriksen
dc2e363e57 Bug#48060 Memory leak - Item::val_bool() (item.cc:184) from optimizer_subquery grammar
Item_sum::set_aggregator() may be called multiple times during query preparation.
On subsequent calls: verify that the aggregator type is the same,
and re-use the existing Aggregator.
2009-10-28 11:07:30 +01:00
Alexander Nozdrin
800ba382d9 Fix automerge: s/hash_search/my_hash_search/. 2009-10-28 11:42:18 +03:00
Alexander Nozdrin
ac7ba1bcaa Merge from mysql-next-mr. 2009-10-28 10:55:44 +03:00
Alexander Nozdrin
48c15f0fb0 Automerge from mysql-next-mr. 2009-10-28 10:48:53 +03:00
Mikael Ronstrom
b572e51c30 BUG#48165, needed to introduce length restrictions on partitioning fields to ensure that no stack overruns occur 2009-10-28 01:11:17 +01:00
Mikael Ronstrom
59cc518990 Fixed sql_mode issue in BUG#48164, will ignore sql_mode when generating constants, also warnings will not be tolerated 2009-10-28 00:06:11 +01:00
Luis Soares
520795fa2a BUG#48297: Schema name is ignored when LOAD DATA is written into
binlog, replication aborts

In SBR or MBR, the schema name is not being written to the binlog
when executing a LOAD DATA statement. This becomes a problem when
the current database (lets call it db1) is different from the
table's schema (lets call it db2). For instance, take the
following statements:
  
  use db1;
  load data local infile 'infile.txt' into table db2.t

Should this statement be logged without t's schema (db2), when
replaying it, one can get db1.t populated instead of db2.t (if
db1.t exists). On the other hand, if there is no db1.t at all,
replication will stop.

We fix this by always logging the table (in load file) with fully
qualified name when its schema is different from the current
database or when no default database was selected.
2009-10-27 15:15:53 +00:00
Tatiana A. Nurnberg
5c7f01a0f0 auto-merge 2009-10-27 06:39:09 -07:00
Tatiana A. Nurnberg
2f069a2c9b Bug#46586: When using the plugin interface the type "set" for options caused a crash.
"What do you mean, there's a bug? There isn't even code!"

There was some token code for plug-in variables of the SET type,
but clearly this never worked, or was subject to massive bit rot
since. Bug-fixes ... fail-safes ... tests -- fais au mieux, mon chou!
2009-10-27 06:16:02 -07:00
Sergey Glukhov
fa63ac117c automerge 2009-10-27 15:04:59 +04:00
Sergey Glukhov
80b79baec0 automerge 2009-10-27 15:02:58 +04:00
Sergey Glukhov
1968895ed3 5.0-bugteam->5.1-bugteam merge 2009-10-27 14:09:36 +04:00
Alexander Nozdrin
c6aeab8cfe Automerge from mysql-next-mr. 2009-10-27 12:59:09 +03:00
Alexander Nozdrin
273a0a4f97 Automerge from mysql-next-mr. 2009-10-27 12:57:44 +03:00
Tatiana A. Nurnberg
842039a1fb auto-merge 2009-10-27 02:53:16 -07:00
Sergey Vojtovich
cf41b43b8e An addition to fix for
BUG#41597 - After rename of user, there are additional grants
            when grants are reapplied.

Fixed build failure on Windows. Added missing cast.
2009-10-27 12:37:57 +04:00
Sergey Glukhov
58b7761ed8 Bug#41049 does syntax "grant" case insensitive?
Problem 1:
column_priv_hash uses utf8_general_ci collation
for the key comparison. The key consists of user name,
db name and table name. Thus user with privileges on table t1
is able to perform the same operation on T1
(the similar situation with user name & db name, see acl_cache).
So collation which is used for column_priv_hash and acl_cache
should be case sensitive.
The fix:
replace system_charset_info with my_charset_utf8_bin for
column_priv_hash and acl_cache
Problem 2:
The same situation with proc_priv_hash, func_priv_hash,
the only difference is that Routine name is case insensitive.
So the fix is to use my_charset_utf8_bin for
proc_priv_hash & func_priv_hash and convert routine name into lower
case before writing the element into the hash and
before looking up the key.
Additional fix: mysql.procs_priv Routine_name field collation
is changed to utf8_general_ci.
It's necessary for REVOKE command
(to find a field by routine hash element values).
Note: 
It's safe for lower-case-table-names mode too because
db name & table name are converted into lower case
(see GRANT_NAME::GRANT_NAME).
2009-10-27 12:09:19 +04:00
Georgi Kodinov
9db41de042 automerge 2009-10-24 09:57:31 +03:00
Ramil Kalimullin
dd1719397e Auto-merge. 2009-10-23 23:37:57 +05:00
Jon Olav Hauglid
2397923da3 automerge 2009-10-23 16:35:06 +02:00
Georgi Kodinov
fd465c2b57 Revert the fix for bug #47627 as it's causing the regression tests in pb2 to
fail.
2009-10-23 16:54:58 +03:00
Jon Olav Hauglid
111da3a4c0 Bug #47919 assert in open_table during ALTER temporary table
This assertion would occur if UPDATE was used to update multiple
tables containing an AUTO_INCREMENT column and if the inserted
row had a user-supplied value for that column. The assertion 
could then be triggered by the next statement.

The problem was only noticeable on debug builds of the server.

The cause of the problem was that the code for multi update did
not properly reset the TABLE->auto_increment_if_null flag after update.
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 in this case by ALTER TABLE.

This patch fixes the problem by resetting the auto_increment_if_null
field to FALSE once a row has been updated.

This bug is similar to Bug#47274, but for multi update rather
than INSERT DELAYED.

Test case added to update.test.
2009-10-23 15:09:14 +02:00
Ramil Kalimullin
24885e815f Fix for bug#48258: Assertion failed when using a spatial index
Problem: involving a spatial index for "non-spatial" queries
(that don't containt MBRXXX() functions) may lead to failed assert.

Fix: don't use spatial indexes in such cases.
2009-10-23 16:26:48 +05:00
Alexander Nozdrin
069d78c067 Merge from mysql-next-mr. 2009-10-23 15:22:21 +04:00
Sergey Glukhov
1582fa0c3c automerge 2009-10-23 16:07:07 +05:00
Sergey Glukhov
dbe504ec7a Bug#35427 INFORMATION_SCHEMA.TABLES.TABLE_CATALOG is NULL, should be "def"
backport to betony
2009-10-23 16:02:20 +05:00
Sergey Glukhov
676c12e2d4 Bug#35428 When selecting from INFORMATION_SCHEMA tables, incomplete metadata
backport to Betony
2009-10-23 14:19:54 +05:00
Alexander Nozdrin
f740dff0c9 Backport of patch for Bug#46267.
Original revision:
------------------------------------------------------------
revno: 2801.10.16
committer: Vladislav Vaintroub <vvaintroub@mysql.com>
branch nick: mysql-azalea-bugfixing
timestamp: Mon 2009-08-10 13:26:23 +0200
message:
  Bug #46267 Shutdown with idle connection crash the server.
  
  The crash happens when mysqld logs a warning. The macro 
  ER() used in sql_print_warning references thread local storage
  variable via current_thd(), to output the warning in "current 
  user language". However, for the shutdown thread, 
  current_thd() will return NULL, and mysqld will crash while 
  derefencing NULL pointer.
  
  Solution: get error mesage text with ER_DEFAULT() macro 
  instead of ER(), this does not current_thd() and will output
  errors in default language.
------------------------------------------------------------
2009-10-23 11:45:03 +04:00
Mikael Ronstrom
7f446fc76b Upped size limit on varchar/char from 512 to 2048 2009-10-23 09:36:45 +02:00
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