Commit graph

343 commits

Author SHA1 Message Date
unknown
3a0d0b4ce5 BUG#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol
In the code that converts IN predicates to EXISTS predicates it is changing
the select list elements to constant 1. Example :
SELECT ... FROM ...  WHERE a IN (SELECT c FROM ...)
is transformed to :
SELECT ... FROM ... WHERE EXISTS (SELECT 1 FROM ...  HAVING a = c)
However there can be no FROM clause in the IN subquery and it may not be
a simple select : SELECT ... FROM ... WHERE a IN (SELECT f(..) AS
c UNION SELECT ...) This query is transformed to : SELECT ... FROM ...
WHERE EXISTS (SELECT 1 FROM (SELECT f(..) AS c UNION SELECT ...)
x HAVING a = c) In the above query c in the HAVING clause is made to be
an Item_null_helper (a subclass of Item_ref) pointing to the real
Item_field (which is not referenced anywhere else in the query anymore).
This is done because Item_ref_null_helper collects information whether
there are NULL values in the result.  This is OK for directly executed
statements, because the Item_field pointed by the Item_null_helper is
already fixed when the transformation is done.  But when executed as
a prepared statement all the Item instances are "un-fixed" before the
recompilation of the prepared statement. So when the Item_null_helper
gets fixed it discovers that the Item_field it points to is not fixed
and issues an error.  The remedy is to keep the original select list
references when there are no tables in the FROM clause. So the above
becomes : SELECT ... FROM ...  WHERE EXISTS (SELECT c FROM (SELECT f(..)
AS c UNION SELECT ...) x HAVING a = c) In this way c is referenced
directly in the select list as well as by reference in the HAVING
clause. So it gets correctly fixed even with prepared statements.  And
since the Item_null_helper subclass of Item_ref_null_helper is not used
anywhere else it's taken out.


mysql-test/r/ps_11bugs.result:
  Test case for the bug
mysql-test/r/subselect.result:
  Explain updated because of the tranformation
mysql-test/t/ps_11bugs.test:
  Testcase for the bug
sql/item.cc:
  Taking out Item_null_helper as it's no longer needed
sql/item.h:
  Taking out Item_null_helper as it's no longer needed
sql/item_subselect.cc:
  The described change to the IN->EXISTS transformation
2006-04-28 11:23:31 +02:00
unknown
101d9189bd Merge mysql.com:/home/jimw/my/mysql-4.1-13344
into  mysql.com:/home/jimw/my/mysql-4.1-clean


mysql-test/r/cast.result:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
sql/item.h:
  Auto merged
2005-10-12 13:27:49 -07:00
unknown
13fa84a7e2 Fix CAST(1.0e+300 TO SIGNED). (Bug #13344)
mysql-test/r/cast.result:
  Update results
mysql-test/t/cast.test:
  Add regression test
sql/item.h:
  Cap Item_real::val_int() to LONGLONG_MIN and LONGLONG_MAX.
2005-09-22 15:59:13 -07:00
unknown
1d16fa5d86 Ensure that hex strings are used as integers in cast(... signed/unsigned)
This fixes the new report for bug #7036


mysql-test/t/cast.test:
  Added test for cast(hex-value to signed/unsigned)
sql/item.h:
  Ensure that hex strings are used as integers in cast(... signed/unsigned)
2005-09-21 17:28:25 +03:00
unknown
527a9cad7e Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-4.1.b12371


sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
2005-08-29 15:44:49 +05:00
unknown
1b970e94e0 Bug#11338 Fixes from review (identical functionality).
include/my_sys.h:
  Fixes from review (use version in log_event.cc instead)
mysql-test/r/ctype_cp932.result:
  Updated test for bug#11338 (logging of prepared statement w/ blob type)
mysql-test/t/ctype_cp932.test:
  udpated test for bug#11338 (logging of prepared statement w/ blob type)
mysys/charset.c:
  Fixes from review (use version in log_event.cc instead)
sql/item.cc:
  Fixes from review (store character_set_client differently so that
  fix can be merged forward to 5.0)
sql/item.h:
  Fixes from review
sql/log_event.cc:
  Fixes from review, str_to_hex is now used by item.cc
sql/log_event.h:
  Added prototype for str_to_hex (now used by item.cc)
sql/sql_prepare.cc:
  Fixes from review, store character_set_client differently so that 
  Item_param::query_val_str can use it.
2005-08-19 14:49:34 -04:00
unknown
99cf8c38e0 Merge mysql.com:/Users/emurphy/src/bk-clean/mysql-4.1
into  mysql.com:/Users/emurphy/src/work/mysql-4.1-bug11338


sql/item.h:
  Auto merged
2005-08-17 04:32:29 -04:00
unknown
a29b1d7151 BUG#11338 (logging of prepared statement w/ blob type)
In cp932, '\' character can be the second byte in a 
multi-byte character stream. This makes it difficult to use
mysql_escape_string. Added flag to indicate which languages allow
'\' as second byte of multibyte sequence so that when putting a prepared
statement into the binlog we can decide at runtime whether hex encoding
is really needed.


include/m_ctype.h:
  Added bool to indicate character sets which allow '\' as the second
  byte of a multibyte character set (currently only cp932). For these
  character sets, escaping with '\' is dangerous and leads to corruption
  in replication.
include/my_sys.h:
  Add function to enocde a string as hex with no prefix (bare)
mysys/charset.c:
  Add function to encode string as hex with no prefix (bare).
sql/item.cc:
  Check the connection character set to see if escape_string_for_mysql
  is safe, or if character set requires unambiguous (hex) encoding
sql/item.h:
  Pass thd to query_val_str for access to charset()
sql/sql_prepare.cc:
  Pass thd to query_val_str.
strings/ctype-big5.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-bin.c:
  Add escape_with_backslash_is_dangerous flag
strings/ctype-cp932.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-czech.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-euc_kr.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-extra.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-gb2312.c:
  Add escape_with_backslash_is_dangerous flag.
strings/ctype-gbk.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-latin1.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-sjis.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-tis620.c:
  Added esacpe_with_backslash_character_is_dangerous flag.
strings/ctype-uca.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-ucs2.c:
  Added escape_with_backslash_is_dangerous.
strings/ctype-ujis.c:
  Added escape_with_backslash_is_dangerous flag.
strings/ctype-utf8.c:
  Added escape_with_backslash_is_dangerous.
strings/ctype-win1250ch.c:
  Added escape_with_backslash_is_dangerous.
2005-08-17 04:26:32 -04:00
unknown
19b4760f19 fixed convertion and handling IN subqueries with rows (BUG#11867)
mysql-test/r/subselect.result:
  testst of IN subqueries with row
mysql-test/t/subselect.test:
  tests of ion subqueries with row
sql/item.h:
  add method to prevent of removing Item_ref_null_helper from HAVING
sql/item_cmpfunc.h:
  Prevented removing of Item_test_isnotnull from HAVING
sql/item_subselect.cc:
  fixed converting row IN subqueries
sql/sql_select.cc:
  fixed debug print
2005-08-13 07:45:14 +03:00
unknown
c03d28b893 Bug#12371 executing prepared statement fails (illegal mix of collations)
item.cc:
item.h:
  Adding Item_param::safe_charset_converter,
  not to return collation mix error if
  parameter can be converted into operation
  character set.

ctype_utf8.result:
  adding test case
ctype_utf8.test:
  adding test case


sql/item.h:
  Bug #12371 executing prepared statement fails (illegal mix of collations)
  Adding Item_param::safe_charset_converter,
  not to returm collation mix error if
  parameter can be converted into operation
  character set.
sql/item.cc:
  Bug #12371 executing prepared statement fails (illegal mix of collations)
mysql-test/t/ctype_utf8.test:
  adding test case
mysql-test/r/ctype_utf8.result:
  adding
2005-08-06 16:58:36 +05:00
unknown
8624bcfdbe func_gconcat.result, func_gconcat.test:
Adding test
item_sum.cc:
  Adding a call for collation/charset aggregation,
      to collect attributes from the arguments. The actual bug fix.
item_func.h, item_func.cc, item.h, item.cc:
  - Removing collation aggrgation functions from Item_func class
      in item.cc, and adding it as non-class functions in item.cc
      to be able to reuse this code for group_concat.
      - Adding replacement for these functions into Item_func class
      as wrappers for moved functions, to minizize patch size,


sql/item.cc:
  - Removing collation aggrgation functions from Item_func class
      in item.cc, and adding it as non-class functions in item.cc
      to be able to reuse this code for group_concat.
      - Adding replacement for these functions into Item_func class
      as wrappers for moved functions, to minizize patch size,
sql/item.h:
  - Removing collation aggrgation functions from Item_func class
      in item.cc, and adding it as non-class functions in item.cc
      to be able to reuse this code for group_concat.
      - Adding replacement for these functions into Item_func class
      as wrappers for moved functions, to minizize patch size,
sql/item_func.cc:
  - Removing collation aggrgation functions from Item_func class
      in item.cc, and adding it as non-class functions in item.cc
      to be able to reuse this code for group_concat.
      - Adding replacement for these functions into Item_func class
      as wrappers for moved functions, to minizize patch size,
sql/item_func.h:
  - Removing collation aggrgation functions from Item_func class
      in item.cc, and adding it as non-class functions in item.cc
      to be able to reuse this code for group_concat.
      - Adding replacement for these functions into Item_func class
      as wrappers for moved functions, to minizize patch size,
sql/item_sum.cc:
  Adding a call for collation/charset aggregation,
      to collect attributes from the arguments. The actual bug fix.
mysql-test/t/func_gconcat.test:
  Adding test
mysql-test/r/func_gconcat.result:
  Adding test
2005-07-26 12:52:02 +05:00
unknown
86cb32b7b0 Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-4.1.num-conv


mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
2005-07-14 10:46:15 +05:00
unknown
ece17ba3cf - 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.


mysql-test/r/ps.result:
  Bug#11458: test results fixed
mysql-test/t/ps.test:
  - add a test case for Bug#11458 "Prepared statement with subselects return 
  random data"
sql/item.cc:
  - remove unnecessary Item_param::fix_fields
  - fix Item_param::set_null to set item_type accordingly (safety:
    Item_param should behave like a basic constant).
sql/item.h:
  Remove Item_param::fix_fields
sql/item_subselect.h:
  Remove no more existing friend.
sql/mysql_priv.h:
  Add UNCACHEABLE_PREPARE to mark all subqueries as uncacheable if
  in statement prepare (backport from 5.0).
sql/sql_lex.h:
  Comment fixed.
sql/sql_parse.cc:
  If in statement prepare, mark all subqueries as uncacheable (backport
  from 5.0)
sql/sql_prepare.cc:
  Switch off the uncacheable flag from all subqueries after statement
  prepare is done (backport from 5.0)
2005-07-13 17:38:55 +04:00
unknown
4a2af29fe7 ctype_utf8.result:
adding test case
sql_table.cc:
  sql_table.cc:
  - do not create a new item when charsets are the same
  - return ER_INVALID_DEFAULT if default value cannot
    be converted into the column character set.
item.cc:
  - Allow conversion not only to Unicode,
    but also to and from "binary".
  - Adding safe_charset_converter() for Item_num
    and Item_varbinary, returning a fixed const Item.


sql/item.cc:
  - Allow conversion not only to Unicode,
    but also to and from "binary".
  - Adding safe_charset_converter() for Item_num
    and Item_varbinary, returning a fixed const Item.
sql/sql_table.cc:
  sql_table.cc:
  - do not create a new item when charsets are the same
  - return ER_INVALID_DEFAULT if default value cannot
    be converted into the column character set.
mysql-test/r/ctype_utf8.result:
  adding test case
2005-07-13 13:00:17 +05:00
unknown
d10877ce8c 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


mysql-test/r/insert_select.result:
  More tests for bug #9728 and #8147
mysql-test/r/insert_update.result:
  Updated tests after changing how INSERT ... SELECT .. ON DUPLICATE KEY works
mysql-test/t/insert_select.test:
  More tests for bug #9728 and #8147
mysql-test/t/insert_update.test:
  Updated tests after changing how INSERT ... SELECT .. ON DUPLICATE KEY works
mysys/my_access.c:
  Cleanup (shorter loop variable names)
sql/ha_ndbcluster.cc:
  Indentation fixes
sql/item.cc:
  Remove item_flags
sql/item.h:
  Remove item_flags
sql/mysql_priv.h:
  New arguments to mysql_prepare_insert
sql/sql_base.cc:
  Remove old fix for bug #8147
sql/sql_insert.cc:
  Extend mysql_prepare_insert() with new field list for tables that can be used in the values port of ON DUPLICATE KEY UPDATE
sql/sql_parse.cc:
  Revert fix for #9728
  Allow one to use other tables in ON DUPLICATE_KEY for INSERT ... SELECT if there is no GROUP BY clause
sql/sql_prepare.cc:
  New arguments to mysql_prepare_insert
sql/sql_yacc.yy:
  Revert bug fix for #9728
2005-06-27 16:46:41 +03:00
unknown
256c99fdb2 item.h:
Fix for fix for bug#9728 decreased functionality in "on duplicate key update"
  Have to return false to set flag for whole expression.


sql/item.h:
  Fix for fix for bug#9728 decreased functionality in "on duplicate key update"
  Have to return false to set flag for whole expression.
2005-06-22 22:58:44 +04:00
unknown
a6c7fb455a Fix bug #9728 decreased functionality in "on duplicate key update"
Remove changes made by bug fix #8147. They strips list of insert_table_list to
only insert table, which results in error reported in bug #9728.
Added flag to Item to resolve ambigous fields reported in bug #8147.


sql/item.h:
  Fix bug#9728  decreased functionality in "on duplicate key update".
sql/item.cc:
  Fix bug#9728  decreased functionality in "on duplicate key update"
sql/sql_parse.cc:
  Fix bug#9728  decreased functionality in "on duplicate key update"
sql/sql_base.cc:
  Fix bug#9728  decreased functionality in "on duplicate key update".
sql/sql_yacc.yy:
  Fix bug#9728  decreased functionality in "on duplicate key update"
mysql-test/t/insert_select.test:
  Test case for bug#9728 Decreased functionality in "on duplicate key update".
mysql-test/r/insert_select.result:
  Test case for bug#9728 Decreased functionality in "on duplicate key update".
2005-06-22 07:18:42 +04:00
unknown
4da133cabf sql_select.cc, item_buff.cc, item.h:
Fixed bug #11088: a crash for queries with GROUP BY a BLOB column
  + COUNT(DISTINCT...) due to an attempt to allocate a too large
  buffer for the BLOB field.
  Now the size of the buffer is limited by max_sort_length.
group_by.test, group_by.result:
  Added a test case for bug #11088.


mysql-test/r/group_by.result:
  Added a test case for bug #11088.
mysql-test/t/group_by.test:
  Added a test case for bug #11088.
sql/item.h:
  Fixed bug #11088: a crash for queries with GROUP BY a BLOB column
  + COUNT(DISTINCT...) due to an attempt to allocate a too large
  buffer for the BLOB fields.
  Now the size of the buffer is limited by max_sort_length.
sql/item_buff.cc:
  Fixed bug #11088: a crash for queries with GROUP BY a BLOB column
  + COUNT(DISTINCT...) due to an attempt to allocate a too large
  buffer for the BLOB fields.
  Now the size of the buffer is limited by max_sort_length.
sql/sql_select.cc:
  Fixed bug #11088: a crash for queries with GROUP BY a BLOB column
  + COUNT(DISTINCT...) due to an attempt to allocate a too large
  buffer for the BLOB fields.
  Now the size of the buffer is limited by max_sort_length.
2005-06-07 03:05:57 -07:00
unknown
4b2020c575 Some improvement in Item_int_with_ref class comment. 2005-05-16 14:06:52 +00:00
unknown
e99c4c6cf2 Merge neptunus.(none):/home/msvensson/mysql/bug10241
into neptunus.(none):/home/msvensson/mysql/mysql-4.1


include/my_global.h:
  Auto merged
sql/item.h:
  Auto merged
2005-05-09 11:23:12 +02:00
unknown
c758512a91 A fix and test case for Bug#9777 " Empty set returned by Prepared Statement when it
should return a non empty one"
(see comments for the changed files for details).


mysql-test/r/ps.result:
  A test case for Bug#9777: tests results fixed.
mysql-test/t/ps.test:
  A test case for Bug#9777
sql/item.cc:
  A fix for Bug#9777: when creating a constant item from within 
  Item_int_with_ref::new_item, create the item by value, not by name.
  This should work with prepared statements placeholders.
  Item_int_with_ref is a special optimization case used
   when we compare datetime constants with datetime value.
  Converting the item to integer early is OK as it is in line
  with the purpose of Item_int_with_ref - to speed up comparison by 
  using integers.
  Minor cleanups.
sql/item.h:
  Declaration for Item_int_with_ref::new_item
2005-05-05 12:55:09 +04:00
unknown
9ab5f6143e BUG#10241 cygwin port: invalid pragma interface directives
- Introduce ifdefs so we can control when to use #pragma interface on cygwin


include/my_global.h:
  Turn on use of #pragma implementation and #pragma interface if compiled with GCC and platform != Cygwin
include/raid.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/examples/ha_archive.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/examples/ha_example.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/field.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_berkeley.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_blackhole.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_heap.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_innodb.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_isam.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_isammrg.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_myisam.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_myisammrg.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/ha_ndbcluster.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/handler.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_cmpfunc.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_func.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_geofunc.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_strfunc.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_subselect.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_sum.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/item_timefunc.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/opt_range.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/procedure.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/protocol.h:
  replace __GNUC__ with USE_PRAGMA_IMPLEMENTATION
sql/set_var.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/sql_class.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/sql_list.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/sql_select.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/sql_string.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/sql_udf.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
sql/tztime.h:
  replace __GNUC__ with USE_PRAGMA_INTERFACE
2005-05-04 15:05:56 +02:00
unknown
b883aebae0 Merge mysql.com:/opt/local/work/mysql-4.1-root
into mysql.com:/opt/local/work/mysql-4.1-9096-fresh


sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
2005-05-03 12:49:22 +04:00
unknown
9fcda7fcc5 A fix and test case for Bug#9096 "select doesn't return all matched
records if prepared statements is used".
This fix changes equality evaluation method of basic constants from
by-name to by-value, thus effectively enabling use of parameter markers
in some optimizations (constants propagation, evaluation of possible
keys for query).


mysql-test/r/ps.result:
  Test results for the test case for Bug#9096
mysql-test/t/ps.test:
  A short test case for Bug#9096 "select doesn't return all matched records if
   prepared statements is used". The is enough to reproduce the
  glitch in update_ref_and_keys causing the bug to occur.
sql/item.cc:
  Implement by-value equality evaluation of basic constants.
  This is needed to work with Item_param values. Until now
  Item_param was compared with other items by its name, which is always "?".
  The bug at hand showed up when an integer
  constant was created from one parameter marker (with value 200887 and
   name "?") and then compared by-name with another parameter marker
  (with value 860 and name "?"). True returned by this comparison resulted
  in a wrong table access method used to evaluate the query.
  Implement Item_param methods needed to emulate "basic constant" mode at 
  full.
sql/item.h:
  Change declaration of basic_const_item(): now it also widens its 
  argument from const Item * to Item * if the argument is a basic constant.
  Declare eq() for all basic constatns, as long as now they 
  are compared by value, not by name. Each constant needs its own
  comparison method.
  Declarations of Item_param methods needed to fully emulate 
  a basic constant when parameter value is set.
sql/item_func.cc:
  Fix wrong casts.
2005-05-03 12:47:27 +04:00
unknown
97b0821462 CAST(string_argument AS UNSIGNED) didn't work for big integers above the signed range. (Bug #7036)
Produce warnings of wrong cast of strings to signed/unsigned.
Don't block not resolved IP's if DNS server is down (Bug #8467)
Fix compiler problems with MinGW (Bug #8872)


configure.in:
  Fix compiler problems with MinGW (Bug #8872)
include/config-win.h:
  Fix compiler problems with MinGW (Bug #8872)
include/my_global.h:
  Fix compiler problems with MinGW (Bug #8872)
mysql-test/r/cast.result:
  Test for cast to signed/unsigned outside of range (Bug #7036)
mysql-test/t/cast.test:
  Test for cast to signed/unsigned outside of range (Bug #7036)
mysys/default.c:
  Cleanup (combine identical code). 
  Done mainly by Jani
sql/field.h:
  Added cast_to_int_type() to ensure that enums are casted as numbers
sql/hostname.cc:
  Don't block not resolved IP's if DNS server is down (Bug #8467)
sql/item.h:
  Added cast_to_int_type() to ensure that enums are casted as numbers
sql/item_func.cc:
  CAST(string_argument AS UNSIGNED) didn't work for big integers above the
  signed range. (Bug #7036)
  Produce warnings of wrong cast of strings to signed/unsigned
sql/item_func.h:
  CAST(string_argument AS UNSIGNED) didn't work for big integers above the
  signed range. (Bug #7036)
2005-04-29 17:03:34 +03:00
unknown
6ae390fd5d Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1


sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_subselect.h:
  Auto merged
2005-03-31 10:47:32 +02:00
unknown
af2ab040cc BUG#8807 Select crash server
- Add function Item_param::fix_fields which will update any subselect they are part of and indicate that the subsleect is not const during prepare phase, and thus should not be executed during prepare.


mysql-test/include/ps_query.inc:
  Adde new test case
mysql-test/r/ps_2myisam.result:
  Update test result
mysql-test/r/ps_3innodb.result:
  Update test result
mysql-test/r/ps_4heap.result:
  Update test result
mysql-test/r/ps_5merge.result:
  Update test result
mysql-test/r/ps_6bdb.result:
  Update test result
mysql-test/r/ps_7ndb.result:
  Update test result
sql/item.cc:
  Add function Item_param::fix_fields, which will mark any subselects they are part of as not being a constant expression unless the param value is specified, ie. it will be not be constant during prepare phase.
sql/item.h:
  Adde Item_param::fix_fields
sql/item_subselect.h:
  Make Item_param::fix_field friend of Item_subselect
2005-03-30 12:14:37 +02:00
unknown
dddabc7edd Merge
mysql-test/r/metadata.result:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
mysql-test/r/union.result:
  SCCS merged
mysql-test/t/union.test:
  SCCS merged
2005-03-30 10:27:36 +03:00
unknown
5a42525027 fixed union types merging and table related metadata (BUG#8824)
mysql-test/r/func_group.result:
  new result
mysql-test/r/metadata.result:
  new result
  test of metadata of variables, unions and derived tables
mysql-test/r/union.result:
  new results
  test of union of enum
mysql-test/t/metadata.test:
  test of metadata of variables, unions and derived tables
mysql-test/t/union.test:
  test of union of enum
sql/field.cc:
  Field type merging rules added
  Fixed table name/alias returting for field made from temporary tables
sql/field.h:
  removed unned field type reporting
sql/item.cc:
  fixed bug in NEW_DATE type field creartion
  replaced mechanism of merging types of UNION
sql/item.h:
  replaced mechanism of merging types of UNION
sql/item_func.h:
  new item type to make correct field type detection possible
sql/item_subselect.cc:
  added table name parameter to prepare() to show right table alias for derived tables
sql/sql_derived.cc:
  added table name parameter to prepare() to show right table alias for derived tables
sql/sql_lex.h:
  added table name parameter to prepare() to show right table alias for derived tables
sql/sql_parse.cc:
  made function for enum/set pack length calculation
sql/sql_prepare.cc:
  added table name parameter to prepare() to show right table alias for derived tables
sql/sql_select.cc:
  new temporary table field creation by Item_type_holder
  fixed table alias for temporary table
sql/sql_union.cc:
  added table name parameter to prepare() to show right table alias for derived tables
2005-03-23 08:36:48 +02:00
unknown
a131e4d12d Merge rurik.mysql.com:/home/igor/mysql-4.1
into rurik.mysql.com:/home/igor/dev/mysql-4.1-0


sql/item.h:
  Auto merged
2005-03-16 17:50:03 -08:00
unknown
a5c87958a6 Fix for bug#8656: Crash with group_concat on alias in outer table
fixed result_field support of Item_ref
2005-03-16 16:44:28 +03:00
unknown
e16535ce19 olap.result, olap.test:
Added a test case for bug #8616.
item.h:
  Fixed bug #8616.
  Added class Item_null_result used in rollup processing.
sql_select.h, sql_select.cc:
  Fixed bug #8616.
  Added JOIN::rollup_write_data to cover rollup queries
  with DISTINCT. Modified other rollup methods.


sql/sql_select.cc:
  Fixed bug #8616.
  Added JOIN::rollup_write_data to cover rollup queries
  with DISTINCT. Modified other rollup methods.
sql/sql_select.h:
  Fixed bug #8616.
  Added JOIN::rollup_write_data to cover rollup queries
  with DISTINCT. Modified other rollup methods.
sql/item.h:
  Fixed bug #8616.
  Added class Item_null_result used in rollup processing.
mysql-test/t/olap.test:
  Added a test case for bug #8616.
mysql-test/r/olap.result:
  Added a test case for bug #8616.
2005-03-15 22:50:54 -08:00
unknown
c56d0283dd type_blob.result, func_system.result, func_str.result, ctype_collate.result:
fixing test results accordingly.
func_system.test:
  New test that illegal mix of collations does not happen anymore.
item_strfunc.h:
    safe_charset_converter() was added for system constants.
item_strfunc.cc:
  safe_charset_converter() was added for system constants.
item_func.cc, item.h, item.cc:
  Bug#8291: Illegal collation mix with USER() function.
  After discussion with PeterG and Serge, a new coercibility
  level for "system constants" was introduced, between
  COERRIBLE and IMPLICIT. Thus:
  SELECT col1 = USER() FROM t1; - is done according to col1 collation.
  SELECT 'string' = USER(); - is done according to USER() collation.
  At the same time, "nagg" and "strong" members were removed as unused.
item_create.cc:
  Version is a system constant too.


sql/item.cc:
  Bug#8291: Illegal collation mix with USER() function.
  After discussion with PeterG and Serge, a new coercibility
  level for "system constants" was introduced, between
  COERRIBLE and IMPLICIT. Thus:
  SELECT col1 = USER() FROM t1; - is done according to col1 collation.
  SELECT 'string' = USER(); - is done according to USER() collation.
  At the same time, "nagg" and "strong" members were removed as unused.
sql/item.h:
  Bug#8291: Illegal collation mix with USER() function.
  After discussion with PeterG and Serge, a new coercibility
  level for "system constants" was introduced, between
  COERRIBLE and IMPLICIT. Thus:
  SELECT col1 = USER() FROM t1; - is done according to col1 collation.
  SELECT 'string' = USER(); - is done according to USER() collation.
  At the same time, "nagg" and "strong" members were removed as unused.
sql/item_create.cc:
  Version is a system constant too.
sql/item_func.cc:
  Bug#8291: Illegal collation mix with USER() function.
  After discussion with PeterG and Serge, a new coercibility
  level for "system constants" was introduced, between
  COERRIBLE and IMPLICIT. Thus:
  SELECT col1 = USER() FROM t1; - is done according to col1 collation.
  SELECT 'string' = USER(); - is done according to USER() collation.
  At the same time, "nagg" and "strong" members were removed as unused.
sql/item_strfunc.cc:
  safe_charset_converter() was added for system constants.
sql/item_strfunc.h:
    safe_charset_converter() was added for system constants.
mysql-test/t/func_system.test:
  New test that illegal mix of collations does not happen anymore.
mysql-test/r/ctype_collate.result:
  fixing test results accordingly.
mysql-test/r/func_str.result:
  fixing test results accordingly.
mysql-test/r/func_system.result:
  fixing test results accordingly.
mysql-test/r/type_blob.result:
  fixing test results accordingly.
2005-03-04 14:20:49 +04:00
unknown
d88c56a637 Comments added 2005-03-03 05:03:21 +03:00
unknown
1b3ffb1bcb Fix for BUG#8562: In Item_int_with_ref::new_item() create Item_int or Item_uint
depending on ref->unsigned_flag. Item_int_with_ref can refer to both signed and 
unsigned integers.


mysql-test/r/bigint.result:
  Test case for BUG#8562
mysql-test/t/bigint.test:
  Test case for BUG#8562
2005-02-28 23:50:06 +03:00
unknown
cb8d9c3ad4 Backport my_strntod() from 5.0
Change string->float conversion to delay division as long as possible.
This gives us more exact integer->float conversion for numbers of type '123.45E+02' (Bug #7740)




client/mysql.cc:
  Fix wront usage of charset (found during review of pushed code)
include/m_string.h:
  Backported my_strtod() from 5.0
mysql-test/mysql-test-run.sh:
  Run also mysql_client_test with --debug
mysql-test/r/ps_1general.result:
  Safety fix (if mysql_client_test.test fails)
mysql-test/r/type_float.result:
  More test
mysql-test/t/mysql_client_test.test:
  Comments for what to do if this test fails
mysql-test/t/ps_1general.test:
  Safety fix (if mysql_client_test.test fails)
mysql-test/t/type_float.test:
  More test to better test new strtod() function
  Test also bug #7740 (wrong comparsion between integer and float-in-integer-range)
sql/field.cc:
  Backport my_strntod() from 5.0
sql/item.cc:
  Backport my_strntod() from 5.0
sql/item.h:
  Backport my_strntod() from 5.0
sql/item_func.h:
  Backport my_strntod() from 5.0
sql/item_strfunc.cc:
  Backport my_strntod() from 5.0
sql/item_sum.cc:
  Backport my_strntod() from 5.0
sql/item_sum.h:
  Backport my_strntod() from 5.0
sql/procedure.h:
  Backport my_strntod() from 5.0
strings/ctype-simple.c:
  Backport my_strntod() from 5.0
strings/ctype-ucs2.c:
  Backport my_strntod() from 5.0
strings/strtod.c:
  Backport my_strntod() from 5.0
  Change conversion to delay division as long as possible.
  This gives us more exact integer-> float conversion for numbers of type '123.45E+02'
2005-02-22 12:51:23 +02:00
unknown
41c0945096 item.h:
Revised the fix for bug #7098.
  Corrected the method Item_string::new_item.
sql_select.cc:
  Revised the fix for bug #7098.
  Aborted the previous modifications.


sql/sql_select.cc:
  Revised the fix for bug #7098.
  Aborted the previous modifications.
sql/item.h:
  Revised the fix for bug #7098.
  Corrected the method Item_string::new_item.
2005-02-16 22:51:32 -08:00
unknown
de109e463b Fix signatures of placement operator delete in places where placement
delete is declared. As we don't use exceptions placement delete is never 
called and the fix only affects numerous warnings when
compiling with MS Visual C++.
For more info see http://www.gotw.ca/gotw/010.htm.


sql/item.h:
  Fix the signature of placement operator delete for class Item.
sql/sql_class.cc:
  Add placement delete operator to suppress a warning under Windows.
sql/sql_lex.h:
  Fix the signature of placement operator delete for class LEX
sql/sql_list.h:
  Fix the signature of placement operator delete for class Sql_alloc
sql/sql_string.h:
  Fix the signature of placement operator delete for class Sql_string
2005-02-15 03:55:44 +03:00
unknown
63982db93c Better bugfix for "HAVING when refering to RAND()" (Bug #8216)
Ensure that references in HAVING, ORDER BY or GROUP BY are calculated after fields in SELECT.
This will ensure that any reference to these has a valid value.
Generalized the code for split_sum_func()


BitKeeper/etc/ignore:
  added support-files/ndb-config-2-node.ini
mysql-test/r/group_by.result:
  More complicated test to assure that rand() is only calulated once
mysql-test/r/user_var.result:
  Back to old results :(  (ok but not perfect)
mysql-test/t/group_by.test:
  More complicated test to assure that rand() is only calulated once
sql/item.cc:
  Better bugfix for "HAVING when refering to RAND()"
  This will ensure that when refering to things like RAND() in HAVING through an alias we will not recalculate that rand() value in the HAVING part but use the value in the row
  Generalize split_sum_func()
sql/item.h:
  Better bugfix for "HAVING when refering to RAND()"
  T
sql/item_cmpfunc.cc:
  Better bugfix for "HAVING when refering to RAND()"
  Use generalized split_sum_func2() function
sql/item_func.cc:
  Better bugfix for "HAVING when refering to RAND()"
  Use generalized split_sum_func2() function
sql/item_row.cc:
  Better bugfix for "HAVING when refering to RAND()"
  Use generalized split_sum_func2() function
sql/item_strfunc.cc:
  Better bugfix for "HAVING when refering to RAND()"
  Use generalized split_sum_func2() function
sql/sql_list.h:
  Add functions to concatenate lists
sql/sql_select.cc:
  Better bugfix for "HAVING when refering to RAND()"
  Ensure that references in HAVING, ORDER BY or GROUP BY are calculated after fields in SELECT.
  This will ensure that any reference to these has a valid value.
2005-02-08 14:41:09 +02:00
unknown
66eb71f3fc A fix: bug#6931: Date Type column problem when using UNION-Table
bug#7833:  Wrong datatype of aggregate column is returned


mysql-test/r/func_group.result:
  Test case for bug 7833:  Wrong datatype of aggregate column is returned
mysql-test/r/union.result:
  Test case for bug 6931: Date Type column problem when using UNION-Table.
mysql-test/t/func_group.test:
  Test case for bug 7833:  Wrong datatype of aggregate column is returned
mysql-test/t/union.test:
  Test case for bug 6931: Date Type column problem when using UNION-Table.
2005-02-04 15:31:36 +03:00
unknown
a88f6fda40 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1


sql/item.h:
  Auto merged
2004-12-14 16:26:10 +04:00
unknown
cef35aeb1c bug#6275 "client_test" fail in 4.1.7 make test
bug#6911 resultset metadata always return client character set
2004-12-14 15:58:30 +04:00
unknown
54745a18a1 A quick fix for bug #7257: Crash in default tests: 'subselect'
sql/item.h:
  A quick fix for bug #7257: Crash in default tests: 'subselect'
  We have to pass &item instead of &store to the Item_ref_null_helper() 
  then set ref.
2004-12-14 15:41:01 +04:00
unknown
8322eb0aaa * Added comments and one assert
* Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()


sql/item.cc:
   * More comments
   * Backport of safety measures from 5.0: make numeorous replaces:
      s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item.h:
  Assert added
sql/item_cmpfunc.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_func.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_strfunc.h:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_subselect.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_sum.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/set_var.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_base.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_handler.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_help.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_select.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
2004-12-14 03:36:19 +03:00
unknown
0e48685291 Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
* Added Item_ref::set_properties 
 * Item_ref::Item_ref now expects to get in *item either
     NULL - then fix_fields() will be called later  or 
     ptr to Item it will refer to - then an equivalent of fix_fields() call is performed


sql/item.cc:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Added Item_ref::set_properties 
   * Adjusted Item_ref::Item_ref calls to match new calling convention
sql/item.h:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Added Item_ref::set_properties 
   * Item_ref::Item_ref now expects to get in *item either
       NULL - then fix_fields() will be called later or
       ptr to Item it will refer to - then an equivalent of fix_fields() call is performed
sql/item_cmpfunc.cc:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Adjusted Item_ref::Item_ref calls to match new calling convention
sql/item_func.cc:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Added Item_ref::set_properties 
   * Adjusted Item_ref::Item_ref calls to match new calling convention
sql/item_row.cc:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Added Item_ref::set_properties 
   * Adjusted Item_ref::Item_ref calls to match new calling convention
sql/item_strfunc.cc:
  Merge of fix for BUG#6976 continued: pulling in some Item_ref changes from 5.0
   * Added Item_ref::set_properties 
   * Adjusted Item_ref::Item_ref calls to match new calling convention
2004-12-14 01:07:06 +03:00
unknown
06cbb73f26 Merged fixes for BUG#6976 and BUG#7079 2004-12-13 20:25:26 +03:00
unknown
75a43405d4 Merged (will need a post-merge fix)
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
2004-12-13 20:10:07 +03:00
unknown
6d7fe8520a Merging fix for BUG#6976 from 4.0 to 4.1
The problem in 4.1 was the same as in 4.0 - fix_fields() not called for created Item_ref. 
The fix is similar too - initialize Item_refs in ctor (but don't interfere with cases when 
Item_ref is used by subselects). 


sql/item.cc:
  Fix for BUG#6976 ported from 4.0
sql/item_cmpfunc.cc:
  Fix for BUG#6976 ported from 4.0
sql/item_func.cc:
  Fix for BUG#6976 ported from 4.0
sql/item_row.cc:
  Fix for BUG#6976 ported from 4.0
sql/item_strfunc.cc:
  Fix for BUG#6976 ported from 4.0
2004-12-13 20:06:06 +03:00
unknown
8621164bd1 comment of class edded 2004-12-13 15:05:52 +02:00
unknown
3ce0df5937 new reference which refer to current value not to result used for resolving outer
refernces if subqueri is not in HAVING clause (BUG#7079)
  and the same used for subquery transformetion


mysql-test/r/subselect.result:
  reference on changable fields from subquery
mysql-test/t/subselect.test:
  reference on changable fields from subquery
sql/item.cc:
  new reference which refer to current value not to result used
sql/item.h:
  new reference which refer to current value not to result used
sql/item_subselect.cc:
  new reference which refer to current value not to result used
2004-12-11 17:13:19 +02:00