Commit acc769f5 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0

into  eel.(none):/home/jonas/src/mysql-5.0-push

parents a34a9d73 838d8ed1
......@@ -38,7 +38,7 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid # innochecksum
resolve_stack_dump mysql_waitpid innochecksum
noinst_PROGRAMS = charset2html
# Don't update the files from bitkeeper
......
......@@ -140,10 +140,11 @@ int main(int argc, char **argv) {
int now; // current time
int lastt; // last time
ulint oldcsum, oldcsumfield, csum, csumfield, logseq, logseqfield; // ulints for checksum storage
struct stat64 st; // for stat, if you couldn't guess
struct stat st; // for stat, if you couldn't guess
unsigned long long int size; // size of file (has to be 64 bits)
ulint pages; // number of pages in file
ulint start_page = 0, end_page = 0, use_end_page = 0; // for starting and ending at certain pages
off_t offset = 0;
int just_count = 0; // if true, just print page count
int verbose = 0;
int debug = 0;
......@@ -202,7 +203,7 @@ int main(int argc, char **argv) {
}
// stat the file to get size and page count
if (stat64(argv[optind], &st)) {
if (stat(argv[optind], &st)) {
perror("error statting file");
return 1;
}
......@@ -217,7 +218,7 @@ int main(int argc, char **argv) {
}
// open the file for reading
f = fopen64(argv[optind], "r");
f = fopen(argv[optind], "r");
if (!f) {
perror("error opening file");
return 1;
......@@ -230,7 +231,10 @@ int main(int argc, char **argv) {
perror("unable to obtain file descriptor number");
return 1;
}
if (lseek64(fd, start_page * UNIV_PAGE_SIZE, SEEK_SET) != (start_page * UNIV_PAGE_SIZE)) {
offset = (off_t)start_page * (off_t)UNIV_PAGE_SIZE;
if (lseek(fd, offset, SEEK_SET) != offset) {
perror("unable to seek to necessary offset");
return 1;
}
......
......@@ -109,3 +109,9 @@ select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.302500000 ENUM('1.1','2.2') NOT NULL
drop table t1;
create table t1 (d double);
insert into t1 values (100000);
select * from t1 procedure analyse (1,1);
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.d 100000 100000 6 6 0 0 100000 0 MEDIUMINT(6) UNSIGNED NOT NULL
drop table t1;
......@@ -2912,3 +2912,13 @@ ERROR 23000: Column 'id' in from clause is ambiguous
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
ERROR 23000: Column 'id' in from clause is ambiguous
drop table t1, t2, t3;
create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10));
insert into t1 values (1,10),(2,20),(3,30);
insert into t2 values (1,10);
select * from t1 inner join t2 using (A);
a b b
1 10 10
select * from t1 inner join t2 using (a);
a b b
1 10 10
......@@ -48,8 +48,6 @@ insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),(
select * from t1 procedure analyse();
drop table t1;
# End of 4.1 tests
#decimal-related test
create table t1 (df decimal(5,1));
......@@ -57,3 +55,15 @@ insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
drop table t1;
#
# Bug#10716 - Procedure Analyse results in wrong values for optimal field type
#
create table t1 (d double);
insert into t1 values (100000);
select * from t1 procedure analyse (1,1);
drop table t1;
# End of 4.1 tests
......@@ -2487,3 +2487,15 @@ SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
drop table t1, t2, t3;
#
# Bug #13067 JOIN xxx USING is case sensitive
#
create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10));
insert into t1 values (1,10),(2,20),(3,30);
insert into t2 values (1,10);
# both queries should produce the same result
select * from t1 inner join t2 using (A);
select * from t1 inner join t2 using (a);
......@@ -6618,12 +6618,23 @@ void ndb_serialize_cond(const Item *item, void *arg)
case Item_func::BETWEEN:
{
DBUG_PRINT("info", ("BETWEEN, rewriting using AND"));
Item_func_between *between_func= (Item_func_between *) func_item;
Ndb_rewrite_context *rewrite_context=
new Ndb_rewrite_context(func_item);
rewrite_context->next= context->rewrite_stack;
context->rewrite_stack= rewrite_context;
if (between_func->negated)
{
DBUG_PRINT("info", ("NOT_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::NOT_FUNC, 1);
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
}
DBUG_PRINT("info", ("COND_AND_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::COND_AND_FUNC,
curr_cond->ndb_item=
new Ndb_item(Item_func::COND_AND_FUNC,
func_item->argument_count() - 1);
context->expect_only(Item::FIELD_ITEM);
context->expect(Item::INT_ITEM);
......@@ -6635,10 +6646,20 @@ void ndb_serialize_cond(const Item *item, void *arg)
case Item_func::IN_FUNC:
{
DBUG_PRINT("info", ("IN_FUNC, rewriting using OR"));
Item_func_in *in_func= (Item_func_in *) func_item;
Ndb_rewrite_context *rewrite_context=
new Ndb_rewrite_context(func_item);
rewrite_context->next= context->rewrite_stack;
context->rewrite_stack= rewrite_context;
if (in_func->negated)
{
DBUG_PRINT("info", ("NOT_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::NOT_FUNC, 1);
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
}
DBUG_PRINT("info", ("COND_OR_FUNC"));
curr_cond->ndb_item= new Ndb_item(Item_func::COND_OR_FUNC,
func_item->argument_count() - 1);
......@@ -6960,6 +6981,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT("info", ("End of condition group"));
prev_cond= curr_cond;
curr_cond= context->cond_ptr= new Ndb_cond();
curr_cond->prev= prev_cond;
prev_cond->next= curr_cond;
curr_cond->ndb_item= new Ndb_item(NDB_END_COND);
// Pop rewrite stack
......
......@@ -880,18 +880,23 @@ void field_real::get_opt_type(String *answer,
if (!max_notzero_dec_len)
{
if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127))
sprintf(buff, "TINYINT(%d)", (int) max_length - (item->decimals + 1));
sprintf(buff, "TINYINT(%d)", (int) max_length -
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ?
UINT_MAX16 : INT_MAX16))
sprintf(buff, "SMALLINT(%d)", (int) max_length - (item->decimals + 1));
sprintf(buff, "SMALLINT(%d)", (int) max_length -
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ?
UINT_MAX24 : INT_MAX24))
sprintf(buff, "MEDIUMINT(%d)", (int) max_length - (item->decimals + 1));
sprintf(buff, "MEDIUMINT(%d)", (int) max_length -
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ?
UINT_MAX32 : INT_MAX32))
sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1));
sprintf(buff, "INT(%d)", (int) max_length -
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
else
sprintf(buff, "BIGINT(%d)", (int) max_length - (item->decimals + 1));
sprintf(buff, "BIGINT(%d)", (int) max_length -
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
answer->append(buff, (uint) strlen(buff));
if (min_arg >= 0)
answer->append(" UNSIGNED");
......
......@@ -3414,7 +3414,7 @@ test_if_string_in_list(const char *find, List<String> *str_list)
{
if (find_length != curr_str->length())
continue;
if (!strncmp(find, curr_str->ptr(), find_length))
if (!my_strcasecmp(system_charset_info, find, curr_str->ptr()))
return TRUE;
}
return FALSE;
......
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