Commit 8023bda5 authored by unknown's avatar unknown

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/Users/kent/mysql/bk/mysql-4.1

parents 133ea93b 5a9dc44d
......@@ -1838,9 +1838,10 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
_mi_kpointer(info,keypos-nod_flag,param->new_file_pos); /* Save new pos */
if (sort_one_index(param,info,keyinfo,next_page,new_file))
{
DBUG_PRINT("error",("From page: %ld, keyoffset: %d used_length: %d",
(ulong) pagepos, (int) (keypos - buff),
(int) used_length));
DBUG_PRINT("error",
("From page: %ld, keyoffset: 0x%lx used_length: %d",
(ulong) pagepos, (ulong) (keypos - buff),
(int) used_length));
DBUG_DUMP("buff",(byte*) buff,used_length);
goto err;
}
......
......@@ -390,7 +390,8 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
MYISAM_SHARE *share=info->s;
MI_KEY_PARAM s_temp;
DBUG_ENTER("del");
DBUG_PRINT("enter",("leaf_page: %ld keypos: %lx",leaf_page,keypos));
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx", leaf_page,
(ulong) keypos));
DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
endpos=leaf_buff+mi_getint(leaf_buff);
......@@ -495,7 +496,8 @@ static int underflow(register MI_INFO *info, register MI_KEYDEF *keyinfo,
MI_KEY_PARAM s_temp;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("underflow");
DBUG_PRINT("enter",("leaf_page: %ld keypos: %lx",(long) leaf_page,keypos));
DBUG_PRINT("enter",("leaf_page: %ld keypos: 0x%lx",(long) leaf_page,
(ulong) keypos));
DBUG_DUMP("anc_buff",(byte*) anc_buff,mi_getint(anc_buff));
DBUG_DUMP("leaf_buff",(byte*) leaf_buff,mi_getint(leaf_buff));
......
......@@ -456,3 +456,11 @@ f1 f2
Warnings:
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
create table t1 (f1 datetime);
insert into t1 (f1) values ("2005-01-01");
insert into t1 (f1) values ("2005-02-01");
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
d1 d2
02 February
01 January
drop table t1;
......@@ -678,3 +678,11 @@ f1
2001
2002
drop table t1;
create table t1(x int, y int);
create table t2(x int, z int);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
ERROR 42S22: Unknown column 'z' in 'field list'
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
ERROR 42S02: Unknown table 't2' in field list
drop table t1,t2;
......@@ -260,4 +260,12 @@ select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
--enable_ps_protocol
#
# Bug #14016
#
create table t1 (f1 datetime);
insert into t1 (f1) values ("2005-01-01");
insert into t1 (f1) values ("2005-02-01");
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
drop table t1;
# End of 4.1 tests
......@@ -214,4 +214,16 @@ insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
select * from t1;
drop table t1;
#
# Bug #13392 values() fails with 'ambiguous' or returns NULL
# with ON DUPLICATE and SELECT
create table t1(x int, y int);
create table t2(x int, z int);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
--error 1054
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
--error 1109
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
drop table t1,t2;
# End of 4.1 tests
......@@ -6,7 +6,7 @@
# var/log/mysql_client_test.trace
--disable_result_log
--exec echo $MYSQL_CLIENT_TEST
--exec $MYSQL_CLIENT_TEST
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests
......@@ -689,10 +689,10 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err)
ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L);
num= eval_num_suffix(arg, err, (char*) optp->name);
if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value &&
if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value &&
optp->max_value) /* if max value is not set -> no upper limit */
num= (longlong) (ulong) optp->max_value;
num= ((num - (longlong) optp->sub_size) / block_size);
num= (ulonglong) optp->max_value;
num= ((num - optp->sub_size) / block_size);
num= (longlong) (num * block_size);
return max(num, optp->min_value);
}
......
......@@ -2796,8 +2796,14 @@ bool Item_insert_value::fix_fields(THD *thd,
Item **items)
{
DBUG_ASSERT(fixed == 0);
st_table_list *orig_next_table= table_list->next;
table_list->next= 0;
if (!arg->fixed && arg->fix_fields(thd, table_list, &arg))
{
table_list->next= orig_next_table;
return 1;
}
table_list->next= orig_next_table;
if (arg->type() == REF_ITEM)
{
......@@ -2809,6 +2815,7 @@ bool Item_insert_value::fix_fields(THD *thd,
arg= ref->ref[0];
}
Item_field *field_arg= (Item_field *)arg;
if (field_arg->field->table->insert_values)
{
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
......
......@@ -1528,6 +1528,16 @@ void Item_func_date_format::fix_length_and_dec()
if (args[1]->type() == STRING_ITEM)
{ // Optimize the normal case
fixed_length=1;
/*
Force case sensitive collation on format string.
This needed because format modifiers with different case,
for example %m and %M, have different meaning. Thus eq()
will distinguish them.
*/
args[1]->collation.set(
get_charset_by_csname(args[1]->collation.collation->csname,
MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
/*
The result is a binary string (no reason to use collation->mbmaxlen
This is becasue make_date_time() only returns binary strings
......
......@@ -51,6 +51,8 @@ static unsigned int iter_count= 0;
static const char *opt_basedir= "./";
static longlong opt_getopt_ll_test= 0;
static int embedded_server_arg_count= 0;
static char *embedded_server_args[MAX_SERVER_ARGS];
......@@ -11738,6 +11740,19 @@ static void test_bug11718()
rc= mysql_query(mysql, "drop table t1, t2");
myquery(rc);
}
/*
Bug #12925: Bad handling of maximum values in getopt
*/
static void test_bug12925()
{
myheader("test_bug12925");
if (opt_getopt_ll_test)
DIE_UNLESS(opt_getopt_ll_test == LL(25600*1024*1024));
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
......@@ -11780,6 +11795,9 @@ static struct my_option client_test_long_options[] =
{"user", 'u', "User for login if not current user", (char **) &opt_user,
(char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"getopt-ll-test", 'g', "Option for testing bug in getopt library",
(char **) &opt_getopt_ll_test, (char **) &opt_getopt_ll_test, 0,
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
......@@ -11955,6 +11973,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug11183", test_bug11183 },
{ "test_bug12001", test_bug12001 },
{ "test_bug11718", test_bug11718 },
{ "test_bug12925", test_bug12925 },
{ 0, 0 }
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment