Commit 57c253bc authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

auto-merge

parents b89d2fce b311cb83
...@@ -3122,7 +3122,7 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -3122,7 +3122,7 @@ static my_bool dump_all_views_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)); ) for (numrows= 0 ; (table= getTableName(1)); )
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key,end - hash_key)) if (include_table(hash_key,end - hash_key))
{ {
numrows++; numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
...@@ -3143,7 +3143,7 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -3143,7 +3143,7 @@ static my_bool dump_all_views_in_db(char *database)
while ((table= getTableName(0))) while ((table= getTableName(0)))
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key, end - hash_key)) if (include_table(hash_key, end - hash_key))
get_view_structure(table, database); get_view_structure(table, database);
} }
if (opt_xml) if (opt_xml)
......
...@@ -1340,23 +1340,25 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...) ...@@ -1340,23 +1340,25 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
not present. not present.
*/ */
int diff_check() int diff_check(const char *diff_name)
{ {
char buf[512]= {0}; char buf[512]= {0};
FILE *res_file; FILE *res_file;
const char *cmd = "diff -v"; char cmd[128];
int have_diff = 0; my_snprintf (cmd, sizeof(cmd), "%s -v", diff_name);
int have_diff = 0;
if (!(res_file= popen(cmd, "r"))) if (!(res_file= popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd); die("popen(\"%s\", \"r\") failed", cmd);
/* if diff is not present, nothing will be in stdout to increment have_diff */ /* if diff is not present, nothing will be in
* stdout to increment have_diff */
if (fgets(buf, sizeof(buf), res_file)) if (fgets(buf, sizeof(buf), res_file))
{ {
have_diff += 1; have_diff += 1;
} }
pclose(res_file); pclose(res_file);
return have_diff; return have_diff;
} }
/* /*
...@@ -1377,28 +1379,33 @@ void show_diff(DYNAMIC_STRING* ds, ...@@ -1377,28 +1379,33 @@ void show_diff(DYNAMIC_STRING* ds,
{ {
DYNAMIC_STRING ds_tmp; DYNAMIC_STRING ds_tmp;
int have_diff = 0; const char *diff_name = 0;
if (init_dynamic_string(&ds_tmp, "", 256, 256)) if (init_dynamic_string(&ds_tmp, "", 256, 256))
die("Out of memory"); die("Out of memory");
/* determine if we have diff on Windows /* determine if we have diff on Windows
needs special processing due to return values needs special processing due to return values
on that OS on that OS
This test is only done on Windows since it's only needed there This test is only done on Windows since it's only needed there
in order to correctly detect non-availibility of 'diff', and in order to correctly detect non-availibility of 'diff', and
the way it's implemented does not work with default 'diff' on Solaris. the way it's implemented does not work with default 'diff' on Solaris.
*/ */
#ifdef __WIN__ #ifdef __WIN__
have_diff = diff_check(); if (diff_check("diff"))
diff_name = "diff";
else if (diff_check("mtrdiff"))
diff_name = "mtrdiff";
else
diff_name = 0;
#else #else
have_diff = 1; diff_name = "diff"; // Otherwise always assume it's called diff
#endif #endif
if (have_diff) if (diff_name)
{ {
/* First try with unified diff */ /* First try with unified diff */
if (run_tool("diff", if (run_tool(diff_name,
&ds_tmp, /* Get output from diff in ds_tmp */ &ds_tmp, /* Get output from diff in ds_tmp */
"-u", "-u",
filename1, filename1,
...@@ -1409,7 +1416,7 @@ void show_diff(DYNAMIC_STRING* ds, ...@@ -1409,7 +1416,7 @@ void show_diff(DYNAMIC_STRING* ds,
dynstr_set(&ds_tmp, ""); dynstr_set(&ds_tmp, "");
/* Fallback to context diff with "diff -c" */ /* Fallback to context diff with "diff -c" */
if (run_tool("diff", if (run_tool(diff_name,
&ds_tmp, /* Get output from diff in ds_tmp */ &ds_tmp, /* Get output from diff in ds_tmp */
"-c", "-c",
filename1, filename1,
...@@ -1417,42 +1424,42 @@ void show_diff(DYNAMIC_STRING* ds, ...@@ -1417,42 +1424,42 @@ void show_diff(DYNAMIC_STRING* ds,
"2>&1", "2>&1",
NULL) > 1) /* Most "diff" tools return >1 if error */ NULL) > 1) /* Most "diff" tools return >1 if error */
{ {
have_diff= 0; diff_name= 0;
} }
} }
} }
if (!(have_diff)) if (!(diff_name))
{ {
/* /*
Fallback to dump both files to result file and inform Fallback to dump both files to result file and inform
about installing "diff" about installing "diff"
*/ */
dynstr_set(&ds_tmp, ""); dynstr_set(&ds_tmp, "");
dynstr_append(&ds_tmp, dynstr_append(&ds_tmp,
"\n" "\n"
"The two files differ but it was not possible to execute 'diff' in\n" "The two files differ but it was not possible to execute 'diff' in\n"
"order to show only the difference, tried both 'diff -u' or 'diff -c'.\n" "order to show only the difference, tried both 'diff -u' or 'diff -c'.\n"
"Instead the whole content of the two files was shown for you to diff manually. ;)\n\n" "Instead the whole content of the two files was shown for you to diff manually. ;)\n\n"
"To get a better report you should install 'diff' on your system, which you\n" "To get a better report you should install 'diff' on your system, which you\n"
"for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n" "for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n"
#ifdef __WIN__ #ifdef __WIN__
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n" "or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
#endif #endif
"\n"); "\n");
dynstr_append(&ds_tmp, " --- "); dynstr_append(&ds_tmp, " --- ");
dynstr_append(&ds_tmp, filename1); dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n"); dynstr_append(&ds_tmp, " >>>\n");
cat_file(&ds_tmp, filename1); cat_file(&ds_tmp, filename1);
dynstr_append(&ds_tmp, "<<<\n --- "); dynstr_append(&ds_tmp, "<<<\n --- ");
dynstr_append(&ds_tmp, filename1); dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n"); dynstr_append(&ds_tmp, " >>>\n");
cat_file(&ds_tmp, filename2); cat_file(&ds_tmp, filename2);
dynstr_append(&ds_tmp, "<<<<\n"); dynstr_append(&ds_tmp, "<<<<\n");
} }
if (ds) if (ds)
{ {
...@@ -1464,7 +1471,7 @@ if (!(have_diff)) ...@@ -1464,7 +1471,7 @@ if (!(have_diff))
/* Print diff directly to stdout */ /* Print diff directly to stdout */
fprintf(stderr, "%s\n", ds_tmp.str); fprintf(stderr, "%s\n", ds_tmp.str);
} }
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
} }
......
...@@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type) ...@@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type)
{ {
unsigned char ic = keyseq[i]; unsigned char ic = keyseq[i];
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii) if (META_BYTE (ic) && _rl_convert_meta_chars_to_ascii)
{ {
if (map[ESC].type == ISKMAP) if (map[ESC].type == ISKMAP)
{ {
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
#define largest_char 255 /* Largest character value. */ #define largest_char 255 /* Largest character value. */
#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) #define META_BYTE(c) ((c) > meta_character_threshold)
#define META_CHAR(c) (META_BYTE(c) && (c) <= largest_char)
#define CTRL(c) ((c) & control_character_mask) #define CTRL(c) ((c) & control_character_mask)
#define META(c) ((c) | meta_character_bit) #define META(c) ((c) | meta_character_bit)
......
...@@ -1888,7 +1888,7 @@ rl_character_len (c, pos) ...@@ -1888,7 +1888,7 @@ rl_character_len (c, pos)
uc = (unsigned char)c; uc = (unsigned char)c;
if (META_CHAR (uc)) if (META_BYTE (uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1); return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t') if (uc == '\t')
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
.\" === Set line length .\" === Set line length
.\".ll 6.5i .\".ll 6.5i
.TL .TL
.warn 0
D B U G D B U G
.P 0 .P 0
C Program Debugging Package C Program Debugging Package
......
...@@ -1303,4 +1303,16 @@ t1 CREATE TABLE `t1` ( ...@@ -1303,4 +1303,16 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #36995: valgrind error in remove_const during subquery executions
#
create table t1 (a bit(1) not null,b int) engine=myisam;
create table t2 (c int) engine=innodb;
explain
select b from t1 where a not in (select b from t1,t2 group by a) group by a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1
DROP TABLE t1,t2;
End of 5.0 tests End of 5.0 tests
drop table if exists t3;
create table t3 ( f bigint unsigned not null );
drop procedure if exists fib;
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from t3 order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into t3 values (x+y);
call fib(n-1);
end;
end if;
end|
set @@max_sp_recursion_depth= 20|
insert into t3 values (0), (1)|
call fib(3)|
select * from t3 order by f asc|
f
0
1
1
2
delete from t3|
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
f
0
1
1
2
3
5
8
13
21
34
55
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
...@@ -1337,52 +1337,6 @@ drop procedure opp| ...@@ -1337,52 +1337,6 @@ drop procedure opp|
drop procedure ip| drop procedure ip|
show procedure status like '%p%'| show procedure status like '%p%'|
Db Name Type Definer Modified Created Security_type Comment Db Name Type Definer Modified Created Security_type Comment
drop table if exists t3|
create table t3 ( f bigint unsigned not null )|
drop procedure if exists fib|
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from t3 order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into t3 values (x+y);
call fib(n-1);
end;
end if;
end|
set @@max_sp_recursion_depth= 20|
insert into t3 values (0), (1)|
call fib(3)|
select * from t3 order by f asc|
f
0
1
1
2
delete from t3|
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
f
0
1
1
2
3
5
8
13
21
34
55
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
drop procedure if exists bar| drop procedure if exists bar|
create procedure bar(x char(16), y int) create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker comment "111111111111" sql security invoker
......
...@@ -1063,4 +1063,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL ...@@ -1063,4 +1063,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #36995: valgrind error in remove_const during subquery executions
--echo #
create table t1 (a bit(1) not null,b int) engine=myisam;
create table t2 (c int) engine=innodb;
explain
select b from t1 where a not in (select b from t1,t2 group by a) group by a;
DROP TABLE t1,t2;
--echo End of 5.0 tests --echo End of 5.0 tests
# Fibonacci, for recursion test. (Yet Another Numerical series :)
# Split from main.sp due to problems reported in Bug#15866
--disable_warnings
drop table if exists t3;
--enable_warnings
create table t3 ( f bigint unsigned not null );
# We deliberately do it the awkward way, fetching the last two
# values from the table, in order to exercise various statements
# and table accesses at each turn.
--disable_warnings
drop procedure if exists fib;
--enable_warnings
# Now for multiple statements...
delimiter |;
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from t3 order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into t3 values (x+y);
call fib(n-1);
end;
end if;
end|
# Enable recursion
set @@max_sp_recursion_depth= 20|
# Minimum test: recursion of 3 levels
insert into t3 values (0), (1)|
call fib(3)|
select * from t3 order by f asc|
delete from t3|
# The original test, 20 levels, ran into memory limits on some machines
# and builds. Try 10 instead...
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
...@@ -1560,61 +1560,6 @@ drop procedure ip| ...@@ -1560,61 +1560,6 @@ drop procedure ip|
show procedure status like '%p%'| show procedure status like '%p%'|
# Fibonacci, for recursion test. (Yet Another Numerical series :)
#
--disable_warnings
drop table if exists t3|
--enable_warnings
create table t3 ( f bigint unsigned not null )|
# We deliberately do it the awkward way, fetching the last two
# values from the table, in order to exercise various statements
# and table accesses at each turn.
--disable_warnings
drop procedure if exists fib|
--enable_warnings
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from t3 order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into t3 values (x+y);
call fib(n-1);
end;
end if;
end|
# Enable recursion
set @@max_sp_recursion_depth= 20|
# Minimum test: recursion of 3 levels
insert into t3 values (0), (1)|
call fib(3)|
select * from t3 order by f asc|
delete from t3|
# The original test, 20 levels, ran into memory limits on some machines
# and builds. Try 10 instead...
insert into t3 values (0), (1)|
call fib(10)|
select * from t3 order by f asc|
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
# #
# Comment & suid # Comment & suid
# #
......
...@@ -409,6 +409,7 @@ Item::Item(THD *thd, Item *item): ...@@ -409,6 +409,7 @@ Item::Item(THD *thd, Item *item):
name(item->name), name(item->name),
orig_name(item->orig_name), orig_name(item->orig_name),
max_length(item->max_length), max_length(item->max_length),
name_length(item->name_length),
marker(item->marker), marker(item->marker),
decimals(item->decimals), decimals(item->decimals),
maybe_null(item->maybe_null), maybe_null(item->maybe_null),
...@@ -416,7 +417,9 @@ Item::Item(THD *thd, Item *item): ...@@ -416,7 +417,9 @@ Item::Item(THD *thd, Item *item):
unsigned_flag(item->unsigned_flag), unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func), with_sum_func(item->with_sum_func),
fixed(item->fixed), fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
collation(item->collation), collation(item->collation),
with_subselect(item->with_subselect),
cmp_context(item->cmp_context) cmp_context(item->cmp_context)
{ {
next= thd->free_list; // Put in free list next= thd->free_list; // Put in free list
......
...@@ -327,7 +327,10 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length) ...@@ -327,7 +327,10 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
{ {
my_wc_t wc; my_wc_t wc;
int chlen; int chlen;
for (; (chlen= cs->cset->mb_wc(cs, &wc, str, strend)) > 0; str+= chlen) for (; (chlen= cs->cset->mb_wc(cs, &wc,
(const unsigned char *) str,
(const unsigned char *) strend)) > 0;
str+= chlen)
{ {
if (wc > 0x7F) if (wc > 0x7F)
return MY_REPERTOIRE_UNICODE30; return MY_REPERTOIRE_UNICODE30;
......
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