Commit 80627965 authored by unknown's avatar unknown

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

into  shellback.(none):/home/msvensson/mysql/mysql-5.1-maint


client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Merge
parents 4c960bf1 3fd8a460
......@@ -9,3 +9,4 @@
451ab499rgdjXyOnUDqHu-wBDoS-OQ
45214442pBGT9KuZEGixBH71jTzbOA
45214a07hVsIGwvwa-WrO-jpeaSwVw
452a92d0-31-8wSzSfZi165fcGcXPA
......@@ -386,6 +386,21 @@ int main(int argc,char *argv[])
else
status.add_to_history=1;
status.exit_status=1;
{
/*
The file descriptor-layer may be out-of-sync with the file-number layer,
so we make sure that "stdout" is really open. If its file is closed then
explicitly close the FD layer.
*/
int stdout_fileno_copy;
stdout_fileno_copy= dup(fileno(stdout)); /* Okay if fileno fails. */
if (stdout_fileno_copy == -1)
fclose(stdout);
else
close(stdout_fileno_copy); /* Clean up dup(). */
}
load_defaults("my",load_default_groups,&argc,&argv);
defaults_argv=argv;
if (get_options(argc, (char **) argv))
......
......@@ -97,15 +97,25 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to);
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);
/*
The following must be sorted so that simple intervals comes first.
(get_interval_value() depends on this)
/*
Available interval types used in any statement.
'interval_type' must be sorted so that simple intervals comes first,
ie year, quarter, month, week, day, hour, etc. The order based on
interval size is also important and the intervals should be kept in a
large to smaller order. (get_interval_value() depends on this)
Note: If you change the order of elements in this enum you should fix
order of elements in 'interval_type_to_name' and 'interval_names'
arrays
See also interval_type_to_name, get_interval_value, interval_names
*/
enum interval_type
{
INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_DAY, INTERVAL_HOUR,
INTERVAL_MINUTE, INTERVAL_WEEK, INTERVAL_SECOND, INTERVAL_MICROSECOND ,
INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY,
INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND,
INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND,
......
......@@ -71,3 +71,17 @@ NULL
NULL
NULL
drop table t1;
End of 4.1 tests
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY
2006-09-27
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH
2006-10-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR
2007-09-26
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK
2006-10-03
End of 5.0 tests
......@@ -612,7 +612,7 @@ date_add(date,INTERVAL "1 1:1:1" DAY_SECOND)
2003-01-03 01:01:01
select date_add(date,INTERVAL "1" WEEK) from t1;
date_add(date,INTERVAL "1" WEEK)
2003-01-09 00:00:00
2003-01-09
select date_add(date,INTERVAL "1" QUARTER) from t1;
date_add(date,INTERVAL "1" QUARTER)
2003-04-02
......@@ -621,7 +621,7 @@ timestampadd(MINUTE, 1, date)
2003-01-02 00:01:00
select timestampadd(WEEK, 1, date) from t1;
timestampadd(WEEK, 1, date)
2003-01-09 00:00:00
2003-01-09
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
timestampadd(SQL_TSI_SECOND, 1, date)
2003-01-02 00:00:01
......
......@@ -149,4 +149,17 @@ ERROR at line 1: USE must be followed by a database name
\\
';
';
create table t17583 (a int);
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
select count(*) from t17583;
count(*)
1280
drop table t17583;
End of 5.0 tests
This diff is collapsed.
......@@ -15,7 +15,6 @@ ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
ps : BUG#21524 2006-08-08 pgalbraith 'ps' test fails in --ps-protocol test AMD64 bit
ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
rpl_ndb_2myisam : BUG#19227 Seems to pass currently
......
......@@ -64,4 +64,17 @@ insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
select * from t1;
drop table t1;
# End of 4.1 tests
--echo End of 4.1 tests
#
# Bug#21811
#
# Make sure we end up with an appropriate
# date format (DATE) after addition operation
#
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
--echo End of 5.0 tests
......@@ -153,4 +153,21 @@ drop table t1;
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
#
# Bug#17583: mysql drops connection when stdout is not writable
#
create table t17583 (a int);
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
# Close to the minimal data needed to exercise bug.
select count(*) from t17583;
--exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
drop table t17583;
--echo End of 5.0 tests
......@@ -1447,13 +1447,15 @@ create procedure proc_1() reset query cache;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin reset query cache; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
drop procedure proc_1;
prepare abc from "reset query cache";
execute abc;
execute abc;
......@@ -1462,13 +1464,15 @@ deallocate prepare abc;
create procedure proc_1() reset master;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin reset master; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
drop procedure proc_1;
prepare abc from "reset master";
execute abc;
execute abc;
......@@ -1480,13 +1484,15 @@ create procedure proc_1() reset slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin reset slave; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
drop procedure proc_1;
prepare abc from "reset slave";
execute abc;
execute abc;
......@@ -1527,15 +1533,15 @@ call proc_1();
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush hosts; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush hosts";
execute abc;
execute abc;
......@@ -1547,15 +1553,15 @@ create procedure proc_1() flush privileges;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush privileges; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush privileges";
deallocate prepare abc;
......@@ -1567,11 +1573,15 @@ call proc_1();
unlock tables;
call proc_1();
unlock tables;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables with read lock; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
drop function func_1;
drop procedure proc_1;
prepare abc from "flush tables with read lock";
execute abc;
execute abc;
......@@ -1584,15 +1594,15 @@ create procedure proc_1() flush tables;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush tables";
execute abc;
execute abc;
......@@ -1622,15 +1632,15 @@ select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
flush tables;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush tables; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
flush tables;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
......@@ -1659,15 +1669,15 @@ create procedure proc_1() flush logs;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush logs; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush logs";
execute abc;
execute abc;
......@@ -1679,15 +1689,15 @@ create procedure proc_1() flush status;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush status; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush status";
execute abc;
execute abc;
......@@ -1699,15 +1709,15 @@ create procedure proc_1() flush slave;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush slave; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush slave";
execute abc;
execute abc;
......@@ -1716,15 +1726,15 @@ deallocate prepare abc;
create procedure proc_1() flush master;
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush master; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush master";
deallocate prepare abc;
......@@ -1733,15 +1743,15 @@ create procedure proc_1() flush des_key_file;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush des_key_file; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush des_key_file";
execute abc;
execute abc;
......@@ -1753,15 +1763,15 @@ create procedure proc_1() flush user_resources;
call proc_1();
call proc_1();
call proc_1();
drop procedure proc_1;
delimiter |;
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
create function func_1() returns int begin flush user_resources; return 1; end|
create function func_1() returns int begin call proc_1(); return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
drop procedure proc_1;
prepare abc from "flush user_resources";
execute abc;
execute abc;
......@@ -1865,22 +1875,6 @@ execute abc;
deallocate prepare abc;
create procedure proc_1() show scheduler status;
drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
create function func_1() returns int begin show scheduler status; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
select func_1(), func_1(), func_1() from dual;
--error ER_SP_DOES_NOT_EXIST
drop function func_1;
--error ER_UNSUPPORTED_PS
prepare abc from "show scheduler status";
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare abc;
--disable_warnings
drop procedure if exists a;
--enable_warnings
......@@ -1997,10 +1991,13 @@ call proc_1();
call proc_1();
drop procedure proc_1;
create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
--replace_regex /(Can\'t open shared library).*$/\1/
--error ER_CANT_OPEN_LIBRARY
call proc_1();
--replace_regex /(Can\'t open shared library).*$/\1/
--error ER_CANT_OPEN_LIBRARY
call proc_1();
--replace_regex /(Can\'t open shared library).*$/\1/
--error ER_CANT_OPEN_LIBRARY
call proc_1();
drop procedure proc_1;
......@@ -2150,7 +2147,7 @@ drop event if exists xyz;
#drop event xyz;
#drop procedure proc_1;
delimiter |;
--error ER_SP_NO_RETSET
--error ER_EVENT_RECURSIVITY_FORBIDDEN
create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
delimiter ;|
--error ER_SP_DOES_NOT_EXIST
......
......@@ -2030,11 +2030,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
(date_sub_interval == other->date_sub_interval));
}
/*
'interval_names' reflects the order of the enumeration interval_type.
See item_timefunc.h
*/
static const char *interval_names[]=
{
"year", "quarter", "month", "day", "hour",
"minute", "week", "second", "microsecond",
"year", "quarter", "month", "week", "day",
"hour", "minute", "second", "microsecond",
"year_month", "day_hour", "day_minute",
"day_second", "hour_minute", "hour_second",
"minute_second", "day_microsecond",
......
......@@ -25,14 +25,25 @@
#ifndef TESTTIME
/*
Name description of interval names used in statements.
'interval_type_to_name' is ordered and sorted on interval size and
interval complexity.
Order of elements in 'interval_type_to_name' should correspond to
the order of elements in 'interval_type' enum
See also interval_type, interval_names
*/
LEX_STRING interval_type_to_name[INTERVAL_LAST] = {
{ C_STRING_WITH_LEN("YEAR")},
{ C_STRING_WITH_LEN("QUARTER")},
{ C_STRING_WITH_LEN("MONTH")},
{ C_STRING_WITH_LEN("WEEK")},
{ C_STRING_WITH_LEN("DAY")},
{ C_STRING_WITH_LEN("HOUR")},
{ C_STRING_WITH_LEN("MINUTE")},
{ C_STRING_WITH_LEN("WEEK")},
{ C_STRING_WITH_LEN("SECOND")},
{ C_STRING_WITH_LEN("MICROSECOND")},
{ C_STRING_WITH_LEN("YEAR_MONTH")},
......
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