Commit 63e56390 authored by Marc Alff's avatar Marc Alff

WL#2110 (SIGNAL)

WL#2265 (RESIGNAL)

Manual merge of SIGNAL and RESIGNAL to mysql-trunk-signal,
plus required dependencies.
parent 905d715f
......@@ -39,6 +39,17 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); }
/**
Max length of an error message generated by mysys utilities.
Some mysys functions produce error messages. These mostly go
to stderr.
This constant defines the size of the buffer used to format
the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
since sometimes mysys errors are stored in the server diagnostics
area, and we would like to avoid unexpected truncation.
*/
#define MYSYS_ERRMSG_SIZE (512)
#define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */
......@@ -89,8 +100,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
#define ME_FATALERROR 1024 /* Fatal statement error */
#define ME_NO_WARNING_FOR_ERROR 2048 /* Don't push a warning for error */
#define ME_NO_SP_HANDLER 4096 /* Don't call stored routine error handlers */
/* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
......@@ -209,8 +218,8 @@ extern int errno; /* declare errno */
extern char *home_dir; /* Home directory for user */
extern const char *my_progname; /* program-name (printed in errors) */
extern char NEAR curr_dir[]; /* Current directory for user */
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf MyFlags);
extern uint my_file_limit;
extern ulong my_thread_stack_size;
......@@ -645,15 +654,15 @@ extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
extern int my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...))
ATTRIBUTE_FORMAT(printf, 2, 4);
extern void my_error _VARARGS((int nr,myf MyFlags, ...));
extern void my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...))
ATTRIBUTE_FORMAT(printf, 2, 4);
extern int my_error_register(const char **errmsgs, int first, int last);
extern const char **my_error_unregister(int first, int last);
extern int my_message(uint my_err, const char *str,myf MyFlags);
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
extern void my_message(uint my_err, const char *str,myf MyFlags);
extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern void my_message_curses(uint my_err, const char *str,myf MyFlags);
extern my_bool my_init(void);
extern void my_end(int infoflag);
extern int my_redel(const char *from, const char *to, int MyFlags);
......
......@@ -139,6 +139,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
../sql/partition_info.cc ../sql/sql_connect.cc
../sql/scheduler.cc ../sql/event_parse_data.cc
./sql/sql_signal.cc
${GEN_SOURCES}
${LIB_SOURCES})
......
......@@ -77,7 +77,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc \
sql_servers.cc event_parse_data.cc
sql_servers.cc event_parse_data.cc sql_signal.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
......
......@@ -483,7 +483,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
*prev_row= NULL;
data->embedded_info->prev_ptr= prev_row;
return_ok:
net_send_eof(thd, thd->server_status, thd->total_warn_count);
net_send_eof(thd, thd->server_status,
thd->warning_info->statement_warn_count());
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
......
......@@ -112,7 +112,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
/* Clear result variables */
thd->clear_error();
thd->main_da.reset_diagnostics_area();
thd->stmt_da->reset_diagnostics_area();
mysql->affected_rows= ~(my_ulonglong) 0;
mysql->field_count= 0;
net_clear_error(net);
......@@ -217,7 +217,7 @@ static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
stmt->stmt_id= thd->client_stmt_id;
stmt->param_count= thd->client_param_count;
stmt->field_count= 0;
mysql->warning_count= thd->total_warn_count;
mysql->warning_count= thd->warning_info->statement_warn_count();
if (thd->first_data)
{
......@@ -402,7 +402,7 @@ static void emb_free_embedded_thd(MYSQL *mysql)
static const char * emb_read_statistics(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
return thd->is_error() ? thd->main_da.message() : "";
return thd->is_error() ? thd->stmt_da->message() : "";
}
......@@ -703,9 +703,10 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
err:
{
NET *net= &mysql->net;
strmake(net->last_error, thd->main_da.message(), sizeof(net->last_error)-1);
strmake(net->last_error, thd->stmt_da->message(),
sizeof(net->last_error)-1);
memcpy(net->sqlstate,
mysql_errno_to_sqlstate(thd->main_da.sql_errno()),
mysql_errno_to_sqlstate(thd->stmt_da->sql_errno()),
sizeof(net->sqlstate)-1);
}
return result;
......@@ -729,8 +730,8 @@ void THD::clear_data_list()
void THD::clear_error()
{
if (main_da.is_error())
main_da.reset_diagnostics_area();
if (stmt_da->is_error())
stmt_da->reset_diagnostics_area();
}
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
......@@ -804,7 +805,7 @@ MYSQL_DATA *THD::alloc_new_dataset()
static
bool
write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
write_eof_packet(THD *thd, uint server_status, uint statement_warn_count)
{
if (!thd->mysql) // bootstrap file handling
return FALSE;
......@@ -821,7 +822,7 @@ write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
is cleared between substatements, and mysqltest gets confused
*/
thd->cur_data->embedded_info->warning_count=
(thd->spcont ? 0 : min(total_warn_count, 65535));
(thd->spcont ? 0 : min(statement_warn_count, 65535));
return FALSE;
}
......@@ -978,7 +979,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
}
if (flags & SEND_EOF)
write_eof_packet(thd, thd->server_status, thd->total_warn_count);
write_eof_packet(thd, thd->server_status,
thd->warning_info->statement_warn_count());
DBUG_RETURN(prepare_for_send(list));
err:
......@@ -1040,25 +1042,24 @@ bool Protocol_binary::write()
bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
uint server_status, uint statement_warn_count,
ulonglong affected_rows, ulonglong id, const char *message)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
bool error;
MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling
DBUG_RETURN(FALSE);
if (!(data= thd->alloc_new_dataset()))
return TRUE;
DBUG_RETURN(TRUE);
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
strmake(data->embedded_info->info, message,
sizeof(data->embedded_info->info)-1);
error= write_eof_packet(thd, server_status, total_warn_count);
bool error= write_eof_packet(thd, server_status, statement_warn_count);
thd->cur_data= 0;
DBUG_RETURN(error);
}
......@@ -1075,15 +1076,16 @@ net_send_ok(THD *thd,
*/
bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
net_send_eof(THD *thd, uint server_status, uint statement_warn_count)
{
bool error= write_eof_packet(thd, server_status, total_warn_count);
bool error= write_eof_packet(thd, server_status, statement_warn_count);
thd->cur_data= 0;
return error;
}
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate)
{
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
......@@ -1100,7 +1102,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
ei= data->embedded_info;
ei->last_errno= sql_errno;
strmake(ei->info, err, sizeof(ei->info)-1);
strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno));
strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status;
thd->cur_data= 0;
return FALSE;
......
......@@ -362,12 +362,12 @@ select cast(19999999999999999999 as signed);
cast(19999999999999999999 as signed)
9223372036854775807
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: ''
select cast(-19999999999999999999 as signed);
cast(-19999999999999999999 as signed)
-9223372036854775808
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: ''
select -9223372036854775808;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def -9223372036854775808 8 20 20 N 32897 0 63
......
......@@ -380,7 +380,7 @@ select cast(s1 as decimal(7,2)) from t1;
cast(s1 as decimal(7,2))
99999.99
Warnings:
Error 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
Warning 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
drop table t1;
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
mt mediumtext, lt longtext);
......
......@@ -1631,27 +1631,27 @@ select char(0xff,0x8f using utf8);
char(0xff,0x8f using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF8F'
Warning 1300 Invalid utf8 character string: 'FF8F'
select char(195 using utf8);
char(195 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'C3'
Warning 1300 Invalid utf8 character string: 'C3'
select char(196 using utf8);
char(196 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'C4'
Warning 1300 Invalid utf8 character string: 'C4'
select char(2557 using utf8);
char(2557 using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FD'
Warning 1300 Invalid utf8 character string: 'FD'
select convert(char(0xff,0x8f) using utf8);
convert(char(0xff,0x8f) using utf8)
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF8F'
Warning 1300 Invalid utf8 character string: 'FF8F'
select hex(convert(char(2557 using latin1) using utf8));
hex(convert(char(2557 using latin1) using utf8))
09C3BD
......@@ -1815,12 +1815,12 @@ select hex(char(0xFF using utf8));
hex(char(0xFF using utf8))
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF'
Warning 1300 Invalid utf8 character string: 'FF'
select hex(convert(0xFF using utf8));
hex(convert(0xFF using utf8))
NULL
Warnings:
Error 1300 Invalid utf8 character string: 'FF'
Warning 1300 Invalid utf8 character string: 'FF'
select hex(_utf8 0x616263FF);
ERROR HY000: Invalid utf8 character string: 'FF'
select hex(_utf8 X'616263FF');
......
......@@ -89,7 +89,7 @@ select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
NULL
Warnings:
Error 1411 Incorrect time value: '22.30.61' for function str_to_date
Warning 1411 Incorrect time value: '22.30.61' for function str_to_date
create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
......@@ -361,21 +361,21 @@ Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
......@@ -395,21 +395,21 @@ Tuesday 52 2001 %W %u %x NULL
7 53 1998 %w %u %Y NULL
NULL %m.%d.%Y NULL
Warnings:
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
Warning 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
Warning 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
Warning 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
Warning 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
Warning 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
Warning 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
Warning 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
truncate table t1;
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
......@@ -449,7 +449,7 @@ select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
NULL
Warnings:
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
Warning 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......
......@@ -65,8 +65,8 @@ NULL
50000
NULL
Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
Warning 1259 ZLIB: Input data corrupted
Warning 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
......@@ -96,12 +96,12 @@ explain select * from t1 where uncompress(a) is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
Warnings:
Error 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
select * from t1 where uncompress(a) is null;
a
foo
Warnings:
Error 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
explain select *, uncompress(a) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
......@@ -109,13 +109,13 @@ select *, uncompress(a) from t1;
a uncompress(a)
foo NULL
Warnings:
Error 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
select *, uncompress(a), uncompress(a) is null from t1;
a uncompress(a) uncompress(a) is null
foo NULL 1
Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
Warning 1259 ZLIB: Input data corrupted
drop table t1;
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1), (1111), (11111);
......
......@@ -124,7 +124,7 @@ select des_encrypt("hello",10);
des_encrypt("hello",10)
NULL
Warnings:
Error 1108 Incorrect parameters to procedure 'des_encrypt'
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
select des_encrypt(NULL);
des_encrypt(NULL)
NULL
......@@ -138,12 +138,12 @@ select des_encrypt(10, NULL);
des_encrypt(10, NULL)
NULL
Warnings:
Error 1108 Incorrect parameters to procedure 'des_encrypt'
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
select des_encrypt("hello", NULL);
des_encrypt("hello", NULL)
NULL
Warnings:
Error 1108 Incorrect parameters to procedure 'des_encrypt'
Warning 1108 Incorrect parameters to procedure 'des_encrypt'
select des_decrypt("hello",10);
des_decrypt("hello",10)
hello
......@@ -177,7 +177,7 @@ select hex(des_decrypt(des_encrypt("hello","hidden")));
hex(des_decrypt(des_encrypt("hello","hidden")))
NULL
Warnings:
Error 1108 Incorrect parameters to procedure 'des_decrypt'
Warning 1108 Incorrect parameters to procedure 'des_decrypt'
explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......
......@@ -153,10 +153,10 @@ grp group_concat(c)
4
5 NULL
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
show warnings;
Level Code Message
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
set group_concat_max_len = 1024;
select group_concat(sum(c)) from t1 group by grp;
ERROR HY000: Invalid use of group function
......@@ -380,25 +380,29 @@ group_concat(b)
bb,c
BB,C
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
select group_concat(distinct b) from t1 group by a;
group_concat(distinct b)
bb,c
BB,C
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
select group_concat(b order by b) from t1 group by a;
group_concat(b order by b)
a,bb
A,BB
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 3 was cut by GROUP_CONCAT()
Warning 1260 Row 6 was cut by GROUP_CONCAT()
select group_concat(distinct b order by b) from t1 group by a;
group_concat(distinct b order by b)
a,bb
A,BB
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 3 was cut by GROUP_CONCAT()
Warning 1260 Row 6 was cut by GROUP_CONCAT()
insert into t1 values (1, concat(repeat('1', 300), '2')),
(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
......@@ -426,25 +430,29 @@ group_concat(b)
bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 7 was cut by GROUP_CONCAT()
Warning 1260 Row 14 was cut by GROUP_CONCAT()
select group_concat(distinct b) from t1 group by a;
group_concat(distinct b)
bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 5 was cut by GROUP_CONCAT()
Warning 1260 Row 10 was cut by GROUP_CONCAT()
select group_concat(b order by b) from t1 group by a;
group_concat(b order by b)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
select group_concat(distinct b order by b) from t1 group by a;
group_concat(distinct b order by b)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT()
drop table t1;
create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci,
b varchar(255) character set koi8r);
......@@ -751,22 +759,22 @@ SELECT GROUP_CONCAT( a ) FROM t1;
GROUP_CONCAT( a )
aaaaaaaaaa,bbbbbbbbb
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
SELECT GROUP_CONCAT( DISTINCT a ) FROM t1;
GROUP_CONCAT( DISTINCT a )
aaaaaaaaaa,bbbbbbbbb
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
GROUP_CONCAT( a ORDER BY b )
aaaaaaaaaa,bbbbbbbbb
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1;
GROUP_CONCAT( DISTINCT a ORDER BY b )
aaaaaaaaaa,bbbbbbbbb
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
SET group_concat_max_len = DEFAULT;
DROP TABLE t1;
SET group_concat_max_len= 65535;
......@@ -979,3 +987,31 @@ GROUP BY t1.a
1
DROP TABLE t1, t2;
End of 5.0 tests
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(6), b INT);
CREATE TABLE t2 (a VARCHAR(6), b INT);
INSERT INTO t1 VALUES ('111111', 1);
INSERT INTO t1 VALUES ('222222', 2);
INSERT INTO t1 VALUES ('333333', 3);
INSERT INTO t1 VALUES ('444444', 4);
INSERT INTO t1 VALUES ('555555', 5);
SET group_concat_max_len = 5;
SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional';
SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3;
GROUP_CONCAT(a) b
11111 1
22222 2
33333 3
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 3 was cut by GROUP_CONCAT()
INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
ERROR HY000: Row 1 was cut by GROUP_CONCAT()
UPDATE t1 SET a = '11111' WHERE b = 1;
UPDATE t1 SET a = '22222' WHERE b = 2;
INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
ERROR HY000: Row 3 was cut by GROUP_CONCAT()
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
DROP TABLE t1, t2;
......@@ -225,27 +225,27 @@ select ln(-1);
ln(-1)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select log10(-1);
log10(-1)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select log2(-1);
log2(-1)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select log(2,-1);
log(2,-1)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select log(-2,1);
log(-2,1)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
set sql_mode='';
select round(111,-10);
round(111,-10)
......
This diff is collapsed.
......@@ -942,25 +942,29 @@ group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 1 was cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 1 was cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 1 was cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a;
group_concat(t1.b,t2.c)
aaaaa
bbbbb
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 1 was cut by GROUP_CONCAT()
Warning 1260 Row 2 was cut by GROUP_CONCAT()
drop table t1, t2;
set group_concat_max_len=default;
create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y));
......
......@@ -914,7 +914,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Warning Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
ALTER TABLE t2 MODIFY a INT;
......
......@@ -2,7 +2,7 @@ drop table if exists t1,t2;
create table t1 (a int) engine=myisam;
drop table if exists t1;
Warnings:
Error 2 Can't find file: 't1' (errno: 2)
Warning 2 Can't find file: 't1' (errno: 2)
create table t1 (a int) engine=myisam;
drop table t1;
Got one of the listed errors
......
......@@ -1226,7 +1226,6 @@ COMMIT;
END|
CALL test.p1(12);
Warnings:
Note 1051 Unknown table 't1'
Warning 1196 Some non-transactional changed tables couldn't be rolled back
CALL test.p1(13);
Warnings:
......
......@@ -2748,17 +2748,21 @@ Warnings:
Note 1051 Unknown table 't1'
call proc_1();
Level Code Message
Note 1051 Unknown table 't1'
drop table if exists t2;
Warnings:
Note 1051 Unknown table 't2'
call proc_1();
Level Code Message
Note 1051 Unknown table 't2'
drop table if exists t1, t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
call proc_1();
Level Code Message
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
drop procedure proc_1;
create function func_1() returns int begin show warnings; return 1; end|
ERROR 0A000: Not allowed to return a result set from a function
......
......@@ -889,7 +889,7 @@ select group_concat(a) FROM t1 group by b;
group_concat(a)
1234567890
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
Warning 1260 Row 1 was cut by GROUP_CONCAT()
set group_concat_max_len=1024;
select group_concat(a) FROM t1 group by b;
group_concat(a)
......@@ -992,19 +992,19 @@ COUNT(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
COUNT(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 0
Warning 1292 Incorrect datetime value: '20050328 invalid' for column 'date' at row 1
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
COUNT(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 0
Warning 1292 Incorrect datetime value: '20050327 invalid' for column 'date' at row 1
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
......
This diff is collapsed.
use test;
drop procedure if exists signal_proc;
drop function if exists signal_func;
create procedure signal_proc()
begin
DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo;
SIGNAL foo SET MESSAGE_TEXT = "This is an error message";
RESIGNAL foo;
RESIGNAL foo SET MESSAGE_TEXT = "This is an error message";
end $$
create function signal_func() returns int
begin
DECLARE foo CONDITION FOR SQLSTATE '12345';
SIGNAL foo;
SIGNAL foo SET MESSAGE_TEXT = "This is an error message";
RESIGNAL foo;
RESIGNAL foo SET MESSAGE_TEXT = "This is an error message";
return 0;
end $$
show procedure code signal_proc;
Pos Instruction
0 stmt 136 "SIGNAL foo"
1 stmt 136 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
2 stmt 137 "RESIGNAL foo"
3 stmt 137 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
drop procedure signal_proc;
show function code signal_func;
Pos Instruction
0 stmt 136 "SIGNAL foo"
1 stmt 136 "SIGNAL foo SET MESSAGE_TEXT = "This i..."
2 stmt 137 "RESIGNAL foo"
3 stmt 137 "RESIGNAL foo SET MESSAGE_TEXT = "This..."
4 freturn 3 0
drop function signal_func;
drop database if exists demo;
create database demo;
use demo;
create table ab_physical_person (
person_id integer,
first_name VARCHAR(50),
middle_initial CHAR,
last_name VARCHAR(50),
primary key (person_id));
create table ab_moral_person (
company_id integer,
name VARCHAR(100),
primary key (company_id));
create table in_inventory (
item_id integer,
descr VARCHAR(50),
stock integer,
primary key (item_id));
create table po_order (
po_id integer auto_increment,
cust_type char, /* arc relationship, see cust_id */
cust_id integer, /* FK to ab_physical_person *OR* ab_moral_person */
primary key (po_id));
create table po_order_line (
po_id integer, /* FK to po_order.po_id */
line_no integer,
item_id integer, /* FK to in_inventory.item_id */
qty integer);
#
# Schema integrity enforcement
#
create procedure check_pk_person(in person_type char, in id integer)
begin
declare x integer;
declare msg varchar(128);
/*
Test integrity constraints for an 'arc' relationship.
Based on 'person_type', 'id' points to either a
physical person, or a moral person.
*/
case person_type
when 'P' then
begin
select count(person_id) from ab_physical_person
where ab_physical_person.person_id = id
into x;
if (x != 1)
then
set msg= concat('No such physical person, PK:', id);
SIGNAL SQLSTATE '45000' SET
MESSAGE_TEXT = msg,
MYSQL_ERRNO = 10000;
end if;
end;
when 'M' then
begin
select count(company_id) from ab_moral_person
where ab_moral_person.company_id = id
into x;
if (x != 1)
then
set msg= concat('No such moral person, PK:', id);
SIGNAL SQLSTATE '45000' SET
MESSAGE_TEXT = msg,
MYSQL_ERRNO = 10000;
end if;
end;
else
begin
set msg= concat('No such person type:', person_type);
SIGNAL SQLSTATE '45000' SET
MESSAGE_TEXT = msg,
MYSQL_ERRNO = 20000;
end;
end case;
end
$$
create procedure check_pk_inventory(in id integer)
begin
declare x integer;
declare msg varchar(128);
select count(item_id) from in_inventory
where in_inventory.item_id = id
into x;
if (x != 1)
then
set msg= concat('Failed integrity constraint, table in_inventory, PK:',
id);
SIGNAL SQLSTATE '45000' SET
MESSAGE_TEXT = msg,
MYSQL_ERRNO = 10000;
end if;
end
$$
create procedure check_pk_order(in id integer)
begin
declare x integer;
declare msg varchar(128);
select count(po_id) from po_order
where po_order.po_id = id
into x;
if (x != 1)
then
set msg= concat('Failed integrity constraint, table po_order, PK:', id);
SIGNAL SQLSTATE '45000' SET
MESSAGE_TEXT = msg,
MYSQL_ERRNO = 10000;
end if;
end
$$
create trigger po_order_bi before insert on po_order
for each row
begin
call check_pk_person(NEW.cust_type, NEW.cust_id);
end
$$
create trigger po_order_bu before update on po_order
for each row
begin
call check_pk_person(NEW.cust_type, NEW.cust_id);
end
$$
create trigger po_order_line_bi before insert on po_order_line
for each row
begin
call check_pk_order(NEW.po_id);
call check_pk_inventory(NEW.item_id);
end
$$
create trigger po_order_line_bu before update on po_order_line
for each row
begin
call check_pk_order(NEW.po_id);
call check_pk_inventory(NEW.item_id);
end
$$
#
# Application helpers
#
create procedure po_create_order(
in p_cust_type char,
in p_cust_id integer,
out id integer)
begin
insert into po_order set cust_type = p_cust_type, cust_id = p_cust_id;
set id = last_insert_id();
end
$$
create procedure po_add_order_line(
in po integer,
in line integer,
in item integer,
in q integer)
begin
insert into po_order_line set
po_id = po, line_no = line, item_id = item, qty = q;
end
$$
#
# Create sample data
#
insert into ab_physical_person values
( 1, "John", "A", "Doe"),
( 2, "Marry", "B", "Smith")
;
insert into ab_moral_person values
( 3, "ACME real estate, INC"),
( 4, "Local school")
;
insert into in_inventory values
( 100, "Table, dinner", 5),
( 101, "Chair", 20),
( 200, "Table, coffee", 3),
( 300, "School table", 25),
( 301, "School chairs", 50)
;
select * from ab_physical_person order by person_id;
person_id first_name middle_initial last_name
1 John A Doe
2 Marry B Smith
select * from ab_moral_person order by company_id;
company_id name
3 ACME real estate, INC
4 Local school
select * from in_inventory order by item_id;
item_id descr stock
100 Table, dinner 5
101 Chair 20
200 Table, coffee 3
300 School table 25
301 School chairs 50
#
# Entering an order
#
set @my_po = 0;
/* John Doe wants 1 table and 4 chairs */
call po_create_order("P", 1, @my_po);
call po_add_order_line (@my_po, 1, 100, 1);
call po_add_order_line (@my_po, 2, 101, 4);
/* Marry Smith wants a coffee table */
call po_create_order("P", 2, @my_po);
call po_add_order_line (@my_po, 1, 200, 1);
#
# Entering bad data in an order
#
call po_add_order_line (@my_po, 1, 999, 1);
ERROR 45000: Failed integrity constraint, table in_inventory, PK:999
#
# Entering bad data in an unknown order
#
call po_add_order_line (99, 1, 100, 1);
ERROR 45000: Failed integrity constraint, table po_order, PK:99
#
# Entering an order for an unknown company
#
call po_create_order("M", 7, @my_po);
ERROR 45000: No such moral person, PK:7
#
# Entering an order for an unknown person type
#
call po_create_order("X", 1, @my_po);
ERROR 45000: No such person type:X
/* The local school wants 10 class tables and 20 chairs */
call po_create_order("M", 4, @my_po);
call po_add_order_line (@my_po, 1, 300, 10);
call po_add_order_line (@my_po, 2, 301, 20);
select * from po_order;
po_id cust_type cust_id
1 P 1
2 P 2
3 M 4
select * from po_order_line;
po_id line_no item_id qty
1 1 100 1
1 2 101 4
2 1 200 1
3 1 300 10
3 2 301 20
select po_id as "PO#",
( case cust_type
when "P" then concat (pp.first_name,
" ",
pp.middle_initial,
" ",
pp.last_name)
when "M" then mp.name
end ) as "Sold to"
from po_order po
left join ab_physical_person pp on po.cust_id = pp.person_id
left join ab_moral_person mp on po.cust_id = company_id
;
PO# Sold to
1 John A Doe
2 Marry B Smith
3 Local school
select po_id as "PO#",
ol.line_no as "Line",
ol.item_id as "Item",
inv.descr as "Description",
ol.qty as "Quantity"
from po_order_line ol, in_inventory inv
where inv.item_id = ol.item_id
order by ol.item_id, ol.line_no;
PO# Line Item Description Quantity
1 1 100 Table, dinner 1
1 2 101 Chair 4
2 1 200 Table, coffee 1
3 1 300 School table 10
3 2 301 School chairs 20
drop database demo;
drop database if exists demo;
create database demo;
use demo;
create procedure proc_top_a(p1 integer)
begin
## DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND
begin
end;
select "Starting ...";
call proc_middle_a(p1);
select "The end";
end
$$
create procedure proc_middle_a(p1 integer)
begin
DECLARE l integer;
# without RESIGNAL:
# Should be: DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND
DECLARE EXIT HANDLER for 1 /* not sure how to handle exceptions */
begin
select "Oops ... now what ?";
end;
select "In prod_middle()";
create temporary table t1(a integer, b integer);
select GET_LOCK("user_mutex", 10) into l;
insert into t1 set a = p1, b = p1;
call proc_bottom_a(p1);
select RELEASE_LOCK("user_mutex") into l;
drop temporary table t1;
end
$$
create procedure proc_bottom_a(p1 integer)
begin
select "In proc_bottom()";
if (p1 = 1) then
begin
select "Doing something that works ...";
select * from t1;
end;
end if;
if (p1 = 2) then
begin
select "Doing something that fail (simulate an error) ...";
drop table no_such_table;
end;
end if;
if (p1 = 3) then
begin
select "Doing something that *SHOULD* works ...";
select * from t1;
end;
end if;
end
$$
call proc_top_a(1);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that works ...
Doing something that works ...
a b
1 1
The end
The end
call proc_top_a(2);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that fail (simulate an error) ...
Doing something that fail (simulate an error) ...
ERROR 42S02: Unknown table 'no_such_table'
call proc_top_a(3);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
ERROR 42S01: Table 't1' already exists
call proc_top_a(1);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
ERROR 42S01: Table 't1' already exists
drop temporary table if exists t1;
create procedure proc_top_b(p1 integer)
begin
select "Starting ...";
call proc_middle_b(p1);
select "The end";
end
$$
create procedure proc_middle_b(p1 integer)
begin
DECLARE l integer;
DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND
begin
begin
DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND
begin
/* Ignore errors from the cleanup code */
end;
select "Doing cleanup !";
select RELEASE_LOCK("user_mutex") into l;
drop temporary table t1;
end;
RESIGNAL;
end;
select "In prod_middle()";
create temporary table t1(a integer, b integer);
select GET_LOCK("user_mutex", 10) into l;
insert into t1 set a = p1, b = p1;
call proc_bottom_b(p1);
select RELEASE_LOCK("user_mutex") into l;
drop temporary table t1;
end
$$
create procedure proc_bottom_b(p1 integer)
begin
select "In proc_bottom()";
if (p1 = 1) then
begin
select "Doing something that works ...";
select * from t1;
end;
end if;
if (p1 = 2) then
begin
select "Doing something that fail (simulate an error) ...";
drop table no_such_table;
end;
end if;
if (p1 = 3) then
begin
select "Doing something that *SHOULD* works ...";
select * from t1;
end;
end if;
end
$$
call proc_top_b(1);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that works ...
Doing something that works ...
a b
1 1
The end
The end
call proc_top_b(2);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that fail (simulate an error) ...
Doing something that fail (simulate an error) ...
Doing cleanup !
Doing cleanup !
ERROR 42S02: Unknown table 'no_such_table'
call proc_top_b(3);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that *SHOULD* works ...
Doing something that *SHOULD* works ...
a b
3 3
The end
The end
call proc_top_b(1);
Starting ...
Starting ...
In prod_middle()
In prod_middle()
In proc_bottom()
In proc_bottom()
Doing something that works ...
Doing something that works ...
a b
1 1
The end
The end
drop database demo;
SET @start_global_value = @@global.max_error_count;
SELECT @start_global_value;
@start_global_value
64
SET @start_session_value = @@session.max_error_count;
SELECT @start_session_value;
@start_session_value
64
drop database if exists demo;
create database demo;
use demo;
create procedure proc_1()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_1';
call proc_2();
end
$$
create procedure proc_2()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_2';
call proc_3();
end
$$
create procedure proc_3()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_3';
call proc_4();
end
$$
create procedure proc_4()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_4';
call proc_5();
end
$$
create procedure proc_5()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_5';
call proc_6();
end
$$
create procedure proc_6()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_6';
call proc_7();
end
$$
create procedure proc_7()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_7';
call proc_8();
end
$$
create procedure proc_8()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_8';
call proc_9();
end
$$
create procedure proc_9()
begin
declare exit handler for sqlexception
resignal sqlstate '45000' set message_text='Oops in proc_9';
## Do something that fails, to see how errors are reported
drop table oops_it_is_not_here;
end
$$
call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1051 Unknown table 'oops_it_is_not_here'
Error 1642 Oops in proc_9
Error 1642 Oops in proc_8
Error 1642 Oops in proc_7
Error 1642 Oops in proc_6
Error 1642 Oops in proc_5
Error 1642 Oops in proc_4
Error 1642 Oops in proc_3
Error 1642 Oops in proc_2
Error 1642 Oops in proc_1
SET @@session.max_error_count = 5;
SELECT @@session.max_error_count;
@@session.max_error_count
5
call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1642 Oops in proc_5
Error 1642 Oops in proc_4
Error 1642 Oops in proc_3
Error 1642 Oops in proc_2
Error 1642 Oops in proc_1
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
7
call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1642 Oops in proc_7
Error 1642 Oops in proc_6
Error 1642 Oops in proc_5
Error 1642 Oops in proc_4
Error 1642 Oops in proc_3
Error 1642 Oops in proc_2
Error 1642 Oops in proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
9
call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Error 1642 Oops in proc_9
Error 1642 Oops in proc_8
Error 1642 Oops in proc_7
Error 1642 Oops in proc_6
Error 1642 Oops in proc_5
Error 1642 Oops in proc_4
Error 1642 Oops in proc_3
Error 1642 Oops in proc_2
Error 1642 Oops in proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;
@@global.max_error_count
64
SET @@session.max_error_count = @start_session_value;
SELECT @@session.max_error_count;
@@session.max_error_count
64
SET @save_sql_mode=@@sql_mode;
SET sql_mode='';
drop procedure if exists p;
drop procedure if exists p2;
drop procedure if exists p3;
create procedure p()
begin
declare utf8_var VARCHAR(128) CHARACTER SET UTF8;
set utf8_var = concat(repeat('A', 128), 'X');
select length(utf8_var), utf8_var;
end
$$
create procedure p2()
begin
declare msg VARCHAR(129) CHARACTER SET UTF8;
set msg = concat(repeat('A', 128), 'X');
select length(msg), msg;
signal sqlstate '55555' set message_text = msg;
end
$$
create procedure p3()
begin
declare name VARCHAR(65) CHARACTER SET UTF8;
set name = concat(repeat('A', 64), 'X');
select length(name), name;
signal sqlstate '55555' set
message_text = 'Message',
table_name = name;
end
$$
call p;
length(utf8_var) utf8_var
128 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Warnings:
Warning 1265 Data truncated for column 'utf8_var' at row 1
call p2;
length(msg) msg
129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR 55555: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
call p3;
length(name) name
65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR 55555: Message
drop procedure p;
drop procedure p2;
drop procedure p3;
SET sql_mode='STRICT_ALL_TABLES';
create procedure p()
begin
declare utf8_var VARCHAR(128) CHARACTER SET UTF8;
set utf8_var = concat(repeat('A', 128), 'X');
select length(utf8_var), utf8_var;
end
$$
create procedure p2()
begin
declare msg VARCHAR(129) CHARACTER SET UTF8;
set msg = concat(repeat('A', 128), 'X');
select length(msg), msg;
signal sqlstate '55555' set message_text = msg;
end
$$
create procedure p3()
begin
declare name VARCHAR(65) CHARACTER SET UTF8;
set name = concat(repeat('A', 64), 'X');
select length(name), name;
signal sqlstate '55555' set
message_text = 'Message',
table_name = name;
end
$$
call p;
ERROR 22001: Data too long for column 'utf8_var' at row 1
call p2;
length(msg) msg
129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR HY000: Data too long for condition item 'MESSAGE_TEXT'
call p3;
length(name) name
65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR HY000: Data too long for condition item 'TABLE_NAME'
drop procedure p;
drop procedure p2;
drop procedure p3;
SET @@sql_mode=@save_sql_mode;
......@@ -97,8 +97,6 @@ end|
call p1()|
a
1
Warnings:
Note 1051 Unknown table 't1'
call p1()|
a
1
......@@ -371,9 +369,6 @@ call p1(@a)|
create table t1 (a int)
@rsql
create table t2 (a int)
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
select @a|
@a
0
......@@ -382,9 +377,6 @@ call p1(@a)|
create table t1 (a int)
@rsql
create table t2 (a int)
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
select @a|
@a
0
......
......@@ -110,24 +110,6 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value for column 'v1u' at row 1
Warning 1264 Out of range value for column 'v2' at row 1
Warning 1264 Out of range value for column 'v2u' at row 1
Warning 1264 Out of range value for column 'v3' at row 1
Warning 1264 Out of range value for column 'v3u' at row 1
Warning 1264 Out of range value for column 'v4' at row 1
Warning 1264 Out of range value for column 'v4u' at row 1
Warning 1264 Out of range value for column 'v5' at row 1
Warning 1264 Out of range value for column 'v5u' at row 1
Warning 1264 Out of range value for column 'v6' at row 1
Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1
Warning 1265 Data truncated for column 'v13' at row 1
Warning 1366 Incorrect integer value: 'Hello, world' for column 'v16' at row 1
Note 1265 Data truncated for column 'v18' at row 1
Note 1265 Data truncated for column 'v20' at row 1
CALL sp_vars_check_assignment();
i1 i2 i3 i4
......@@ -143,21 +125,6 @@ d1 d2 d3
d1 d2 d3
1234.00 1234.12 1234.12
Warnings:
Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value for column 'u2' at row 1
Warning 1264 Out of range value for column 'u3' at row 1
Warning 1264 Out of range value for column 'u4' at row 1
Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
......@@ -198,24 +165,6 @@ v7 v8 v9 v10 v11 v12 v13 v14 v15 v16
v17 v18 v19 v20
12.00 12.12 12.00 12.12
Warnings:
Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value for column 'v1u' at row 1
Warning 1264 Out of range value for column 'v2' at row 1
Warning 1264 Out of range value for column 'v2u' at row 1
Warning 1264 Out of range value for column 'v3' at row 1
Warning 1264 Out of range value for column 'v3u' at row 1
Warning 1264 Out of range value for column 'v4' at row 1
Warning 1264 Out of range value for column 'v4u' at row 1
Warning 1264 Out of range value for column 'v5' at row 1
Warning 1264 Out of range value for column 'v5u' at row 1
Warning 1264 Out of range value for column 'v6' at row 1
Warning 1264 Out of range value for column 'v6u' at row 1
Warning 1366 Incorrect integer value: 'String 10 ' for column 'v10' at row 1
Warning 1366 Incorrect integer value: 'String10' for column 'v11' at row 1
Warning 1265 Data truncated for column 'v12' at row 1
Warning 1265 Data truncated for column 'v13' at row 1
Warning 1366 Incorrect integer value: 'Hello, world' for column 'v16' at row 1
Note 1265 Data truncated for column 'v18' at row 1
Note 1265 Data truncated for column 'v20' at row 1
CALL sp_vars_check_assignment();
i1 i2 i3 i4
......@@ -231,21 +180,6 @@ d1 d2 d3
d1 d2 d3
1234.00 1234.12 1234.12
Warnings:
Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value for column 'i1' at row 1
Warning 1264 Out of range value for column 'i2' at row 1
Warning 1264 Out of range value for column 'i3' at row 1
Warning 1264 Out of range value for column 'i4' at row 1
Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value for column 'u2' at row 1
Warning 1264 Out of range value for column 'u3' at row 1
Warning 1264 Out of range value for column 'u4' at row 1
Warning 1264 Out of range value for column 'u1' at row 1
Warning 1264 Out of range value for column 'u2' at row 1
Note 1265 Data truncated for column 'd3' at row 1
Note 1265 Data truncated for column 'd3' at row 1
SELECT sp_vars_check_ret1();
sp_vars_check_ret1()
......@@ -451,10 +385,6 @@ FF
HEX(v10)
FF
Warnings:
Warning 1264 Out of range value for column 'v8' at row 1
Warning 1264 Out of range value for column 'v9' at row 1
Warning 1264 Out of range value for column 'v10' at row 1
Warning 1264 Out of range value for column 'v1' at row 1
Warning 1264 Out of range value for column 'v5' at row 1
DROP PROCEDURE p1;
......
......@@ -526,8 +526,6 @@ end|
delete from t1|
create table t3 ( s char(16), d int)|
call into_test4()|
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from t3|
s d
into4 NULL
......@@ -1120,8 +1118,6 @@ end|
select f9()|
f9()
6
Warnings:
Note 1051 Unknown table 't3'
select f9() from t1 limit 1|
f9()
6
......@@ -1162,8 +1158,6 @@ drop temporary table t3|
select f12_1()|
f12_1()
3
Warnings:
Note 1051 Unknown table 't3'
select f12_1() from t1 limit 1|
f12_1()
3
......@@ -2069,12 +2063,7 @@ end if;
insert into t4 values (2, rc, t3);
end|
call bug1863(10)|
Warnings:
Note 1051 Unknown table 'temp_t1'
Warning 1329 No data - zero rows fetched, selected, or processed
call bug1863(10)|
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
select * from t4|
f1 rc t3
2 0 NULL
......@@ -2339,11 +2328,7 @@ begin
end|
call bug4579_1()|
call bug4579_1()|
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
call bug4579_1()|
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
drop procedure bug4579_1|
drop procedure bug4579_2|
drop table t3|
......@@ -3736,9 +3721,6 @@ Table Create Table
tm1 CREATE TEMPORARY TABLE `tm1` (
`spv1` decimal(3,3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Warnings:
Warning 1264 Out of range value for column 'spv1' at row 1
Warning 1366 Incorrect decimal value: 'test' for column 'spv1' at row 1
call bug12589_2()|
Table Create Table
tm1 CREATE TEMPORARY TABLE `tm1` (
......@@ -6106,35 +6088,6 @@ bug5274_f2()
x
Warnings:
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
Warning 1265 Data truncated for column 'bug5274_f1' at row 1
DROP FUNCTION bug5274_f1|
DROP FUNCTION bug5274_f2|
drop procedure if exists proc_21513|
......@@ -6229,20 +6182,17 @@ f1(2)
0
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
Warning 1329 No data - zero rows fetched, selected, or processed
PREPARE s1 FROM 'SELECT f1(2)';
EXECUTE s1;
f1(2)
0
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
Warning 1329 No data - zero rows fetched, selected, or processed
EXECUTE s1;
f1(2)
0
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
Warning 1329 No data - zero rows fetched, selected, or processed
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP FUNCTION f1;
......@@ -6254,6 +6204,7 @@ create procedure mysqltest_db1.sp_bug28551() begin end;
call mysqltest_db1.sp_bug28551();
show warnings;
Level Code Message
Note 1008 Can't drop database 'mysqltest_db1'; database doesn't exist
drop database mysqltest_db1;
drop database if exists mysqltest_db1;
drop table if exists test.t1;
......
......@@ -21,9 +21,11 @@ end|
call bug4902_2()|
show warnings|
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
call bug4902_2()|
show warnings|
Level Code Message
Note 1305 PROCEDURE bug4902_2 does not exist
drop procedure bug4902_2|
drop table if exists t1|
create table t1 (
......
......@@ -315,8 +315,8 @@ MOD(col1,0)
NULL
NULL
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT INTO t1 (col1) VALUES(-129);
ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(128);
......@@ -343,7 +343,7 @@ SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1;
MOD(col1,0)
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
ERROR 22003: Out of range value for column 'col1' at row 1
UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0;
......@@ -353,16 +353,16 @@ ERROR 22012: Division by 0
set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
INSERT INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
set @@sql_mode='ansi,traditional';
SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
MOD(col1,0)
NULL
NULL
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR HY000: Incorrect integer value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
......@@ -374,8 +374,8 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
set @@sql_mode='ansi';
INSERT INTO t1 values (1/0,1/0);
set @@sql_mode='ansi,traditional';
......@@ -457,8 +457,8 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-32769,-1),(32768,65536);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -541,8 +541,8 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-8388609,-1),(8388608,16777216);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -625,8 +625,8 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 values (-2147483649, -1),(2147643648,4294967296);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -707,8 +707,8 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0,1/0);
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -794,7 +794,7 @@ Warnings:
Note 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(1000),(-1000);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -861,7 +861,7 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES (1/0);
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39);
Warnings:
Warning 1264 Out of range value for column 'col1' at row 1
......@@ -910,7 +910,7 @@ Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) values (1/0);
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
ERROR 22007: Illegal double '1.9E+309' value found during parsing
INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
......@@ -1080,13 +1080,13 @@ Warnings:
Warning 1292 Truncated incorrect datetime value: '31.10.2004 15.30 abc'
insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
Warnings:
Error 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
Warning 1411 Incorrect datetime value: '32.10.2004 15.30' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
Warnings:
Error 1411 Incorrect time value: '22:22:33 AM' for function str_to_date
Warning 1411 Incorrect time value: '22:22:33 AM' for function str_to_date
insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
Warnings:
Error 1411 Incorrect time value: 'abc' for function str_to_date
Warning 1411 Incorrect time value: 'abc' for function str_to_date
insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));
insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));
insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));
......@@ -1104,9 +1104,9 @@ select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') I
count(*)
7
Warnings:
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Error 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
Warning 1411 Incorrect datetime value: '2004.12.12 10:22:61' for function str_to_date
drop table t1;
create table t1 (col1 char(3), col2 integer);
insert into t1 (col1) values (cast(1000 as char(3)));
......
......@@ -1073,7 +1073,7 @@ NULL
SET @x=2;
UPDATE t1 SET i1 = @x;
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
SELECT @x;
@x
NULL
......@@ -1086,8 +1086,8 @@ NULL
SET @x=4;
UPDATE t1 SET i1 = @x;
Warnings:
Error 1365 Division by 0
Error 1365 Division by 0
Warning 1365 Division by 0
Warning 1365 Division by 0
SELECT @x;
@x
NULL
......@@ -1190,16 +1190,16 @@ create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1|
insert into t1 values(10, 10)|
set @a:=1/0|
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select 1/0 from t1|
1/0
NULL
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
create trigger t1_bi before insert on t1 for each row set @a:=1/0|
insert into t1 values(20, 20)|
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
drop trigger t1_bi|
create trigger t1_bi before insert on t1 for each row
begin
......@@ -1219,7 +1219,7 @@ end|
set @check=0, @t4_bi_called=0, @t4_bu_called=0|
insert into t1 values(30, 30)|
Warnings:
Error 1365 Division by 0
Warning 1365 Division by 0
select @check, @t4_bi_called, @t4_bu_called|
@check @t4_bi_called @t4_bu_called
2 1 1
......
This diff is collapsed.
......@@ -1111,8 +1111,8 @@ insert into v1 values(3);
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (2),(3),(0);
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1;
a
1
......@@ -1125,8 +1125,8 @@ create table t2 (a int);
insert into t2 values (2),(3),(0);
insert ignore into v1 SELECT a from t2;
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1 order by a desc;
a
1
......@@ -1148,7 +1148,7 @@ a
update v1 set a=a+1;
update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1;
a
1
......@@ -1182,7 +1182,7 @@ insert into v1 values (1) on duplicate key update a=2;
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (1) on duplicate key update a=2;
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1;
a
1
......@@ -1283,7 +1283,7 @@ insert ignore into v1 values (6);
ERROR HY000: CHECK OPTION failed 'test.v1'
insert ignore into v1 values (6),(3);
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1;
s1
3
......@@ -1328,9 +1328,9 @@ delete from t1;
load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1 order by a,b;
a b
1 row 1
......@@ -1354,7 +1354,7 @@ concat('|',a,'|') concat('|',b,'|')
delete from t1;
load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1369 CHECK OPTION failed 'test.v1'
Warning 1261 Row 2 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
......
......@@ -34,7 +34,7 @@ purge binary logs TO 'master-bin.000002';
ERROR HY000: Fatal error during log purge
show warnings;
Level Code Message
Error 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
Warning 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
Error 1377 Fatal error during log purge
reset master;
End of tests
......@@ -43,12 +43,6 @@ END|
CALL proc();
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
---- Insert from stored function ----
CREATE FUNCTION func()
RETURNS INT
......@@ -67,12 +61,6 @@ func()
0
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
---- Insert from trigger ----
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
......@@ -90,12 +78,6 @@ INSERT INTO trigger_table VALUES ('bye.');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
---- Insert from prepared statement ----
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
......@@ -155,12 +137,6 @@ func5()
0
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
==== Variables that should *not* be unsafe ====
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
......@@ -215,9 +191,6 @@ END|
CALL p1();
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
......
This diff is collapsed.
......@@ -204,7 +204,7 @@ b int
ERROR HY000: Can't create table 'test.t1' (errno: 906)
show warnings;
Level Code Message
Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB
Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 (
pk1 int not null primary key,
......@@ -214,7 +214,7 @@ key(b)
ERROR HY000: Can't create table 'test.t1' (errno: 906)
show warnings;
Level Code Message
Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
Warning 1296 Got error 906 'Unsupported attribute type in index' from NDB
Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 (
pk1 int primary key,
......
......@@ -8,20 +8,20 @@ INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=MYISAM;
Warnings:
Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=XYZ;
Warnings:
Warning 1286 Unknown table engine 'XYZ'
Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M;
Warnings:
Error 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
Warning 1478 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
set storage_engine=ndb;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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