Commit graph

489 commits

Author SHA1 Message Date
igor@olga.mysql.com
f6d6ac1e0f Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into  olga.mysql.com:/home/igor/mysql-5.0-opt
2006-07-06 13:40:08 -07:00
igor@olga.mysql.com
0e3d2dafd6 Fixed bug #18243.
The implementation of the method Item_func_reverse::val_str
for the REVERSE function modified the argument of the function.
This led to wrong results for expressions that contained
REVERSE(ref) if ref occurred somewhere else in the expressions.
2006-07-06 11:11:49 -07:00
konstantin@mysql.com
4d25d2154c Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/opt/local/work/mysql-5.0-17199
2006-06-27 00:52:56 +04:00
konstantin@mysql.com
117b76a562 A fix and a test case for
Bug#19022 "Memory bug when switching db during trigger execution"
 Bug#17199 "Problem when view calls function from another database."
 Bug#18444 "Fully qualified stored function names don't work correctly in
            SELECT statements"

 Documentation note: this patch introduces a change in behaviour of prepared
 statements.

 This patch adds a few new invariants with regard to how THD::db should
 be used. These invariants should be preserved in future:

  - one should never refer to THD::db by pointer and always make a deep copy
    (strmake, strdup)
  - one should never compare two databases by pointer, but use strncmp or
    my_strncasecmp
  - TABLE_LIST object table->db should be always initialized in the parser or
    by creator of the object.

    For prepared statements it means that if the current database is changed
    after a statement is prepared, the database that was current at prepare
    remains active. This also means that you can not prepare a statement that
    implicitly refers to the current database if the latter is not set.
    This is not documented, and therefore needs documentation. This is NOT a
    change in behavior for almost all SQL statements except:
     - ALTER TABLE t1 RENAME t2 
     - OPTIMIZE TABLE t1
     - ANALYZE TABLE t1
     - TRUNCATE TABLE t1 --
     until this patch t1 or t2 could be evaluated at the first execution of
     prepared statement. 

     CURRENT_DATABASE() still works OK and is evaluated at every execution
     of prepared statement.

     Note, that in stored routines this is not an issue as the default
     database is the database of the stored procedure and "use" statement
     is prohibited in stored routines.

  This patch makes obsolete the use of check_db_used (it was never used in the
  old code too) and all other places that check for table->db and assign it
  from THD::db if it's NULL, except the parser.

 How this patch was created: THD::{db,db_length} were replaced with a
 LEX_STRING, THD::db. All the places that refer to THD::{db,db_length} were
 manually checked and:
  - if the place uses thd->db by pointer, it was fixed to make a deep copy
  - if a place compared two db pointers, it was fixed to compare them by value
    (via strcmp/my_strcasecmp, whatever was approproate)
 Then this intermediate patch was used to write a smaller patch that does the
 same thing but without a rename.

 TODO in 5.1:
   - remove check_db_used
   - deploy THD::set_db in mysql_change_db

 See also comments to individual files.
2006-06-27 00:47:52 +04:00
evgen@moonbone.local
592e080643 Merge moonbone.local:/home/evgen/bk-trees/mysql-4.1-opt
into moonbone.local:/work/tmp_merge-5.0-opt-mysql
2006-06-17 01:57:25 +04:00
evgen@moonbone.local
b8b9738e0b item_strfunc.cc:
Fix for bug#16716 for --ps-protocol mode.
item_cmpfunc.cc:
  Fix for a memory allocation/freeing problem in agg_cmp_type() after fix
for bug#16377. Few language corrections.
2006-06-16 23:46:37 +04:00
evgen@moonbone.local
b669852866 Merge moonbone.local:/work/15351-bug-4.1-mysql
into moonbone.local:/home/evgen/bk-trees/mysql-4.1-opt
2006-06-15 14:57:53 +04:00
evgen@moonbone.local
e35a0ca4b7 Manually merged 2006-06-14 23:54:08 +04:00
evgen@moonbone.local
d027dd7c0d Fixed bug#15962: CONCAT() in UNION may lead to a data trucation.
To calculate its max_length the CONCAT() function is simply sums max_lengths
of its arguments but when the collation of an argument differs from the 
collation of the CONCAT() max_length will be wrong. This may lead to a data
truncation when a tmp table is used, in UNIONS for example.

The Item_func_concat::fix_length_and_dec() function now recalculates the 
max_length of an argument when the mbmaxlen of the argument differs from the
mbmaxlen of the CONCAT().
2006-06-07 01:10:23 +04:00
evgen@moonbone.local
766b4a8c7f Fixed bug#15351: Wrong collation used for comparison of md5() and sha()
argument can lead to a wrong result.

md5() and sha() functions treat their arguments as case sensitive strings.
But when they are compared their arguments were compared as a case
insensitive strings which leads to two functions with different arguments
and thus different results to being identical. This can lead to a wrong
decision made in the range optimizer and thus lead to a wrong result set.

Item_func_md5::fix_length_and_dec() and Item_func_sha::fix_length_and_dec()
functions now set binary collation on their arguments.
2006-05-28 22:01:38 +04:00
evgen@moonbone.local
40ea30253f Fixed bug#16716: subselect in concat() may lead to a wrong result.
The Item_func_concat::val_str() function tries to make as less re-allocations
as possible. This results in appending strings returned by 2nd and next
arguments to the string returned by 1st argument if the buffer for the first
argument has enough free space. A constant subselect is evaluated only once 
and its result is stored in an Item_cache_str. In the case when the first
argument of the concat() function is such a subselect Item_cache_str returns
the stored value and Item_func_concat::val_str() append values of other
arguments to it. But for the next row the value in the Item_cache_str isn't
restored because the subselect is a constant one and it isn't evaluated second
time. This results in appending string values of 2nd and next arguments to the 
result of the previous Item_func_concat::val_str() call.

The Item_func_concat::val_str() function now checks whether the first argument 
is a constant one and if so it doesn't append values of 2nd and next arguments
to the string value returned by it.
2006-05-26 01:24:14 +04:00
tnurnberg@mysql.com
ab69fac55d Merge mysql.com:/home/mysql-4.1-10418
into  mysql.com:/home/mysql-5.0-10418
2006-05-12 10:27:20 +02:00
tnurnberg@mysql.com
21f4e8aadb Bug#10418: LOAD_FILE does not behave like in manual if file does not exist
load_file() string-function should return NULL rather than throw an error if
the file doesn't exist, as per the manual.
2006-05-08 04:37:58 +02:00
aelkin@mysql.com
c5219d0d67 Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.0
2006-04-23 12:32:39 +03:00
ramil@mysql.com
2398882097 Fix for bug #18643: crazy UNCOMPRESS(). 2006-04-13 16:19:21 +05:00
jimw@mysql.com
80aafdd398 Bug #17043: Casting trimmed string to decimal loses precision
Results of string functions were being converted to decimals by first
  being converted to integers, resulting in a loss of precision.
2006-03-14 02:04:43 -08:00
jimw@mysql.com
38aafce1ef Merge mysql.com:/home/jimw/my/mysql-5.0-14676
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2006-02-17 08:32:50 -08:00
konstantin@mysql.com
4d272aba67 Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/opt/local/work/mysql-5.0-root
2006-01-11 17:49:56 +03:00
konstantin@mysql.com
9105d06dd6 A fix for Bug#13944 "libmysqlclient exporting sha1_result function":
rename sha1_* to mysql_sha1_*
2006-01-11 17:31:52 +03:00
igor@rurik.mysql.com
09e6597015 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-12-02 20:42:36 -08:00
bar@mysql.com
0f73558ee3 Merge mysql.com:/usr/home/bar/mysql-4.1.b10446
into  mysql.com:/usr/home/bar/mysql-5.0
2005-11-29 09:25:51 +04:00
bar@mysql.com
e6708aa0df Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/usr/home/bar/mysql-5.0.b14146
2005-11-25 10:08:00 +04:00
jimw@mysql.com
69cf72710d Fix possible corruption of results from SUBSTRING_INDEX(). (Bug #14676) 2005-11-23 16:49:07 -08:00
igor@rurik.mysql.com
7b1b69a6e7 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-22 23:00:57 -08:00
bar@mysql.com
2f72e05903 Bug#10446 Illegal mix of collations:
item_strfunc.h, item_strfunc.cc, item.cc:
  Try to convert a const item into destination 
  character set. If conversion happens without
  data loss, then cache the converted value
  and return it during val_str().
  Otherwise, if conversion loses data, return
  Illeral mix of collations error, as it happened
  previously.
ctype_recoding.result, ctype_recoding.test:
  Fixing tests accordingly.
2005-11-21 17:26:31 +04:00
bell@sanja.is.com.ua
806f9e24ff Inefficient usage of String::append() fixed.
Bad examples of usage of a string with its length fixed.
The incorrect length in the trigger file configuration descriptor
  fixed (BUG#14090).
A hook for unknown keys added to the parser to support old .TRG files.
2005-11-20 20:47:07 +02:00
bar@mysql.com
1946d68f99 Bug#14146 CHAR(...USING ...) and CONVERT(CHAR(...) USING...) produce different results
ctype_utf8.result, ctype_utf8.test:
  Adding test case.
item_strfunc.cc:
item_strfunc.h:
  Moving the well formed checking code into a method,
  to reuse in several Item_func_xxx. Reusing the new
  method in Item_func_char and Item_func_charset_conv.
2005-11-07 12:34:19 +04:00
igor@rurik.mysql.com
c136e9c43b Fixed bug #12762:
allowed set functions aggregated in outer subqueries, allowed nested set functions.
2005-10-15 14:32:37 -07:00
kent@mysql.com
5b448a8d9f Merge mysql.com:/Users/kent/mysql/bk/mysql-4.1-tmp
into mysql.com:/Users/kent/mysql/bk/mysql-5.0
2005-10-13 12:09:39 +02:00
monty@mysql.com
f5fdf3e87a Reviewing new pushed code
- CHAR() now returns binary string as default
- CHAR(X*65536+Y*256+Z) is now equal to CHAR(X,Y,Z) independent of the character set for CHAR()
- Test for both ETIMEDOUT and ETIME from pthread_cond_timedwait()
  (Some old systems returns ETIME and it's safer to test for both values
   than to try to write a wrapper for each old system)
- Fixed new introduced bug in NOT BETWEEN X and X
- Ensure we call commit_by_xid or rollback_by_xid for all engines, even if one engine has failed
- Use octet2hex() for all conversion of string to hex
- Simplify and optimize code
2005-10-12 00:58:22 +03:00
jimw@mysql.com
77fbc72f47 Handle errors returned by system crypt() in ENCRYPT(). (Bug #13619) 2005-10-06 16:15:53 -07:00
jimw@mysql.com
3cd331c29f Merge mysql.com:/home/jimw/my/mysql-5.0-13361
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-09-23 10:03:29 -07:00
dlenev@mysql.com
87dcb3c6f5 Fix for bug #13407 "Remote connecting crashes server" and couple of similar
problems which were introduced during work on WL#2787 "Add view definer/owner
to the view definition (.frm) to check privileges on used tables and stored
routines when using a VIEW."

In some cases it is better to use value from Security_context::host_or_ip
instead of value from Security_context::host since the latter can be NULL
in certain situations (When we can't resolve hostname or we have not done
this yet).
2005-09-22 23:03:53 +04:00
jimw@mysql.com
90d6195f04 Fix handling of NULL values in decimal fields in FORMAT(). (Bug #13361) 2005-09-22 11:40:22 -07:00
bell@sanja.is.com.ua
3f66053a50 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-owner5-5.0
2005-09-20 21:27:28 +03:00
bell@sanja.is.com.ua
c1b185f5ff WL#2787 (Add view definer/owner to the view definition (.frm) to check privileges on used tables and stored routines when using a VIEW.)
Part 2 postreview fixes.
2005-09-20 21:20:38 +03:00
bar@mysql.com
1d12ac8849 Bug#10504
Character set does not support traditional mode
ctype_utf8.result, ctype_utf8.test:
  adding test case.
password.c, mysql_com.h
  Changeing octet2hex availability from static to public.
item_strfunc.cc:
  Result string is now checked to be well-formed.
  Warning/error is generated, depending on sql_mode.
2005-09-16 10:24:37 +05:00
bell@sanja.is.com.ua
aec371f910 WL#2787 (part 2, ver 3 (merged)) changed securety context switching 2005-09-15 22:29:07 +03:00
jimw@mysql.com
1d997477aa Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-08-31 15:24:06 -07:00
jimw@mysql.com
663d0bbdfb Fix crash in DES_DECRYPT(NULL). (Bug #12757) 2005-08-25 12:34:42 -07:00
sergefp@mysql.com
c085c9a3b7 Undo the test cset that shouldn't have been pushed (ChangeSet@1.1988, 2005-08-16 00:03:50+04:00, aivanov@mysql.com
)
2005-08-18 18:26:30 +04:00
aivanov@mysql.com
405f03f389 Merge aivanov@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/alexi/mysql-5.0
2005-08-16 00:03:50 +04:00
bar@mysql.com
4a071b4833 item_strfunc.cc:
After merge change.
  4.1 method was replaced in 5.0.
2005-08-12 18:13:42 +05:00
bar@mysql.com
1b50f35ab2 Merge mysql.com:/usr/home/bar/mysql-4.1.b12351
into  mysql.com:/usr/home/bar/mysql-5.0
2005-08-12 17:10:00 +05:00
bar@mysql.com
fd7ad7f16f Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-4.1.b12351
2005-08-12 15:44:03 +05:00
acurtis@xiphis.org
b9476f7d50 Merge xiphis.org:/usr/home/antony/work2/mysql-4.1
into  xiphis.org:/usr/home/antony/work2/merge-5.0
2005-08-11 12:18:53 +01:00
bell@51.0.168.192.in-addr.arpa
4f26fa5184 merge 2005-08-11 10:20:06 +03:00
patg@krsna.patg.net
6128521b5b item_strfunc.cc:
BUG #11104 
      Took out the offset-=delimiter_length-1 out of the for loop. It was causing
      basically this: 
      select substring_index('the king of the the hill', 'the', -2) to not work.
      The first iteration, offset would be initialised to 24, then strstr would 
      point at 'the king of the the* hill' ('*'means right before the 
      character following), returning a offset of 16. The for loop would then 
      decrement offset by two (3 - 1), to 14, now pointing at 
      "the king of th*e the hill", _skipping_ past the 'e' in the second to last
      'the', and therefore strstr would never have a chance of matching the 
      second to last 'the', then moving on to the 'the' at the begginning of the 
      string!
      In a nutshell, offset was being decremented by too great a value, preventing
      the second to last 'the' from being ever found, hence the result of 
      'king of the the hill' from the query that is reported in the bug report
func_str.test:
  BUG #11104
  Added tests to make sure fix addresses issues in original bug report
func_str.result:
  BUG #11104 
  New results for new tests
2005-08-08 13:46:13 -07:00
bar@mysql.com
e6f96b4939 func_system.result, func_system.test:
adding test case
item_strfunc.cc:
  Bug#12351
  CONCAT with USER()/DATEBASE() and
  a column gets strange results.
  Mark created Item_str as constant, so CONCAT
  cannot reuse it for optimization purposes.
2005-08-08 19:09:54 +05:00
patg@krsna.patg.net
8109934e1d BUG 11104 (same as changeset 1.1891 on the 5.0 tree, but realised this
needed to be fixed in earlier versions)
Fixed the iteration of how substrings are handled with negative indexes in 
SUBSTRING_INDEX
2005-07-31 21:28:52 -07:00