Commit c533e477 authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

auto-merge

parents e34085fe 6010bd18
......@@ -3122,7 +3122,7 @@ static my_bool dump_all_views_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)); )
{
char *end= strmov(afterdot, table);
if (include_table((uchar*) hash_key,end - hash_key))
if (include_table(hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
......@@ -3143,7 +3143,7 @@ static my_bool dump_all_views_in_db(char *database)
while ((table= getTableName(0)))
{
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);
}
if (opt_xml)
......
......@@ -1340,17 +1340,19 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
not present.
*/
int diff_check()
int diff_check(const char *diff_name)
{
char buf[512]= {0};
FILE *res_file;
const char *cmd = "diff -v";
char cmd[128];
my_snprintf (cmd, sizeof(cmd), "%s -v", diff_name);
int have_diff = 0;
if (!(res_file= popen(cmd, "r")))
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))
{
have_diff += 1;
......@@ -1377,7 +1379,7 @@ void show_diff(DYNAMIC_STRING* ds,
{
DYNAMIC_STRING ds_tmp;
int have_diff = 0;
const char *diff_name = 0;
if (init_dynamic_string(&ds_tmp, "", 256, 256))
die("Out of memory");
......@@ -1390,15 +1392,20 @@ void show_diff(DYNAMIC_STRING* ds,
the way it's implemented does not work with default 'diff' on Solaris.
*/
#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
have_diff = 1;
diff_name = "diff"; // Otherwise always assume it's called diff
#endif
if (have_diff)
if (diff_name)
{
/* First try with unified diff */
if (run_tool("diff",
if (run_tool(diff_name,
&ds_tmp, /* Get output from diff in ds_tmp */
"-u",
filename1,
......@@ -1409,7 +1416,7 @@ void show_diff(DYNAMIC_STRING* ds,
dynstr_set(&ds_tmp, "");
/* 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 */
"-c",
filename1,
......@@ -1417,12 +1424,12 @@ void show_diff(DYNAMIC_STRING* ds,
"2>&1",
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
......@@ -1432,16 +1439,16 @@ if (!(have_diff))
dynstr_set(&ds_tmp, "");
dynstr_append(&ds_tmp,
"\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"
"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"
"for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n"
"\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"
"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"
"for example can get from http://www.gnu.org/software/diffutils/diffutils.html\n"
#ifdef __WIN__
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
#endif
"\n");
"\n");
dynstr_append(&ds_tmp, " --- ");
dynstr_append(&ds_tmp, filename1);
......
......@@ -701,7 +701,7 @@ rl_function_of_keyseq (keyseq, map, type)
{
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)
{
......
......@@ -59,7 +59,8 @@
#define largest_char 255 /* Largest character value. */
#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 META(c) ((c) | meta_character_bit)
......
......@@ -1888,7 +1888,7 @@ rl_character_len (c, pos)
uc = (unsigned char)c;
if (META_CHAR (uc))
if (META_BYTE (uc))
return ((_rl_output_meta_chars == 0) ? 4 : 1);
if (uc == '\t')
......
......@@ -32,6 +32,7 @@
.\" === Set line length
.\".ll 6.5i
.TL
.warn 0
D B U G
.P 0
C Program Debugging Package
......
......@@ -1303,4 +1303,16 @@ t1 CREATE TABLE `t1` (
CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
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
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|
drop procedure ip|
show procedure status like '%p%'|
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|
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
......
......@@ -1063,4 +1063,14 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NUL
SHOW CREATE 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
# 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|
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
#
......
......@@ -409,6 +409,7 @@ Item::Item(THD *thd, Item *item):
name(item->name),
orig_name(item->orig_name),
max_length(item->max_length),
name_length(item->name_length),
marker(item->marker),
decimals(item->decimals),
maybe_null(item->maybe_null),
......@@ -416,7 +417,9 @@ Item::Item(THD *thd, Item *item):
unsigned_flag(item->unsigned_flag),
with_sum_func(item->with_sum_func),
fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
collation(item->collation),
with_subselect(item->with_subselect),
cmp_context(item->cmp_context)
{
next= thd->free_list; // Put in free list
......
......@@ -327,7 +327,10 @@ my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
{
my_wc_t wc;
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)
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