Commit graph

39372 commits

Author SHA1 Message Date
Georgi Kodinov
8f36a23c00 Bug #39920: MySQL cannot deal with Leap Second expression in string literal.
Updated MySQL time handling code to react correctly on UTC leap second additions.
MySQL functions that return the OS current time, like e.g. CURDATE(), NOW() etc
will return :59:59 instead of :59:60 or 59:61.
As a result the reader will receive :59:59 for 2 or 3 consecutive seconds 
during the leap second.
This fix will not affect the values returned by UNIX_TIMESTAMP() for leap seconds.
But note that when converting the value returned by UNIX_TIMESTAMP() to broken 
down time the correction of leap seconds will still be applied.
Note that this fix will make a difference *only* if the OS is specially configured
to return leap seconds from the OS time calls or when using a MySQL time zone 
defintion that has leap seconds.
Even after this change date/time literals (or other broken down time 
representations) with leap seconds (ending on :59:60 or 59:61) will still be 
considered illegal and discarded by the server with an error or 
a warning depending on the sql mode.
Added a test case to demonstrate the effect of the fix.
2008-12-01 16:18:35 +02:00
Gleb Shchepa
b82094a0f8 Bug #40021: Renaming view fails, archived .frm for view is
missing after downgrade

Obsolete arc/ directory and view .frm file backup support
has been removed by the patch for bug 17823. However, that
bugfix caused a problem with "live downgrades" of the
server: if we rename some view 4 times under 5.1.29/5.0.72
and then try to rename it under 5.1.28/5.0.70 on the same
database, the server fails with a error:

  query 'RENAME TABLE ... TO ...' failed: 6: Error on
  delete of '....frm-0001' (Errcode: 2)

Also .frm file of that view may be lost (renamed to .frm~).

The server failed because it tried to rename latest 3
backup .frm files renaming the view: the server used an
integer value of the "revision" field of .frm file to
extract those file names. After the fix for bug 17823 those
files were not created/maintained any more, however the
"revision" field was incremented as usual. So, the server
failed renaming non existent files.

This fix solves the problem by removing the support for
"revision" .frm file field:
1. New server silently ignores existent "revision" fields
   in old .frm files and never write it down;
2. Old server assumes, that missing "revision" field in new
   .frm files means default value of 0.
3. Accordingly to the fix for bug 17823 the new server
   drops arc/ directory on alter/rename view, so after
   "live downgrade" old server begins maintenance of the
   arc/ directory from scratch without conflicts with .frm
   files.
2008-11-14 21:25:57 +04:00
Ramil Kalimullin
ee3594b2d7 Test case for bug #34774: key prefix on text field in federated
tables can cause server to crash!

The bug will be fixed by patch for #34779: "crash in checksum table
on federated tables with blobs containing nulls"

Only a test case commited.
2008-11-14 11:42:29 +04:00
Ramil Kalimullin
e0d5a6c15f Fix for bug#37527: mysqlcheck fails to report entire database
when InnoDB frm file corruption

Problem: mysqlcheck runs 'SHOW FULL TABLE' queries to get table lists.
The query may fail for some reasons (e.g. null .frm file) then
mysqlcheck doesn't process the database tables.

Fix: try to run 'SHOW TABLES' if 'SHOW FULL TABLES' failed.
2008-11-14 11:40:46 +04:00
Patrick Crews
f88fd3feb7 Bug#40645 Test main.federated_innodb does not always clean up after itself
Reordered include files so that no mess will be left if this test is run without InnoDB
Previously, this test would leave a database named 'federated' in such a case and would
cause tests that examined existing databases to fail.
2008-11-13 16:01:01 -05:00
Sergey Glukhov
90548bc697 Bug#39541 CHECK TABLE on information_schema myisam tables produces error
issue 'The storage engine for the table doesn't support check' note for I_S tables
2008-11-13 17:06:48 +04:00
Vladislav Vaintroub
d60da1c2a7 Bug#36279 - mysql built with Visual Studio 2005 does not display
japanese characters.

Fix - removed obsolvete setlocale from my_init.c . In MBCS 
environments it caused unwanted character-to-byte translations
in fputc()  in client code and wrong output as result.
2008-11-10 21:18:04 +01:00
Georgi Kodinov
94ac4f703b merged 5.0-main -> 5.0-bugteam 2008-11-06 20:57:47 +02:00
Joerg Bruehe
54a47dcb30 Merge current 5.0 main tree and fix for bug#40546 2008-11-06 17:42:04 +01:00
Joerg Bruehe
e7fe288054 Bug #40546 Debug server in RPM is built with compiler optimization
Prevent this by modifying CFLAGS and CXXFLAGS.
2008-11-06 16:24:58 +01:00
Georgi Kodinov
f29a569a31 merged 5.0-main -> 5.0-bugteam 2008-11-06 12:54:52 +02:00
Georgi Kodinov
ccef156af4 merged 5.0-bugteam -> bug 33811-5.0-bugteam working tree 2008-11-03 11:50:32 +02:00
Kristofer Pettersson
5ef41db4a3 Fixed race condition in test case status2. A 'disconnect' issues an
implicit command which isn't completed immediately.
2008-10-31 10:25:03 +01:00
Sergey Glukhov
f3a4a18640 Bug#39040 valgrind errors/crash when creating views with binlog logging enabled
A string buffers which were included in the 'view' data structure
were allocated on the stack, causing an invalid pointer when used
after the function returned.
The fix: use copy of values for view->md5 & view->queries
2008-10-27 14:22:38 +04:00
Serge Kozlov
c0db5ae4ea Bug#22442, removed number of port 2008-10-26 22:34:24 +03:00
Serge Kozlov
9740e4b571 Bug#22442.
1. Replace --sleep by wait_* primitive
2. Vertical output for SHOW SLAVE STATUS
3. Updated result file
2008-10-26 21:53:21 +03:00
joerg@mysql.com
51a960e3bb Raise version number after cloning 5.0.72 2008-10-24 11:37:40 +02:00
Sergey Petrunia
5fd9914910 Merge 2008-10-24 06:37:29 +04:00
Sergey Petrunia
5249c0493e BUG#38072: Wrong result: HAVING not observed in a query with aggregate
- Make send_row_on_empty_set() return FALSE when simplify_cond() has found out
  that HAVING is always FALSE
re-committing to put the fix into 5.0 and 5.1
2008-10-24 06:16:22 +04:00
Davi Arnaut
5b8c8a6cf3 Merge from mysql-5.0-5.1.29-rc into mysql-5.0-bugteam 2008-10-23 18:56:03 -02:00
Vladislav Vaintroub
a68f6a9cd7 merge 2008-10-23 22:05:47 +02:00
Georgi Kodinov
b6fbc38c13 merged 5.0 main -> 5.0-5.1.29-rc 2008-10-23 16:35:44 +03:00
Vladislav Vaintroub
f14edb91fb Bug#40280: Message compiler(mc.exe) needed to compile MySQL on windows.
Visual Studio 2008 Express edition does not include message compiler mc.exe
It is not possible to build MySQL server if only VC2008 Express is installed,
because we use mc.exe to generate event log messages.

This patch removes the mc.exe dependency. Generated files message.h, 
message.rc and MSG00001.bin  are checked into source code repository.
Instructions on how to add or change messages are added to messages.mc
2008-10-23 15:28:53 +02:00
Davi Arnaut
e139d9c775 Post-merge fix: drop table at the end of test. 2008-10-21 19:02:26 -02:00
Davi Arnaut
b0d673fc4d Bug#28323: Server crashed in xid cache operations
The problem was that the server did not robustly handle a
unilateral roll back issued by the Resource Manager (RM)
due to a resource deadlock within the transaction branch.
By not acknowledging the roll back, the server (TM) would
eventually corrupt the XA transaction state and crash.

The solution is to mark the transaction as rollback-only
if the RM indicates that it rolled back its branch of the
transaction.
2008-10-21 16:07:31 -02:00
Davi Arnaut
ca53651d40 Bug#28323: Server crashed in xid cache operations
The problem was that the server did not robustly handle a
unilateral roll back issued by the Resource Manager (RM)
due to a resource deadlock within the transaction branch.
By not acknowledging the roll back, the server (TM) would
eventually corrupt the XA transaction state and crash.

The solution is to mark the transaction as rollback-only
if the RM indicates that it rolled back its branch of the
transaction.
2008-10-21 15:45:43 -02:00
timothy.smith@sun.com
bc51b15d75 Merge from mysql-5.0.70-release 2008-10-21 17:21:23 +02:00
Georgi Kodinov
41f139bbc1 merge 5.0-bugteam -> bug 38693-5.0-bugteam 2008-10-20 16:26:07 +03:00
Kristofer Pettersson
1da6d9f171 Auto commit 2008-10-20 13:39:33 +02:00
Georgi Kodinov
a0e3001cdb Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN
fails after the first time
  
Two separate problems : 
  1. When flattening joins the linked list used for name resolution 
  (next_name_resolution_table) was not updated.
  Fixed by updating the pointers when extending the table list
  
  2. The items created by expanding a * (star) as a column reference
  were marked as fixed, but no cached table was assigned to them 
  (unlike what Item_field::fix_fields does).
  Fixed by assigning a cached table (so the re-preparation is done
  faster).
  
Note that the fix for #2 hides the fix for #1 in most cases
(except when a table reference cannot be cached).
2008-10-17 17:55:06 +03:00
Georgi Kodinov
3345b64f4e merged 5.0-bugteam -> bug 39958 2008-10-17 11:47:35 +03:00
Gleb Shchepa
c411a11e5c Bug #39844: Query Crash Mysql Server 5.0.67
Server crashed during a sort order optimization
of a dependent subquery:

SELECT
    (SELECT t1.a FROM t1, t2
      WHERE t1.a = t2.b AND t2.a = t3.c
      ORDER BY t1.a)
  FROM t3;


Bitmap of tables, that the reference to outer table
column uses, in addition to the regular table bit
has the OUTER_REF_TABLE_BIT bit set.
The only_eq_ref_tables function traverses this map
bit by bit simultaneously with join->map2table list.
Obviously join->map2table never contains an entry
for the OUTER_REF_TABLE_BIT pseudo-table, so the
server crashed there.


The only_eq_ref_tables function has been modified
to traverse regular table bits only like the
update_depend_map function (resetting of the
OUTER_REF_TABLE_BIT there is enough, but
resetting of the whole set of PSEUDO_TABLE_BITS
is used there for sure).
2008-10-16 21:37:17 +05:00
Georgi Kodinov
adfa153bcc Bug #39958: Test "windows" lacks a cleanup
Added the missing DROP TABLE
2008-10-16 14:16:27 +03:00
Davi Arnaut
4ab10baace Bug#37075: offset of limit clause might be truncated on 32-bits server w/o big tables
The problem is that the offset argument of the limit clause
might be truncated on a 32-bits server built without big
tables support. The truncation was happening because the
original 64-bits long argument was being cast to a 32-bits
(ha_rows) offset counter.

The solution is to check if the conversing resulted in value
truncation and if so, the offset is set to the maximum possible
value that can fit on the type.
2008-10-15 18:34:51 -03:00
Georgi Kodinov
b204dc43cc Bug #38693: leaked memory with blobs!
If delayed insert fails to upgrade the lock it was not
freeing the temporary memory storage used to keep
newly constructed blob values in memory.
Fixed by iterating over the remaining rows in the delayed
insert rowset and freeing the blob storage for each row.

No test suite because it involves concurrent delayed inserts 
on a table and cannot easily be made deterministic. 

Added a correct valgrind suppression for Fedora 9.
2008-10-15 16:55:52 +03:00
Kristofer Pettersson
2c576fa9d2 automerge 2008-10-15 12:06:44 +02:00
Davi Arnaut
d4c75b7d0f Bug#38823: Invalid memory access when a SP statement does wildcard expansion
The problem is that field names constructed due to wild-card
expansion done inside a stored procedure could point to freed
memory if the expansion was performed after the first call to
the stored procedure.

The problem was solved by patch for Bug#38691. The solution
was to allocate the database, table and field names in the
in the statement memory instead of table memory.
2008-10-14 11:04:36 -03:00
Kent Boortz
36e4c7d281 The header "config.h" needs to be included "early" to control other headers.
This time the inclusion of <stdio.h> before "config.h" enabled legacy large
file support, seek64() and similar, on AIX breaking the compile of "gzio.c"
2008-10-13 14:23:39 +02:00
Joerg Bruehe
194d6875c6 Merge from main 5.0 branch -> 5.0-build
Merge conflicts in test "create:
- for "create.result", handled correctly by "bzr extmerge" (using "kdiff3"),
- for "create.test", not reported as a conflict, but merged wrong
  (new block at the test end got duplicated), fixed manually.

Test on Linux (Debian, PowerPC) was ok.
2008-10-10 19:20:42 +02:00
Georgi Kodinov
702ae189a3 merged 5.0-main -> 5.0-bugteam 2008-10-10 17:27:16 +03:00
Gleb Shchepa
27f4c34beb Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Select with a "NULL NOT IN" condition containing complex
subselect from the same table as in the outer select failed
with an assertion.


The failure was caused by a concatenation of circumstances:
1) an inner select was optimized by make_join_statistics to use
   the QUICK_RANGE_SELECT access method (that implies an index
   scan of the table);
2) a subselect was independent (constant) from the outer select;
3) a condition was pushed down into inner select.

During the evaluation of a constant IN expression an optimizer
temporary changed the access method from index scan to table
scan, but an engine handler was already initialized for index
access by make_join_statistics. That caused an assertion.


Unnecessary index initialization has been removed from
the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
reinvokes this initialization).
2008-10-10 15:27:58 +05:00
Gleb Shchepa
e7520c4b7e Bug #39283: Date returned as VARBINARY to client for queries
with COALESCE and JOIN

The server returned to a client the VARBINARY column type
instead of the DATE type for a result of the COALESCE,
IFNULL, IF, CASE, GREATEST or LEAST functions if that result
was filesorted in an anonymous temporary table during
the query execution.

For example:
  SELECT COALESCE(t1.date1, t2.date2) AS result
    FROM t1 JOIN t2 ON t1.id = t2.id ORDER BY result;


To create a column of various date/time types in a
temporary table the create_tmp_field_from_item() function
uses the Item::tmp_table_field_from_field_type() method
call. However, fields of the MYSQL_TYPE_NEWDATE type were
missed there, and the VARBINARY columns were created
by default.
Necessary condition has been added.
2008-10-10 15:13:12 +05:00
Gleb Shchepa
0b38c93d6e Bug#38499: flush tables and multitable table update with
derived table cause crash

When a multi-UPDATE command fails to lock some table, and
subsequently succeeds, the tables need to be reopened if
they were altered. But the reopening procedure failed for
derived tables.

Extra cleanup has been added.
2008-10-09 20:24:31 +05:00
Kristofer Pettersson
218c4e15fc Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
When running Stored Routines the Status Variable "Questions" was wrongly
incremented. According to the manual it should contain the "number of
statements that clients have sent to the server"
              
Introduced a new status variable 'questions' to replace the query_id
variable which currently corresponds badly with the number of statements
sent by the client.
            
The new behavior is ment to be backward compatible with 4.0 and at the
same time work with new features in a similar way.
            
This is a backport from 6.0
2008-10-09 09:26:42 +02:00
Georgi Kodinov
453bc6c1aa merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-08 11:36:24 +03:00
Gleb Shchepa
e219979e7d Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
``FLUSH TABLES WITH READ LOCK''

Concurrent execution of 1) multitable update with a
NATURAL/USING join and 2) a such query as "FLUSH TABLES
WITH READ LOCK" or "ALTER TABLE" of updating table led
to a server crash.


The mysql_multi_update_prepare() function call is optimized
to lock updating tables only, so it postpones locking to
the last, and if locking fails, it does cleanup of modified
syntax structures and repeats a query analysis.  However,
that cleanup procedure was incomplete for NATURAL/USING join
syntax data: 1) some Field_item items pointed into freed
table structures, and 2) the TABLE_LIST::join_columns fields
was not reset.

Major change:
  short-living Field *Natural_join_column::table_field has
  been replaced with long-living Item*.
2008-10-08 02:34:00 +05:00
Georgi Kodinov
c3d3f3ecf4 merged 5.0-5.1.29-rc -> 5.0-bugteam 2008-10-07 18:24:25 +03:00
Chad MILLER
5cee4d7cf6 Fix autoconf substitution and evaluation of a string inside single quotes
so that if the substitution contains single-quotes, the program will fail.
2008-10-06 11:35:21 -04:00
Chad MILLER
7e59ecb110 Merge fix for bug 11122. 2008-10-06 09:52:27 -04:00
Chad MILLER
0859e33c97 Remove part of comment for b-g#11122 that is no longer true. 2008-10-06 09:49:50 -04:00