Commit bf8a9e54 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge bk-internal:/home/bk/mysql-5.0-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
parents 68a7d45a 2cbb3668
...@@ -17,3 +17,5 @@ ...@@ -17,3 +17,5 @@
452a92d0-31-8wSzSfZi165fcGcXPA 452a92d0-31-8wSzSfZi165fcGcXPA
454a7ef8gdvE_ddMlJyghvOAkKPNOQ 454a7ef8gdvE_ddMlJyghvOAkKPNOQ
454f8960jsVT_kMKJtZ9OCgXoba0xQ 454f8960jsVT_kMKJtZ9OCgXoba0xQ
4554a95d7txO1DuO9G3nAizI3SkFAA
4554b3722d71SbPiI2Gx-RhbZjmuIQ
...@@ -386,18 +386,18 @@ find_file(const char *name, const char *root, uint flags, char *result, size_t l ...@@ -386,18 +386,18 @@ find_file(const char *name, const char *root, uint flags, char *result, size_t l
cp= strmake(result, root, len); cp= strmake(result, root, len);
if (cp[-1] != FN_LIBCHAR) if (cp[-1] != FN_LIBCHAR)
*cp= FN_LIBCHAR; *cp++= FN_LIBCHAR;
ret= 1; ret= 1;
va_start(va, len); va_start(va, len);
subdir= (!(flags & MY_SEARCH_SELF)) ? va_arg(va, char *) : ""; subdir= (!(flags & MY_SEARCH_SELF)) ? va_arg(va, char *) : "";
while (ret && subdir) while (subdir)
{ {
MY_DIR *dir; MY_DIR *dir;
FILEINFO *match; FILEINFO *match;
char *cp1; char *cp1;
cp1= strnmov(cp + 1, subdir, len - (cp - result) - 1); cp1= strnmov(cp, subdir, len - (cp - result) - 1);
dir= my_dir(result, (flags & MY_ISDIR) ? MY_WANT_STAT : MYF(0)); dir= my_dir(result, (flags & MY_ISDIR) ? MY_WANT_STAT : MYF(0));
if (dir) if (dir)
...@@ -406,25 +406,20 @@ find_file(const char *name, const char *root, uint flags, char *result, size_t l ...@@ -406,25 +406,20 @@ find_file(const char *name, const char *root, uint flags, char *result, size_t l
sizeof(FILEINFO), (qsort_cmp)comp_names); sizeof(FILEINFO), (qsort_cmp)comp_names);
if (match) if (match)
{ {
if (!(flags & MY_PARENT)) ret= (flags & MY_ISDIR) ? !MY_S_ISDIR(match->mystat->st_mode) : 0;
if (!ret)
{ {
if (cp1[-1] != FN_LIBCHAR) if (cp1[-1] != FN_LIBCHAR)
*cp1++= FN_LIBCHAR; *cp1++= FN_LIBCHAR;
if (!(flags & MY_PARENT))
strnmov(cp1, name, len - (cp1 - result)); strnmov(cp1, name, len - (cp1 - result));
}
else else
{ *cp1= '\0';
if (cp1[-1] == FN_LIBCHAR)
--cp1; my_dirend(dir);
while (*--cp1 == FN_LIBCHAR) break;
{}
*++cp1= FN_LIBCHAR;
*++cp1= '\0';
} }
if (flags & MY_ISDIR)
ret= !MY_S_ISDIR(match->mystat->st_mode);
else
ret= 0;
} }
my_dirend(dir); my_dirend(dir);
} }
...@@ -484,7 +479,7 @@ int main(int argc, char **argv) ...@@ -484,7 +479,7 @@ int main(int argc, char **argv)
|| find_file(mysqld_name, basedir, MYF(0), path, sizeof(path), || find_file(mysqld_name, basedir, MYF(0), path, sizeof(path),
"bin", "libexec", NullS)) "bin", "libexec", NullS))
{ {
my_strdup((gptr)basedir, MYF(0)); my_free((gptr)basedir, MYF(0));
basedir= (char *)DEFAULT_MYSQL_HOME; basedir= (char *)DEFAULT_MYSQL_HOME;
} }
} }
......
#
# show server variables
#
--disable_query_log
--echo ===== ENGINES =====
show engines;
--echo ===== VARIABLES =====
show variables;
--echo ===== STOP =====
--enable_query_log
...@@ -220,6 +220,7 @@ our $opt_ndbcluster_port_slave; ...@@ -220,6 +220,7 @@ our $opt_ndbcluster_port_slave;
our $opt_ndbconnectstring_slave; our $opt_ndbconnectstring_slave;
our $opt_record; our $opt_record;
our $opt_report_features;
our $opt_check_testcases; our $opt_check_testcases;
our $opt_skip; our $opt_skip;
...@@ -431,6 +432,10 @@ sub main () { ...@@ -431,6 +432,10 @@ sub main () {
initialize_servers(); initialize_servers();
if ( $opt_report_features ) {
run_report_features();
}
run_suite($opt_suite, $tests); run_suite($opt_suite, $tests);
} }
...@@ -595,6 +600,7 @@ sub command_line_setup () { ...@@ -595,6 +600,7 @@ sub command_line_setup () {
'mem' => \$opt_mem, 'mem' => \$opt_mem,
# Misc # Misc
'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment, 'comment=s' => \$opt_comment,
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
...@@ -4255,6 +4261,43 @@ sub run_check_testcase ($$) { ...@@ -4255,6 +4261,43 @@ sub run_check_testcase ($$) {
return $res; return $res;
} }
##############################################################################
#
# Report the features that were compiled in
#
##############################################################################
sub run_report_features () {
my $args;
if ( ! $glob_use_embedded_server )
{
mysqld_start($master->[0],[],[]);
if ( ! $master->[0]->{'pid'} )
{
mtr_error("Can't start the mysqld server");
}
mysqld_wait_started($master->[0]);
}
my $tinfo = {};
$tinfo->{'name'} = 'report features';
$tinfo->{'result_file'} = undef;
$tinfo->{'component_id'} = 'mysqld';
$tinfo->{'path'} = 'include/report-features.test';
$tinfo->{'timezone'}= "GMT-3";
$tinfo->{'slave_num'} = 0;
$tinfo->{'master_opt'} = [];
$tinfo->{'slave_opt'} = [];
$tinfo->{'slave_mi'} = [];
$tinfo->{'comment'} = 'report server features';
run_mysqltest($tinfo);
if ( ! $glob_use_embedded_server )
{
stop_all_servers();
}
}
sub run_mysqltest ($) { sub run_mysqltest ($) {
...@@ -4392,8 +4435,10 @@ sub run_mysqltest ($) { ...@@ -4392,8 +4435,10 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--test-file"); mtr_add_arg($args, "--test-file");
mtr_add_arg($args, $tinfo->{'path'}); mtr_add_arg($args, $tinfo->{'path'});
if ( defined $tinfo->{'result_file'} ) {
mtr_add_arg($args, "--result-file"); mtr_add_arg($args, "--result-file");
mtr_add_arg($args, $tinfo->{'result_file'}); mtr_add_arg($args, $tinfo->{'result_file'});
}
if ( $opt_record ) if ( $opt_record )
{ {
...@@ -4807,3 +4852,4 @@ HERE ...@@ -4807,3 +4852,4 @@ HERE
mtr_exit(1); mtr_exit(1);
} }
...@@ -1750,8 +1750,11 @@ run_testcase () ...@@ -1750,8 +1750,11 @@ run_testcase ()
--result-file=*) --result-file=*)
result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"` result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
result_file="r/$result_file.result" result_file="r/$result_file.result"
# Note that this must be set to space, not "" for test-reset to # Note that this must be set to space, not "" for test-reset to work
# work EXTRA_MASTER_OPT=" "
;;
--force-restart)
# Note that this must be set to space, not "" for test-reset to work
EXTRA_MASTER_OPT=" " EXTRA_MASTER_OPT=" "
;; ;;
esac esac
......
...@@ -104,3 +104,95 @@ a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1 ...@@ -104,3 +104,95 @@ a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
drop table t1; drop table t1;
drop table t2; drop table t2;
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 (i) values (2);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
desc bug20691;
Field Type Null Key Default Extra
i int(11) YES NULL
d datetime NO
dn datetime NO 0000-00-00 00:00:00
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 (i) values (4);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
SET sql_mode = 'ALLOW_INVALID_DATES';
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
Warnings:
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
SET sql_mode = 'STRICT_ALL_TABLES';
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
ERROR HY000: Field 'd' doesn't have a default value
select * from bug20691 order by i asc;
i d dn
1 0000-00-00 00:00:00 0000-00-00 00:00:00
1 1975-07-10 07:10:03 1978-01-13 14:08:51
1 0000-00-00 00:00:00 0000-00-00 00:00:00
2 0000-00-00 00:00:00 0000-00-00 00:00:00
3 0000-00-00 00:00:00 0000-00-00 00:00:00
3 1975-07-10 07:10:03 1978-01-13 14:08:51
3 0000-00-00 00:00:00 0000-00-00 00:00:00
4 0000-00-00 00:00:00 0000-00-00 00:00:00
5 0000-00-00 00:00:00 0000-00-00 00:00:00
5 1975-07-10 07:10:03 1978-01-13 14:08:51
5 0000-00-00 00:00:00 0000-00-00 00:00:00
6 0000-00-00 00:00:00 0000-00-00 00:00:00
6 1975-07-10 07:10:03 1978-01-13 14:08:51
6 0000-00-00 00:00:00 0000-00-00 00:00:00
drop table bug20691;
SET sql_mode = '';
create table bug20691 (
a set('one', 'two', 'three') not null,
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
c time not null,
d date not null,
e int not null,
f long not null,
g blob not null,
h datetime not null,
i decimal not null,
x int);
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
insert into bug20691 (x) values (2);
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'e' doesn't have a default value
Warning 1364 Field 'f' doesn't have a default value
Warning 1364 Field 'g' doesn't have a default value
Warning 1364 Field 'h' doesn't have a default value
Warning 1364 Field 'i' doesn't have a default value
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'c' doesn't have a default value
Warning 1364 Field 'd' doesn't have a default value
Warning 1364 Field 'e' doesn't have a default value
Warning 1364 Field 'f' doesn't have a default value
Warning 1364 Field 'g' doesn't have a default value
Warning 1364 Field 'h' doesn't have a default value
Warning 1364 Field 'i' doesn't have a default value
select * from bug20691 order by x asc;
a b c d e f g h i x
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
drop table bug20691;
End of 5.0 tests.
...@@ -82,3 +82,61 @@ SELECT * from t2; ...@@ -82,3 +82,61 @@ SELECT * from t2;
drop table t1; drop table t1;
drop table t2; drop table t2;
#
# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
#
# From the docs:
# If the column can take NULL as a value, the column is defined with an
# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
#
# If the column cannot take NULL as the value, MySQL defines the column with
# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
# statement includes no value for the column, MySQL handles the column
# according to the SQL mode in effect at the time:
#
# * If strict SQL mode is not enabled, MySQL sets the column to the
# implicit default value for the column data type.
#
# * If strict mode is enabled, an error occurs for transactional tables and
# the statement is rolled back. For non-transactional tables, an error
# occurs, but if this happens for the second or subsequent row of a
# multiple-row statement, the preceding rows will have been inserted.
#
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
insert into bug20691 (i) values (2);
desc bug20691;
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
insert into bug20691 (i) values (4);
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
SET sql_mode = 'ALLOW_INVALID_DATES';
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
SET sql_mode = 'STRICT_ALL_TABLES';
--error 1364
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
select * from bug20691 order by i asc;
drop table bug20691;
SET sql_mode = '';
create table bug20691 (
a set('one', 'two', 'three') not null,
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
c time not null,
d date not null,
e int not null,
f long not null,
g blob not null,
h datetime not null,
i decimal not null,
x int);
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
insert into bug20691 (x) values (2);
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
select * from bug20691 order by x asc;
drop table bug20691;
###
--echo End of 5.0 tests.
...@@ -5379,6 +5379,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions) ...@@ -5379,6 +5379,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
ER(ER_NO_DEFAULT_FOR_FIELD), ER(ER_NO_DEFAULT_FOR_FIELD),
field_arg->field_name); field_arg->field_name);
} }
field_arg->set_default();
return 1; return 1;
} }
field_arg->set_default(); field_arg->set_default();
......
...@@ -333,7 +333,7 @@ bool opt_error_log= IF_WIN(1,0); ...@@ -333,7 +333,7 @@ bool opt_error_log= IF_WIN(1,0);
bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_disable_networking=0, opt_skip_show_db=0;
my_bool opt_character_set_client_handshake= 1; my_bool opt_character_set_client_handshake= 1;
bool server_id_supplied = 0; bool server_id_supplied = 0;
bool opt_endinfo,using_udf_functions; bool opt_endinfo, using_udf_functions;
my_bool locked_in_memory; my_bool locked_in_memory;
bool opt_using_transactions, using_update_log; bool opt_using_transactions, using_update_log;
bool volatile abort_loop; bool volatile abort_loop;
...@@ -2108,6 +2108,17 @@ later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ ...@@ -2108,6 +2108,17 @@ later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\
mysqld that is not statically linked.\n"); mysqld that is not statically linked.\n");
#endif #endif
if (locked_in_memory)
{
fprintf(stderr, "\n\
The \"--memlock\" argument, which was enabled, uses system calls that are\n\
unreliable and unstable on some operating systems and operating-system\n\
versions (notably, some versions of Linux). This crash could be due to use\n\
of those buggy OS calls. You should consider whether you really need the\n\
\"--memlock\" parameter and/or consult the OS distributer about \"mlockall\"\n\
bugs.\n");
}
if (test_flags & TEST_CORE_ON_SIGNAL) if (test_flags & TEST_CORE_ON_SIGNAL)
{ {
fprintf(stderr, "Writing a core file\n"); fprintf(stderr, "Writing a core file\n");
......
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