Commit graph

718 commits

Author SHA1 Message Date
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
10dda8e248 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into  mysql.com:/home/ram/work/b19690/b19690.4.1
2007-01-31 14:47:06 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
eb415e4920 fix for bug #19690: ORDER BY eliminates rows from the result
Depending on the queries we use different data processing methods
and can lose some data in case of double (and decimal in 4.1) fields.

The fix consists of two parts:
1. double comparison changed, now double a is equal to double b 
if (a-b) is less than 5*0.1^(1 + max(a->decimals, b->decimals)). 
For example, if a->decimals==1, b->decimals==2, a==b if (a-b)<0.005
2. if we use a temporary table, store double values there as is 
to avoid any data conversion (rounding).
2007-01-31 09:51:05 +04:00
msvensson@pilot.mysql.com
5c717b080f Merge pilot.mysql.com:/home/msvensson/mysql/bug22943/my41-bug22943
into  pilot.mysql.com:/home/msvensson/mysql/mysql-4.1-maint
2007-01-29 16:19:59 +01:00
msvensson@pilot.mysql.com
7eaa82ea38 Bug#22943 syscall pruning in libmysql
- Set the timeout values only where needed
2007-01-29 14:31:48 +01:00
lars/lthalmann@mysql.com/dl145j.mysql.com
bbaf32754f Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-4.1-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-4.1-merge
2007-01-17 19:28:55 +01:00
kostja@bodhi.local
d53072d190 Merge bk-internal.mysql.com:/home/bk/mysql-4.1-runtime
into  bodhi.local:/opt/local/work/mysql-4.1-4968-to-push
2007-01-15 13:03:21 +03:00
gluh@mysql.com/eagle.(none)
b61f3545f5 Fix for bug#20867 InnoDB Bug - create temporary table+crash => mysqld needs to clean up
2nd version
During tmp tables cleanup we get the handler for temporary table
and delete table using handler method.
2007-01-10 12:57:03 +04:00
kostja@bodhi.local
90072e69b3 A fix and test cases for
Bug#4968 "Stored procedure crash if cursor opened on altered table"
Bug#19733 "Repeated alter, or repeated create/drop, fails"
Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
stored procedure."
Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"

Test cases for bugs 4968, 19733, 6895 will be added in 5.0.

Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
statements in stored routines or as prepared statements caused
incorrect results (and crashes in versions prior to 5.0.25).
In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).

The problem of bugs 4968, 19733, 19282 and 6895 was that functions
mysql_prepare_table, mysql_create_table and mysql_alter_table were not
re-execution friendly: during their operation they used to modify contents
of LEX (members create_info, alter_info, key_list, create_list),
thus making the LEX unusable for the next execution.
In particular, these functions removed processed columns and keys from
create_list, key_list and drop_list. Search the code in sql_table.cc 
for drop_it.remove() and similar patterns to find evidence.

The fix is to supply to these functions a usable copy of each of the
above structures at every re-execution of an SQL statement. 

To simplify memory management, LEX::key_list and LEX::create_list
were added to LEX::alter_info, a fresh copy of which is created for
every execution.

The problem of crashing bug 22060 stemmed from the fact that the above 
metnioned functions were not only modifying HA_CREATE_INFO structure in 
LEX, but also were changing it to point to areas in volatile memory of 
the execution memory root.
 
The patch solves this problem by creating and using an on-stack
copy of HA_CREATE_INFO (note that code in 5.1 already creates and
uses a copy of this structure in mysql_create_table()/alter_table(),
but this approach didn't work well for CREATE TABLE SELECT statement).
2006-12-08 02:20:09 +03:00
bar@mysql.com/bar.intranet.mysql.r18.ru
224660d14a Bug#22645 LC_TIME_NAMES: Statement not replicated
Problem: replication of LC_TIME_NAMES didn't work.
Thus, INSERTS or UPDATES using date_format() always
worked with en_US on the slave side.
Fix: adding ONE_SHOT implementation for LC_TIME_NAMES.
2006-12-05 13:45:21 +04:00
petr/cps@outpost.site
8de747b0c7 Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-4.1-runtime
into  outpost.site:/home/cps/mysql/trees/4.1-runtime-bug9191
2006-11-06 00:05:02 +03:00
kostja@bodhi.local
6a28c436f7 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  bodhi.local:/opt/local/work/mysql-4.1-runtime
2006-11-02 01:08:39 +03:00
petr/cps@mysql.com/owlet.local
3ec542dfbd Fix Bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1"
(4.1 version, with post-review fixes)
  
  The fix for another Bug (6439) limited FROM_UNIXTIME() to
  TIMESTAMP_MAX_VALUE which is 2145916799 or 2037-12-01 23:59:59 GMT,
  however unix timestamp in general is not considered to be limited 
  by this value. All dates up to power(2,31)-1 are valid.
  
  This patch extends allowed TIMESTAMP range so, that max
  TIMESTAMP value is power(2,31)-1. It also corrects
  FROM_UNIXTIME() and UNIX_TIMESTAMP() functions, so that
  max allowed UNIX_TIMESTAMP() is power(2,31)-1. FROM_UNIXTIME()
  is fixed accordingly to allow conversion of dates up to
  2038-01-19 03:14:07 UTC. The patch also fixes CONVERT_TZ()
  function to allow extended range of dates.
  
  The main problem solved in the patch is possible overflows
  of variables, used in broken-time representation to time_t
  conversion (required for UNIX_TIMESTAMP).
2006-11-01 16:47:40 +03:00
kroki/tomash@moonlight.intranet
1bfe00e0da BUG#21915: Changing limits of table_cache when setting max_connections
If the user has specified --max-connections=N or --table-open-cache=M
options to the server, a warning could be given that some values were
recalculated, and table-open-cache could be assigned greater value.

Note that both warning and increase of table-open-cache were totally
harmless.

This patch fixes recalculation code to ensure that table-open-cache will
be never increased automatically and that a warning will be given only if
some values had to be decreased due to operating system limits.

No test case is provided because we neither can't predict nor control
operating system limits for maximal number of open files.
2006-10-30 17:47:02 +03:00
jimw@rama.(none)
caf4392f71 Merge bk-internal:/home/bk/mysql-4.1-maint
into  rama.(none):/home/jimw/my/mysql-4.1-clean
2006-09-28 18:11:29 -07:00
gkodinov/kgeorge@macbook.gmz
3758b975f8 Bug #21392: multi-table delete with alias table name fails with
1003: Incorrect table name
in multi-table DELETE the set of tables to delete from actually 
references then tables in the other list, e.g:
DELETE alias_of_t1 FROM t1 alias_of_t1 WHERE ....
is a valid statement.
So we must turn off table name syntactical validity check for alias_of_t1 
because it's not a table name (even if it looks like one).
In order to do that we add a special flag (TL_OPTION_ALIAS) to 
disable the name checking for the aliases in multi-table DELETE.
2006-09-04 18:40:30 +03:00
jimw@rama.(none)
cb6a084076 Bug #2717: include/my_global.h mis-defines __attribute__
Fix when __attribute__() is stubbed out, add ATTRIBUTE_FORMAT() for specifying
  __attribute__((format(...))) safely, make more use of the format attribute,
  and fix some of the warnings that this turns up (plus a bonus unrelated one).
2006-08-17 12:25:40 -07:00
evgen@moonbone.local
40a1fbdffb Merge moonbone.local:/work/tmp_merge-4.1
into  moonbone.local:/work/tmp_merge-4.1-opt-mysql
2006-08-02 16:10:52 +04:00
sergefp@mysql.com
bffd438de3 BUG#20975: Incorrect query result for NOT (subquery):
Add implementations of Item_func_{nop,not}_all::neg_transformer
2006-07-21 03:04:04 +04:00
ramil/ram@mysql.com/myoffice.izhnet.ru
b57efe738a --{skip-}merge option added which allows the user to disable merge engine and
to avoid the potential security problem.
(see bug #15195: Security Breach with MERGE table)
2006-07-14 16:26:58 +05:00
bar@mysql.com
3855520138 WL#2928 Date Translation NRE
(implemented by by Josh Chamas)
2006-07-04 17:40:40 +05:00
aelkin@mysql.com
a0b4c8ed12 Merge mysql.com:/net/nb/home/elkin/MySQL/FIXES/4.1-bug19188_tmp_name
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/4.1
2006-05-12 21:38:41 +03:00
aelkin@mysql.com
9b16a7b91a BUG#19188: incorrect temporary table name of DROP query in replication
A pattern to generate binlog for DROPped temp table in close_temporary_tables
  was buggy: could not deal with a grave-accent-in-name table.

  The fix exploits `append_identifier()' for quoting and duplicating accents.
2006-05-12 21:29:06 +03:00
aelkin@mysql.com
226d978ae8 BUG#14157: utf8 encoding in binlog without set character_set_client e.g DROP temporary
Binlog lacks encoding info about DROPped temporary table.

Idea of the fix is to switch temporary to system_charset_info when a temporary table
is DROPped for binlog. Since that is the server, that automatically, but not the client, who generates the query
the binlog should be updated on the server's encoding for the coming DROP.
The `write_binlog_with_system_charset()' is introduced to replace similar problematic places in the code.
2006-05-09 23:01:31 +03:00
konstantin@mysql.com
a81ea4a830 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/opt/local/work/mysql-4.1-16365
2006-04-07 23:50:45 +04:00
konstantin@mysql.com
518993312c A fix and a test case for Bug#16365 "Prepared Statements: DoS with
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume 
100MB of RAM. Once this limit has been reached, the server will 
refuse to prepare a new statement and return ER_UNKNOWN_ERROR 
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared 
statements is now available through a global read-only variable 
@@prepared_stmt_count.
2006-04-07 23:37:06 +04:00
evgen@moonbone.local
1c13e54890 Fixed bug#15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries
The GROUP_CONCAT uses its own temporary table. When ROLLUP is present
it creates the second copy of Item_func_group_concat. This copy receives the
same list of arguments that original group_concat does. When the copy is
set up the result_fields of functions from the argument list are reset to the
temporary table of this copy.
As a result of this action data from functions flow directly to the ROLLUP copy
and the original group_concat functions shows wrong result.
Since queries with COUNT(DISTINCT ...) use temporary tables to store
the results the COUNT function they are also affected by this bug.

The idea of the fix is to copy content of the result_field for the function
under GROUP_CONCAT/COUNT from  the first temporary table to the second one,
rather than setting result_field to point to the second temporary table.
To achieve this goal force_copy_fields flag is added to Item_func_group_concat
and Item_sum_count_distinct classes. This flag is initialized to 0 and set to 1
into the make_unique() member function of both classes.
To the TMP_TABLE_PARAM structure is modified to include the similar flag as
well.
The create_tmp_table() function passes that flag to create_tmp_field().
When the flag is set the create_tmp_field() function will set result_field
as a source field and will not reset that result field to newly created 
field for Item_func_result_field and its descendants. Due to this there
will be created copy func to copy data from old result_field to newly 
created field.
2006-03-29 23:30:34 +04:00
ingo@mysql.com
5aa315e23a BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
INSERT ... SELECT with the same table on both sides (hidden
below a MERGE table) does now work by buffering the select result.
The duplicate detection works now after open_and_lock_tables() 
on the locks.
I did not find a test case that failed without the change in
sql_update.cc. I made the change anyway as it should in theory
fix a possible MERGE table problem with multi-table update.
2005-12-07 19:52:26 +01:00
konstantin@mysql.com
f57dffe453 A fix and a test case for Bug#14410 "Crash in Enum or Set type in
CREATE TABLE and PS/SP": make sure that 'typelib' object for
ENUM values and 'Item_string' object for DEFAULT clause are 
created in the statement memory root.
2005-11-25 13:25:31 +03:00
ingo@mysql.com
6bc4636b64 Merge mysql.com:/home/mydev/mysql-4.0-4000
into  mysql.com:/home/mydev/mysql-4.1-4100
2005-11-15 18:09:40 +01:00
ingo@mysql.com
1b99d30c23 Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Version for 4.0.
It fixes two problems:
1. The cause of the bug was that we did not check the table version for
   the HANDLER ... READ commands. We did not notice when a table was
   replaced by a new one. This can happen during ALTER TABLE, REPAIR
   TABLE, and OPTIMIZE TABLE (there might be more cases). I call the fix
   for this problem "the primary bug fix".
2. mysql_ha_flush() was not always called with a locked LOCK_open.
   Though the function comment clearly said it must.
   I changed the code so that the locking is done when required. I call
   the fix for this problem "the secondary fix".
2005-11-03 18:24:12 +01:00
sergefp@mysql.com
e9f2f9437a BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete
when there is no WHERE clause.
2005-09-30 15:21:37 +04:00
sasha@asksasha.com
00eae49b5c fix for BUG#11139 (multi-delete with alias breaking replication if table rules are
present): the problem originally was that the tables in auxilliary_tables did not have 
the correct real_name, which caused problems in the second call to tables_ok(). 
The fix corrects the real_name problem, and also sets the updating flag properly, 
which makes the second call to tables_ok() unnecessary.
2005-09-14 06:31:38 -06:00
bell@sanja.is.com.ua
1bff548cb3 Merge sanja.is.com.ua:/home/bell/mysql/bk/work-4.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
2005-09-06 12:18:23 +03:00
bell@sanja.is.com.ua
10c0ef69e7 support of concurent query cache resizing (BUG#12848) 2005-09-06 11:16:53 +03:00
bar@mysql.com
0eafb9572a mysqld.cc, mysql_priv.h, sql_parse.cc:
bug#9948
  changed client-charset behavior in 4.1.x libmysql, which issue BC prob
  after review fixes
2005-09-05 20:00:11 +05:00
sergefp@mysql.com
5e9545d4c4 BUG#11869 (cont'd, eliminating "table type doesn't support FULLTEXT" error):
When creating temporary table for UNION, pass TMP_TABLE_FORCE_MYISAM flag to 
create_tmp_table if we will be using fulltext function(s) when reading from the 
temp. table.
2005-08-06 21:08:28 +00:00
hf@deer.(none)
39ef54fd8e Fix for bug #12177 (errorlog file isn't closed)
4.1 version of the patch
2005-08-04 15:23:21 +05:00
monty@mysql.com
24d45c5c30 Merge mysql.com:/home/my/mysql-4.0
into  mysql.com:/home/my/mysql-4.1
2005-07-27 13:24:59 +03:00
monty@mysql.com
e59360ac86 Review of new code:
Change argument order to be database, tablename for some functions
2005-07-27 13:05:30 +03:00
monty@mysql.com
4098c40d87 Review fixes:
Fixed portability problem with bool in C programs
Moved close_thread_tables out from LOCK_thread_count mutex (safety fix)
my_sleep() -> pthread_cond_timedwait()
2005-07-26 17:55:58 +03:00
jimw@mysql.com
6eae678f56 Fix error message generated when trying to create a table in a
non-existent database. (Bug #10407)
2005-07-21 20:08:54 -07:00
pappa@c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se
9663b9a974 Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.0
into  c-450ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-4.1
2005-07-20 21:58:33 -04:00
mronstrom@mysql.com
4cb963439a Bug #10600 After review fixes 2005-07-20 21:19:01 +02:00
monty@mishka.local
7e83d09ce7 Simple fixes during review of new code 2005-07-19 19:25:05 +03:00
mronstrom@mysql.com
2d23c691f7 Bug #10600
remove_table_from_cache fails to signal other thread and gets
blocked when other thread also gets blocked
2005-07-19 00:29:19 +02:00
konstantin@mysql.com
e08caeeee2 A fix and a test case for Bug#9359 "Prepared statements take snapshot
of system vars at PREPARE time": implement a special Item
to handle system variables. This item substitutes itself with 
a basic constant containing variable value at fix_fields.
2005-07-16 03:29:13 +04:00
konstantin@mysql.com
374b9182af Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/opt/local/work/mysql-4.1-11458
2005-07-13 17:39:48 +04:00
konstantin@mysql.com
bef558b7ee - a fix for Bug#11458 "Prepared statement with subselects return random
data": remove the fix for another bug (8807) that
added OUTER_REF_TABLE_BIT to all subqueries that used a placeholder
to prevent their evaluation at prepare. As this bit hanged in 
Item_subselect::used_tables_cache for ever, a constant subquery with
a placeholder was never evaluated as such, which caused wrong 
choice of the execution plan for the statement.
- to fix Bug#8807 backport a better fix from 5.0
- post-review fixes.
2005-07-13 17:38:55 +04:00
jimw@mysql.com
de9909faec Fix crash caused by calling DES_ENCRYPT() without the --des-key-file
option having been passed to the server. (Bug #11643)
2005-07-07 11:49:44 -07:00
monty@mishka.local
83f90e060e Better bug fix for:
#9728  'Decreased functionality in "on duplicate key update
#8147  'a column proclaimed ambigous in INSERT ... SELECT .. ON DUPLICATE'

This ensures fields are uniquely qualified and also that one can't update other tables in the ON DUPLICATE KEY UPDATE part
2005-06-27 16:46:41 +03:00