Commit 712ea880 authored by unknown's avatar unknown

Merge gweir@bk-internal.mysql.com:/home/bk/mysql-4.0

into mysql.com:/home/greg/bk/mysql-4.0

parents 40c367b3 3d6dcd65
...@@ -30,6 +30,7 @@ chomp ($LOGFILE= `pwd`); ...@@ -30,6 +30,7 @@ chomp ($LOGFILE= `pwd`);
$LOGFILE.= "/Bootstrap.log"; $LOGFILE.= "/Bootstrap.log";
chomp ($opt_directory= `pwd`); chomp ($opt_directory= `pwd`);
$opt_docdir= $opt_directory . "/mysqldoc"; $opt_docdir= $opt_directory . "/mysqldoc";
$opt_build_command= undef;
$opt_changelog= undef; $opt_changelog= undef;
$opt_delete= undef; $opt_delete= undef;
$opt_dry_run= undef; $opt_dry_run= undef;
...@@ -44,6 +45,7 @@ $opt_skip_manual= undef; ...@@ -44,6 +45,7 @@ $opt_skip_manual= undef;
$version= "unknown"; $version= "unknown";
GetOptions( GetOptions(
"build-command|b=s",
"changelog|c:s", "changelog|c:s",
"directory|d=s", "directory|d=s",
"delete", "delete",
...@@ -54,7 +56,6 @@ GetOptions( ...@@ -54,7 +56,6 @@ GetOptions(
"log|l:s", "log|l:s",
"mail|m=s", "mail|m=s",
"revision|r=s", "revision|r=s",
"revision|r=s",
"skip-check|s", "skip-check|s",
"skip-manual", "skip-manual",
"suffix=s", "suffix=s",
...@@ -81,6 +82,14 @@ if (defined $opt_log) ...@@ -81,6 +82,14 @@ if (defined $opt_log)
} }
} }
#
# Override predefined build command
#
if (defined $opt_build_command)
{
$build_command= $opt_build_command;
}
print_help("") if ($opt_help); print_help("") if ($opt_help);
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!"); defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
...@@ -329,36 +338,41 @@ archive is being created. ...@@ -329,36 +338,41 @@ archive is being created.
Options: Options:
-c, --changelog[=<rev>] Add a ChangeLog [down to revision <rev>] -b, --build-command=<cmd> Use <cmd> to compile the sources before packing
This will automatically be included in the source the distribution.
distribution. To get a ChangeLog down to the last (default is "$build_command")
tagged Changeset, simply use "last" as the revision -c, --changelog[=<rev>] Add a ChangeLog [down to revision <rev>]
number. This will automatically be included in the source
--delete Delete an already existing distribution directory distribution. To get a ChangeLog down to the last
in the target directory instead of renaming it. tagged Changeset, simply use "last" as the revision
-d, --directory=<dir> Specify the target directory number.
(default is "$opt_directory") --delete Delete an already existing distribution directory
--docdir=<dir> Use the MySQL documentation BK tree located in in <dir> in the target directory instead of renaming it.
(default is "$opt_docdir") -d, --directory=<dir> Specify the target directory
--dry-run Dry run without executing (default is "$opt_directory")
-e, --export-only Just export (and add the ChangeLog, if requested), --docdir=<dir> Use the MySQL documentation BK tree located
do not build or test the source distribution in <dir>
-h, --help Print this help message (default is "$opt_docdir")
-l, --log[=<filename>] Write a log file [to <filename>] --dry-run Dry run without executing
(default is "$LOGFILE") -e, --export-only Just export (and add the ChangeLog, if requested),
-m, --mail=<address> Mail a failure report to the given address (and do not build or test the source distribution
include a log file snippet, if logging is enabled) -h, --help Print this help message
Note that the \@-Sign needs to be quoted! -l, --log[=<filename>] Write a log file [to <filename>]
Example: --mail=user\\\@domain.com (default is "$LOGFILE")
-r, --revision=<rev> Export the tree as of revision <rev> -m, --mail=<address> Mail a failure report to the given address (and
(default is up to the latest revision) include a log file snippet, if logging is enabled)
-s, --skip-check Skip checking the distribution with "make distcheck" Note that the \@-Sign needs to be quoted!
--skip-manual Skip updating the manual from the mysqldoc tree Example: --mail=user\\\@domain.com
--suffix=<suffix> Append <suffix> to the version number in configure.in. -r, --revision=<rev> Export the tree as of revision <rev>
Using the special suffix "YMD" will add the current (default is up to the latest revision)
date as the suffix (e.g. "-20020518"). -s, --skip-check Skip checking the distribution with "make distcheck"
-t, --test Run the test suite after build --skip-manual Skip updating the manual from the mysqldoc tree
-v, --verbose Be verbose --suffix=<suffix> Append <suffix> to the version number in
configure.in. Using the special suffix "YMD" will
add the current date as the suffix
(e.g. "-20020518").
-t, --test Run the test suite after build
-v, --verbose Be verbose
Example: Example:
......
...@@ -569,3 +569,22 @@ a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') ...@@ -569,3 +569,22 @@ a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
1 4 c 1 4 c
10 43 a,b,d,f 10 43 a,b,d,f
drop table t1; drop table t1;
create table t1 (id int not null, qty int not null);
insert into t1 values (1,2),(1,3),(2,4),(2,5);
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and cqty>1;
id sqty cqty
1 5 2
2 9 2
select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
id sqty
1 5
2 9
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
id sqty cqty
1 5 2
2 9 2
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
id sqty cqty
1 5 2
2 9 2
drop table t1;
...@@ -417,3 +417,15 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a; ...@@ -417,3 +417,15 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a; select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a; select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
drop table t1; drop table t1;
#
# Problem with group by and alias
#
create table t1 (id int not null, qty int not null);
insert into t1 values (1,2),(1,3),(2,4),(2,5);
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and cqty>1;
select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
drop table t1;
...@@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes') ...@@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes')
} }
} }
if ($limits{'func_sql_character_length'} eq 'yes')
{
my $result = 'error';
my ($resultset);
my $key = 'length_of_varchar_field';
my $prompt='CHARACTER_LENGTH(varchar_field)';
print $prompt," = ";
if (!defined($limits{$key})) {
save_incomplete($key,$prompt);
safe_query_l($key,[
"CREATE TABLE crash_me1 (S1 VARCHAR(100))",
"INSERT INTO crash_me1 VALUES ('X')"
]);
my $recset = get_recordset($key,
"SELECT CHARACTER_LENGTH(S1) FROM crash_me1");
print_recordset($key,$recset);
if (defined($recset)){
if ( $recset->[0][0] eq 1 ) {
$result = 'actual length';
} elsif( $recset->[0][0] eq 100 ) {
$result = 'defined length';
};
} else {
add_log($key,$DBI::errstr);
}
safe_query_l($key, "drop table crash_me1 $drop_attr");
save_config_data($key,$result,$prompt);
} else {
$result = $limits{$key};
};
print "$result\n";
}
check_constraint("Column constraints","constraint_check", check_constraint("Column constraints","constraint_check",
"create table crash_q (a int check (a>0))", "create table crash_q (a int check (a>0))",
"insert into crash_q values(0)", "insert into crash_q values(0)",
...@@ -2873,6 +2907,81 @@ sub make_date { ...@@ -2873,6 +2907,81 @@ sub make_date {
} }
sub print_recordset{
my ($key,$recset) = @_;
my $rec;
foreach $rec (@$recset)
{
add_log($key, " > ".join(',', map(repr($_), @$rec)));
}
}
#
# read result recordset from sql server.
# returns arrayref to (arrayref to) values
# or undef (in case of sql errors)
#
sub get_recordset{
my ($key,$query) = @_;
add_log($key, "< $query");
return $dbh->selectall_arrayref($query);
}
# function for comparing recordset (that was returned by get_recordset)
# and arrayref of (arrayref of) values.
#
# returns : zero if recordset equal that array, 1 if it doesn't equal
#
# parameters:
# $key - current operation (for logging)
# $recset - recordset
# $mustbe - array of values that we expect
#
# example: $a=get_recordset('some_parameter','select a,b from c');
# if (compare_recordset('some_parameter',$a,[[1,1],[1,2],[1,3]]) neq 0)
# {
# print "unexpected result\n";
# } ;
#
sub compare_recordset {
my ($key,$recset,$mustbe) = @_;
my $rec,$recno,$fld,$fldno,$fcount;
add_log($key,"\n Check recordset:");
$recno=0;
foreach $rec (@$recset)
{
add_log($key," " . join(',', map(repr($_),@$rec)) . " expected: " .
join(',', map(repr($_), @{$mustbe->[$recno]} ) ));
$fcount = @$rec;
$fcount--;
foreach $fldno (0 .. $fcount )
{
if ($mustbe->[$recno][$fldno] ne $rec->[$fldno])
{
add_log($key," Recordset doesn't correspond with template");
return 1;
};
}
$recno++;
}
add_log($key," Recordset corresponds with template");
return 0;
}
#
# converts inner perl value to printable representation
# for example: undef maps to 'NULL',
# string -> 'string'
# int -> int
#
sub repr {
my $s = shift;
return "'$s'"if ($s =~ /\D/);
return 'NULL'if ( not defined($s));
return $s;
}
sub version sub version
{ {
print "$0 Ver $version\n"; print "$0 Ver $version\n";
......
...@@ -665,6 +665,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables) ...@@ -665,6 +665,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables)
maybe_null= (*ref)->maybe_null; maybe_null= (*ref)->maybe_null;
decimals= (*ref)->decimals; decimals= (*ref)->decimals;
binary= (*ref)->binary; binary= (*ref)->binary;
with_sum_func= (*ref)->with_sum_func;
} }
return 0; return 0;
} }
......
...@@ -2061,6 +2061,16 @@ mysql_execute_command(void) ...@@ -2061,6 +2061,16 @@ mysql_execute_command(void)
{ {
if (check_table_access(thd,DROP_ACL,tables)) if (check_table_access(thd,DROP_ACL,tables))
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
/*
If this is a slave thread, we may sometimes execute some
DROP / * 40005 TEMPORARY * / TABLE
that come from parts of binlogs (likely if we use RESET SLAVE or CHANGE
MASTER TO), while the temporary table has already been dropped.
To not generate such irrelevant "table does not exist errors", we silently
add IF EXISTS if TEMPORARY was used.
*/
if (thd->slave_thread && lex->drop_temporary)
lex->drop_if_exists= 1;
if (end_active_trans(thd)) if (end_active_trans(thd))
res= -1; res= -1;
else else
......
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