Commit graph

4846 commits

Author SHA1 Message Date
unknown
6297d1ab38 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into moonbone.local:/work/16377-bug-4.1-opt-mysql
2006-06-13 19:10:27 +04:00
unknown
47311e8e87 Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.

All date/time functions has the STRING result type thus their results are
compared as strings. The string date representation allows a user to skip 
some of leading zeros. This can lead to wrong comparison result if a date/time 
function result is compared to such a string constant.

The idea behind this bug fix is to compare results of date/time functions
and data/time constants as ints, because that date/time representation is 
more exact. To achieve this the agg_cmp_type() is changed to take in the
account that a date/time field or an date/time item should be compared 
as ints.

This bug fix is partially back ported from 5.0.

The agg_cmp_type() function now accepts THD as one of parameters. 
In addition, it now checks if a date/time field/function is present in the
list. If so, it tries to coerce all constants to INT to make date/time
comparison return correct result. The field for the constant coercion is
taken from the Item_field or constructed from the Item_func. In latter case
the constructed field will be freed after conversion of all constant items.
Otherwise the result is same as before - aggregated with help of the
item_cmp_type() function.

From the Item_func_between::fix_length_and_dec() function removed the part
which was converting date/time constants to int if possible. Now this is 
done by the agg_cmp_type() function.

The new function result_as_longlong() is added to the Item class. 
It indicates that the item is a date/time item and result of it can be
compared as int. Such items are date/time fields/functions.

Correct val_int() methods are implemented for classes Item_date_typecast, 
Item_func_makedate, Item_time_typecast, Item_datetime_typecast. All these
classes are derived from Item_str_func and Item_str_func::val_int() converts
its string value to int without regard to the date/time type of these items.

Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
functions are changed to substitute result type of an item with the INT_RESULT
if the item is a date/time item and another item is a constant. This is done
to get a correct result of comparisons like date_time_function() = string_constant.


mysql-test/r/cast.result:
  Fixed wrong test case result after bug fix#16377.
sql/item_timefunc.h:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  The result_as_longlong() function is set to return TRUE for these classes:
  Item_date, Item_date_func, Item_func_curtime, Item_func_sec_to_time,
  Item_date_typecast, Item_time_typecast, Item_datetime_typecast,
  Item_func_makedate.
sql/item_timefunc.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.Correct val_int() methods are implemented for classes Item_date_typecast, 
  Item_func_makedate, Item_time_typecast, Item_datetime_typecast.
sql/item_cmpfunc.h:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
  functions are changed to substitute result type of an item with the INT_RESULT
  if the item is a date/time item and another item is a constant.
sql/field.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  Field::set_warning(), Field::set_datetime_warning() now use current_thd to get thd if table isn't set.
sql/item_cmpfunc.cc:
  Fixed bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
  The agg_cmp_type() function now accepts THD as one of parameters. 
  In addition, it now checks if a date/time field/function is present in the
  list. If so, it tries to coerce all constants to INT to make date/time
  comparison return correct result. The field for the constant coercion is
  taken from the Item_field or constructed from the Item_func. In latter case
  the constructed field will be freed after conversion of all constant items.
  Otherwise the result is same as before - aggregated with help of the
  item_cmp_type() function.
sql/item.h:
  The new function result_as_longlong() is added to the Item class. 
  It indicates that the item is a date/time item and result of it can be
  compared as int. Such items are date/time fields/functions.
mysql-test/t/func_time.test:
  Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
mysql-test/r/func_time.result:
  Added test case fot bug#16377: result of DATE/TIME functions were compared as strings which
  can lead to a wrong result.
2006-06-13 19:09:24 +04:00
unknown
ccad0572f5 Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-4.1-opt
2006-06-02 14:16:22 -07:00
unknown
e3e0658779 Fixed bug #18206.
The bug report revealed two problems related to min/max optimization:
1. If the length of a constant key used in a SARGable condition for
for the MIN/MAX fields is greater than the length of the field an 
unwanted warning on key truncation is issued;
2. If MIN/MAX optimization is applied to a partial index, like INDEX(b(4))
than can lead to returning a wrong result set.


mysql-test/r/func_group.result:
  Added test cases for bug #18206.
mysql-test/t/func_group.test:
  Added test cases for bug #18206.
sql/opt_sum.cc:
  Fixed bug #18206.
  Suppressed the warning about data truncation when store_val_in_field
  was used to store keys for the field used in MIN/MAX optimization.
  Blocked MIN/MAX optimization for partial keys, such as in INDEX(b(4)).
sql/sql_select.cc:
  Fixed bug #18206.
  Added a parameter for the function store_val_in_field allowing to
  control setting warnings about data truncation in the function.
sql/sql_select.h:
  Fixed bug #18206.
  Added a parameter for the function store_val_in_field allowing to
  control setting warnings about data truncation in the function.
2006-06-02 14:14:57 -07:00
unknown
3390eaa085 Bug #4981: 4.x and 5.x produce non-optimal execution path,
3.23 regression test failure

The member SEL_ARG::min_flag was not initialized, 
due to which the condition for no GEOM_FLAG in function 
key_or did not choose "Range checked for each record" as 
the correct access method.


mysql-test/r/select.result:
  testcase for 'Range checked' access method
mysql-test/t/select.test:
  testcase for 'Range checked' access method
sql/opt_range.cc:
  All of the class members initialized
2006-06-02 12:04:03 +03:00
unknown
a9824f263d Merge moonbone.local:/work/18630-bug-4.1-mysql
into moonbone.local:/work/18360-bug-4.1-mysql-opt
2006-05-30 18:57:08 +04:00
unknown
c007dabaf6 Fixed bug#18360: Incorrect type coercion in IN() results in false comparison
The IN() function uses agg_cmp_type() to aggregate all types of its arguments
to find out some common type for comparisons. In this particular case the 
char() and the int was aggregated to double because char() can contain values
like '1.5'. But all strings which do not start from a digit are converted to
0. thus 'a' and 'z' become equal. 
This behaviour is reasonable when all function arguments are constants. But 
when there is a field or an expression this can lead to false comparisons. In
this case it makes more sense to coerce constants to the type of the field
argument.

The agg_cmp_type() function now aggregates types of constant and non-constant
items separately. If some non-constant items will be found then their
aggregated type will be returned. Thus after the aggregation constants will be
coerced to the aggregated type. 


mysql-test/t/func_in.test:
  Added test case for bug#18360: Incorrect type coercion in IN() results in false comparison.
mysql-test/r/func_in.result:
  Added test case for bug#18360: Incorrect type coercion in IN() results in false comparison.
sql/item_cmpfunc.cc:
  Fixed bug#18360: Incorrect type coercion in IN() results in false comparison.
  The agg_cmp_type() function now aggregates types of constant and non-constant
  items separately. If some non-constant items will be found then their
  aggregated type will be returned. Thus after the aggregation constants will
  be coerced to the aggregated type.
2006-05-30 00:36:48 +04:00
unknown
2264b64473 Fixed bug#19225: unchecked error results in server crash
In multi-table delete a table for delete can't be used for selecting in
subselects. Appropriate error was raised but wasn't checked which leads to a
crash at the execution phase.

The mysql_execute_command() now checks for errors before executing select
for multi-delete.


mysql-test/t/multi_update.test:
  Added test case for bug#19225: unchecked error results in server crash
mysql-test/r/multi_update.result:
  Added test case for bug#19225: unchecked error results in server crash
sql/sql_parse.cc:
  Fixed bug#19225: unchecked error results in server crash
  The mysql_execute_command() now checks for errors before executing select for multi-delete.
2006-05-29 00:32:59 +04:00
unknown
c41b767a26 Fix for bug #18536: mysqldump does not maintain table orders as per --tables option
client/mysqldump.c:
  Fix for bug #18536: mysqldump does not maintain table orders as per --tables option
    - use list to store table names instead of hash.
mysql-test/r/mysqldump.result:
  Fix for bug #18536: mysqldump does not maintain table orders as per --tables option
    - test result.
mysql-test/t/mysqldump.test:
  Fix for bug #18536: mysqldump does not maintain table orders as per --tables option
    - test case.
2006-05-19 16:21:32 +05:00
unknown
c62cf51859 Merge poseidon.ndb.mysql.com:/home/tomas/mysql-4.1
into  poseidon.ndb.mysql.com:/home/tomas/mysql-4.1-main
2006-05-16 12:32:36 +02:00
unknown
e399658517 Bug #16875 , correction of previous patch 2006-05-15 17:16:21 +02:00
unknown
37f940ce86 Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
- invalidate ndb dict cache on cluster disconnect (ClusterMgr.cpp)
- add check for correct frm on external lock when table cache is found invalid


ndb/include/ndbapi/ndb_cluster_connection.hpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/ClusterMgr.cpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/ClusterMgr.hpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/DictCache.cpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/DictCache.hpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/TransporterFacade.hpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/ndb_cluster_connection.cpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
ndb/src/ndbapi/ndb_cluster_connection_impl.hpp:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
sql/ha_ndbcluster.cc:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
mysql-test/r/ndb_autodiscover3.result:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
mysql-test/t/ndb_autodiscover3.test:
  Bug #16875 Using stale MySQLD FRM files can cause restored cluster to fail
2006-05-15 16:23:59 +02:00
unknown
ee1a284416 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


mysql-test/r/rpl_temporary.result:
  Auto merged
mysql-test/t/rpl_temporary.test:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/mysql_priv.h:
  manual merge, a comment added
2006-05-12 21:38:41 +03:00
unknown
daebc0d63b Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/4.1-bug14157-utf8_binlog
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/4.1
2006-05-12 21:33:24 +03:00
unknown
c212cb25ed 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.


mysql-test/r/rpl_temporary.result:
  results changed
mysql-test/t/rpl_temporary.test:
  more correct internal table emulation; typo of @@session in bug#17263.
sql/mysql_priv.h:
  bool is_user_table(TABLE * table) 
  is added to answer wheather temporary table was created explicitly.
sql/sql_base.cc:
  Utilizing `append_identifier' to quote. `close_temporary_tables' once again recoded
  I hope to become much simplier than previously. No-binlog branch is separated completely the
  rest that adopts String's methods.
2006-05-12 21:29:06 +03:00
unknown
ec83dd7c61 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/home/mysql-4.1-10418
2006-05-11 12:48:49 +02:00
unknown
3f73225669 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/ram/work/4.1.b18501


sql/item_timefunc.cc:
  Auto merged
2006-05-10 13:27:48 +05:00
unknown
c23c38fa31 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.


mysql-test/r/drop_temp_table.result:
  results changed
mysql-test/r/mix_innodb_myisam_binlog.result:
  results changed
mysql-test/r/mysqlbinlog.result:
  results changed
mysql-test/r/rpl_temporary.result:
  results changed
mysql-test/t/mysqlbinlog.test:
  Check roll-forward recovery from binlog where there are DROP temporary tables created
  in koi8r.
mysql-test/t/rpl_temporary.test:
  Check slave digests binlog with DROP temporary tables created in koi8r.
sql/mysql_priv.h:
  `write_binlog_with_system_charset()' is added to be called when a binlog event
  is created "implicitly" like DROP temporary table is case of closing connection.
sql/sql_base.cc:
  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, not the client, who generates the query
  the binlog should be updated on server's encoding for the coming DROP.
2006-05-09 23:01:31 +03:00
unknown
dd934da915 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.


mysql-test/t/outfile.test:
  expect NULL rather than error if file given to load_file() doesn't exist
mysql-test/t/func_str.test:
  show that load_file() will return NULL rather than throw an error
  if file doesn't exist
mysql-test/r/outfile.result:
  expect NULL rather than error if file given to load_file() doesn't exist
mysql-test/r/func_str.result:
  expect NULL rather than error if file given to load_file() doesn't exist
sql/item_strfunc.cc:
  load_file() should return NULL as per the docs if file not found,
  rather than throw an error
2006-05-08 04:37:58 +02:00
unknown
e4e67d587e Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-4.1
into  rurik.mysql.com:/home/igor/mysql-4.1
2006-05-07 11:25:33 -07:00
unknown
ce6a2d32b3 Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/4.1-bug19136_unass_user_var


sql/item_func.cc:
  Auto merged
2006-05-07 11:43:27 +03:00
unknown
375749b8af Fixed bug #14927.
A query with a group by and having clauses could return a wrong
result set if the having condition contained a constant conjunct 
evaluated to FALSE.
It happened because the pushdown condition for table with
grouping columns lost its constant conjuncts.
Pushdown conditions are always built by the function make_cond_for_table
that ignores constant conjuncts. This is apparently not correct when
constant false conjuncts are present.



mysql-test/r/having.result:
  Added a test case for bug #14927.
mysql-test/t/having.test:
  Added a test case for bug #14927.
sql/sql_lex.cc:
  Fixed bug #14927.
  Initialized fields for having conditions in  st_select_lex::init_query().
sql/sql_lex.h:
  Fixed bug #14927.
  Added a field to restore having condititions for execution in SP and PS.
sql/sql_prepare.cc:
  Fixed bug #14927.
  Added code to restore havinf conditions for execution in SP and PS.
sql/sql_select.cc:
  Fixed bug #14927.
  Performed evaluation of constant expressions in having clauses.
  If the having condition contains a constant conjunct that is always false
  an empty result set is returned after the optimization phase.
  In this case the corresponding EXPLAIN command now returns 
  "Impossible HAVING" in the last column.
2006-05-06 23:48:13 -07:00
unknown
427bcfb440 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/psergey/mysql-4.1-bug16798
2006-05-06 22:15:27 +04:00
unknown
a60bd69777 Fix race condition in the test for bug#16501.
mysql-test/r/func_misc.result:
  Update the result.
2006-05-06 18:24:41 +04:00
unknown
447d5a0fac Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/psergey/mysql-4.1-bug16798
2006-05-06 13:48:20 +04:00
unknown
c13144722a BUG#16798: Inapplicable ref_or_null query plan and bad query result on random occasions
The bug was as follows: When merge_key_fields() encounters "t.key=X OR t.key=Y" it will 
try to join them into ref_or_null access via "t.key=X OR NULL". In order to make this 
inference it checks if Y<=>NULL, ignoring the fact that value of Y may be not yet known.

The fix is that the check if Y<=>NULL is made only if value of Y is known (i.e. it is a
constant).
TODO: When merging to 5.0, replace used_tables() with const_item() everywhere in merge_key_fields().


mysql-test/r/innodb_mysql.result:
  Testcase for BUG16798
mysql-test/t/innodb_mysql.test:
  Testcase for BUG16798
sql/sql_select.cc:
  BUG#16798: Inapplicable ref_or_null query plan and bad query result on random occasions 
  In merge_key_fields() don't call val->is_null() if the value of val is not known.
2006-05-06 13:15:00 +04:00
unknown
4ab4631b06 Bug#19136: Crashing log-bin and uninitialized user variables in a derived table
The reason of the bug is in that `get_var_with_binlog' performs missed
assingment of
the variables as side-effect. Doing that it eventually calls
`free_underlaid_joins' to pass as an argument `thd->lex->select_lex' of the lex
which belongs to the user query, not 
to one which is emulated i.e SET @var1:=NULL.


`get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.


mysql-test/r/rpl_user_variables.result:
  results changed
mysql-test/t/rpl_user_variables.test:
  a problematic query to be binlogged is added
sql/item_func.cc:
  BUG#19136: Crashing log-bin and uninitialized user variables
  
  The reason of the bug is in that how `get_var_with_binlog' performs missed
  assingment of the variables: `free_underlaid_joins' gets as an argument `thd->lex->select_lex'
  which belongs to the user query, not to one which is emulated i.e SET @var1:=NULL.
  
  `get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.
2006-05-05 11:21:21 +03:00
unknown
5f7fec791e Merge mysql.com:/home/tomash/src/mysql_ab/mysql-4.1
into  mysql.com:/home/tomash/src/mysql_ab/mysql-4.1-bug16501
2006-05-05 11:35:38 +04:00
unknown
02dcc76e37 Fixed Bug#11324:
TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column


mysql-test/r/date_formats.result:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
mysql-test/t/date_formats.test:
  Added test case for Bug#11324,
  "TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column"
2006-05-04 20:19:37 +03:00
unknown
bcb61e6860 Fix for Bug#11326.
mysql-test/r/date_formats.result:
  Added test cases for Bug#11326
mysql-test/t/date_formats.test:
  Added test cases for Bug#11326
2006-05-04 19:31:10 +03:00
unknown
144d2ec9ee Merge mysql.com:/home/tomash/src/mysql_ab/mysql-4.1
into  mysql.com:/home/tomash/src/mysql_ab/mysql-4.1-bug16501
2006-05-04 18:36:00 +04:00
unknown
ac94170069 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-4.1
into  hundin.mysql.fi:/home/jani/mysql-4.1


sql/sql_show.cc:
  Auto merged
2006-05-04 13:17:16 +03:00
unknown
a5a4f767b5 Merge mysql.com:/home/tomash/src/mysql_ab/mysql-4.1
into  mysql.com:/home/tomash/src/mysql_ab/mysql-4.1-bug16501
2006-05-04 11:25:48 +04:00
unknown
66d4b40cee Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/home/mysql-4.1-19025e
2006-05-04 09:06:27 +02:00
unknown
812a82edfa test result fixed
mysql-test/r/mysqltest.result:
  result fixed
2006-05-04 09:58:03 +05:00
unknown
d300ceea3f Bug#19025 4.1 mysqldump doesn't correctly dump "auto_increment = [int]"
mysqldump / SHOW CREATE TABLE will show the NEXT available value for
the PK, rather than the *first* one that was available (that named in
the original CREATE TABLE ... AUTO_INCREMENT = ... statement).

This should produce correct and robust behaviour for the obvious use
cases -- when no data were inserted, then we'll produce a statement
featuring the same value the original CREATE TABLE had; if we dump
with values, INSERTing the values on the target machine should set the
correct next_ID anyway (and if not, we'll still have our AUTO_INCREMENT =
... to do that). Lastly, just the CREATE statement (with no data) for
a table that saw inserts would still result in a table that new values
could safely be inserted to).

There seems to be no robust way however to see whether the next_ID
field is > 1 because it was set to something else with CREATE TABLE
... AUTO_INCREMENT = ..., or because there is an AUTO_INCREMENT column
in  the table (but no initial value was set with AUTO_INCREMENT = ...)
and then one or more rows were INSERTed, counting up next_ID. This
means that in both cases, we'll generate an AUTO_INCREMENT =
... clause in SHOW CREATE TABLE / mysqldump.  As we also show info on,
say, charsets even if the user did not explicitly give that info in
their own CREATE TABLE, this shouldn't be an issue.

As per above, the next_ID will be affected by any INSERTs that have
taken place, though.  This /should/ result in correct and robust
behaviour, but it may look non-intuitive to some users if they CREATE
TABLE ... AUTO_INCREMENT = 1000 and later (after some INSERTs) have
SHOW CREATE TABLE give them a different value (say, CREATE TABLE
... AUTO_INCREMENT = 1006), so the docs should possibly feature a
caveat to that effect.

It's not very intuitive the way it works now (with the fix), but it's
*correct*.  We're not storing the original value anyway, if we wanted
that, we'd have to change on-disk representation?

If we do dump/load cycles with empty DBs, nothing will change.  This
changeset includes an additional test case that proves that tables
with rows will create the same next_ID for AUTO_INCREMENT = ... across
dump/restore cycles.

Confirmed by support as likely solution for client's problem.


mysql-test/r/auto_increment.result:
  test for creation of AUTO_INCREMENT=... clause
mysql-test/r/gis-rtree.result:
  Add AUTO_INCREMENT=... clauses where appropriate
mysql-test/r/mysqldump.result:
  show that AUTO_INCREMENT=... will survive dump/restore cycles
mysql-test/r/symlink.result:
  Add AUTO_INCREMENT=... clauses where appropriate
mysql-test/t/auto_increment.test:
  test for creation of AUTO_INCREMENT=... clause
mysql-test/t/mysqldump.test:
  show that AUTO_INCREMENT=... will survive dump/restore cycles
sql/sql_show.cc:
  Add AUTO_INCREMENT=... to output of SHOW CREATE TABLE if there is an
  AUTO_INCREMENT column, and NEXT_ID > 1 (the default).  We must not print
  the clause for engines that do not support this as it would break the
  import of dumps, but as of this writing, the test for whether
  AUTO_INCREMENT columns are allowed and wether AUTO_INCREMENT=...
  is supported is identical, !(file->table_flags() & HA_NO_AUTO_INCREMENT))
  Because of that, we do not explicitly test for the feature,
  but may extrapolate its existence from that of an AUTO_INCREMENT column.
2006-05-04 03:12:51 +02:00
unknown
f0c693cc86 Merge bk@192.168.21.1:mysql-4.1
into mysql.com:/home/hf/work/mysql-4.1.mrg


mysql-test/mysql-test-run.pl:
  Auto merged
sql/sql_table.cc:
  Auto merged
2006-05-04 00:03:58 +05:00
unknown
050a9f3f3f Merge hf@192.168.21.28:work/mysql-4.1.16892
into mysql.com:/home/hf/work/mysql-4.1.mrg
2006-05-03 15:53:36 +05:00
unknown
bb95643f73 Merge mysql.com:/home/hf/work/mysql-4.1.15225
into mysql.com:/home/hf/work/mysql-4.1.mrg


sql/sql_table.cc:
  Auto merged
2006-05-03 15:51:19 +05:00
unknown
e93b203d08 ndb - bug#19201 (4.1), see comment in NdbBlob.cpp
ndb/test/ndbapi/testBlobs.cpp:
  option -fac (fetch across commit)
ndb/tools/delete_all.cpp:
  option --transactional (default remains truncate)
mysql-test/r/ndb_blob.result:
  bug#19201
mysql-test/t/ndb_blob.test:
  bug#19201
ndb/include/kernel/signaldata/TcKeyReq.hpp:
  bug#19201
ndb/include/ndbapi/NdbBlob.hpp:
  bug#19201
ndb/src/ndbapi/NdbBlob.cpp:
  bug#19201
2006-05-02 14:33:55 +02:00
unknown
09e83259fe Added tests for Bug#14515 2006-05-01 21:30:09 +03:00
unknown
dd68976a24 BUG#19145: mysqld crashes if you set the default value of an enum field to NULL
Now test for NULLness the pointers returned from objects created from the
default value. Pushing patch on behalf of cmiller.


mysql-test/r/null.result:
  Add test case
mysql-test/t/null.test:
  Add test case
sql/sql_table.cc:
  No longer blindly dereference pointer of the string representation of the
  values, where "NULL" is NUL. Raise INVALID DEFAULT error messages where
  appropriate.
  
  Note that the -O1 optimization flag made debugging this extremely tricky, with
  misleading results, and that removing it from the Makefile during debugging can
  be invaluable.
2006-04-28 12:15:29 -04:00
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
966658fa48 Merge aivanov@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/home/alexi/innodb/mysql-4.1-innodb
2006-04-26 12:39:47 +04:00
unknown
c2e6c898ac Make innodb_mysql produce a non-empty output.
mysql-test/r/innodb_mysql.result:
  Fix result.
2006-04-26 11:15:09 +04:00
unknown
a4c62dbb8a Files innodb.[test|result] are to be used by Innobase only.
Use files innodb_mysql.[test|result] instead.


mysql-test/t/innodb.test:
  This file is to be used by Innobase only.
mysql-test/r/innodb_mysql.result:
  New BitKeeper file ``mysql-test/r/innodb_mysql.result''
   Use this file instead of innodb.result.
mysql-test/t/innodb_mysql.test:
  New BitKeeper file ``mysql-test/t/innodb_mysql.test''
   Use this file instead of innodb.test.
2006-04-26 09:51:57 +04:00
unknown
3ca1852cba Fix for bug #18501: Server crashes with monthname().
mysql-test/r/func_time.result:
  Fix for bug #18501: Server crashes with monthname().
    - test case
mysql-test/t/func_time.test:
  Fix for bug #18501: Server crashes with monthname().
    - test case
sql/item_timefunc.cc:
  Fix for bug #18501: Server crashes with monthname().
    - check null_value as well.
2006-04-25 14:34:19 +05:00
unknown
9fc25141a2 Bug#16501: IS_USED_LOCK does not appear to work
Update User_level_lock::thread_id on acquiring an existing lock,
and reset it on lock release.


mysql-test/r/func_misc.result:
  Add result for bug#16501.
mysql-test/t/func_misc.test:
  Add test case for bug#16501.
sql/item_func.cc:
  Update User_level_lock::thread_id on acquiring an existing lock,
  and reset it on lock release (for safety).
2006-04-24 18:06:43 +04:00
unknown
9a7a78f700 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  production.mysql.com:/usersnfs/rkalimullin/4.1.b17896
2006-04-24 08:01:10 +02:00
unknown
329ebbd14d Bug#17263 temporary tables and replication
Backporting a changeset made for 5.0. Comments from there:

  The fix refines the algorithm of generating DROPs for binlog.
  Temp tables with common pseudo_thread_id are clustered into one query.
  Consequently one replication event per pseudo_thread_id is generated.




mysql-test/r/rpl_temporary.result:
  results changed
mysql-test/t/rpl_temporary.test:
  test to generate problematic drop in binlog to feed it to restarting slave
  to see no stop.
sql/sql_base.cc:
  change in drop temprorary tables alg in close_temporary_tables.
2006-04-23 12:18:57 +03:00