summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-08-01 20:24:30 +0200
committerunknown <msvensson@neptunus.(none)>2006-08-01 20:24:30 +0200
commit1081dd6f0da5814fecad628d509e71c250ad1730 (patch)
tree846b441c9730546494aa063e2bc4f74751efde48
parentedeea349b9cf8125c3ca19eff144b1334fddad28 (diff)
parent2660a6bb5936a215876468e94fb88b3f0c58f3bf (diff)
downloadmariadb-git-1081dd6f0da5814fecad628d509e71c250ad1730.tar.gz
Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint configure.in: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/federated.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/mysql.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/mysql.test: Auto merged sql/field.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_yacc.yy: Auto merged
-rw-r--r--client/Makefile.am4
-rw-r--r--client/mysql.cc5
-rw-r--r--client/mysqldump.c7
-rw-r--r--client/mysqlimport.c2
-rw-r--r--client/mysqltest.c12
-rw-r--r--configure.in15
-rw-r--r--dbug/dbug.c5
-rw-r--r--extra/perror.c32
-rwxr-xr-xmysql-test/mysql-test-run.pl15
-rw-r--r--mysql-test/r/cast.result11
-rw-r--r--mysql-test/r/date_formats.result4
-rw-r--r--mysql-test/r/delete.result10
-rw-r--r--mysql-test/r/federated.result4
-rw-r--r--mysql-test/r/fulltext_distinct.result2
-rw-r--r--mysql-test/r/fulltext_update.result2
-rw-r--r--mysql-test/r/func_compress.result28
-rw-r--r--mysql-test/r/func_group.result14
-rw-r--r--mysql-test/r/func_time.result72
-rw-r--r--mysql-test/r/gis-rtree.result6
-rw-r--r--mysql-test/r/gis.result2
-rw-r--r--mysql-test/r/have_perror.require2
-rw-r--r--mysql-test/r/join_outer.result2
-rw-r--r--mysql-test/r/mysql.result11
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/r/ndb_basic.result1
-rw-r--r--mysql-test/r/order_by.result2
-rw-r--r--mysql-test/r/perror.result1
-rw-r--r--mysql-test/r/strict.result20
-rw-r--r--mysql-test/r/type_blob.result20
-rw-r--r--mysql-test/r/type_datetime.result4
-rw-r--r--mysql-test/r/type_ranges.result3
-rw-r--r--mysql-test/r/user_var.result36
-rw-r--r--mysql-test/t/cast.test14
-rw-r--r--mysql-test/t/delete.test11
-rw-r--r--mysql-test/t/func_compress.test14
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_time.test31
-rw-r--r--mysql-test/t/mysql.test15
-rw-r--r--mysql-test/t/mysqltest.test15
-rw-r--r--mysql-test/t/ndb_basic.test10
-rw-r--r--mysql-test/t/perror.test19
-rw-r--r--mysql-test/t/strict.test18
-rw-r--r--mysql-test/t/type_blob.test15
-rw-r--r--mysql-test/t/user_var.test31
-rw-r--r--ndb/src/kernel/error/ndbd_exit_codes.c2
-rw-r--r--sql-common/my_time.c4
-rw-r--r--sql/field.cc21
-rw-r--r--sql/item_func.cc24
-rw-r--r--sql/item_func.h6
-rw-r--r--sql/item_strfunc.cc10
-rw-r--r--sql/item_strfunc.h2
-rw-r--r--sql/item_subselect.cc1
-rw-r--r--sql/item_sum.cc3
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/item_timefunc.cc15
-rw-r--r--sql/mysqld.cc5
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_delete.cc8
-rw-r--r--sql/sql_udf.cc2
-rw-r--r--sql/sql_yacc.yy2
60 files changed, 614 insertions, 58 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 5787905fd35..b80357f68ea 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -47,7 +47,9 @@ mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
-mysqldump_SOURCES= mysqldump.c my_user.c $(yassl_dummy_link_fix)
+mysqldump_SOURCES= mysqldump.c my_user.c \
+ $(top_srcdir)/mysys/mf_getdate.c \
+ $(yassl_dummy_link_fix)
mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix)
mysql_upgrade_SOURCES= mysql_upgrade.c $(yassl_dummy_link_fix)
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
diff --git a/client/mysql.cc b/client/mysql.cc
index 94b43d030e8..25faf91b25d 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2858,7 +2858,7 @@ com_connect(String *buffer, char *line)
bzero(buff, sizeof(buff));
if (buffer)
{
- strmov(buff, line);
+ strmake(buff, line, sizeof(buff));
tmp= get_arg(buff, 0);
if (tmp && *tmp)
{
@@ -3724,6 +3724,9 @@ static const char* construct_prompt()
case 't':
processed_prompt.append('\t');
break;
+ case 'l':
+ processed_prompt.append(delimiter_str);
+ break;
default:
processed_prompt.append(c);
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index e3c13bb0451..56260733db5 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -565,6 +565,13 @@ static void write_footer(FILE *sql_file)
fprintf(sql_file,
"/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n");
fputs("\n", sql_file);
+ if (opt_comments)
+ {
+ char time_str[20];
+ get_date(time_str, GETDATE_DATE_TIME, 0);
+ fprintf(sql_file, "-- Dump completed on %s\n",
+ time_str);
+ }
check_io(sql_file);
}
} /* write_footer */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 1f9b96f91be..67659684c9c 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -521,7 +521,7 @@ int main(int argc, char **argv)
return(1); /* purecov: deadcode */
}
- if (mysql_query(sock, "set @@character_set_database=binary;"))
+ if (mysql_query(sock, "/*!40101 set @@character_set_database=binary */;"))
{
db_error(sock); /* We shall countinue here, if --force was given */
return(1);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 2fc09fbc3d2..549c6e85837 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -177,7 +177,7 @@ typedef struct
static test_file file_stack[MAX_INCLUDE_DEPTH];
static test_file* cur_file;
static test_file* file_stack_end;
-uint start_lineno; /* Start line of query */
+uint start_lineno= 0; /* Start line of query */
static char TMPDIR[FN_REFLEN];
static char delimiter[MAX_DELIMITER]= DEFAULT_DELIMITER;
@@ -620,7 +620,7 @@ static void die(const char *fmt, ...)
if (cur_file && cur_file != file_stack)
fprintf(stderr, "In included file \"%s\": ",
cur_file->file_name);
- if (start_lineno != 0)
+ if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
@@ -4757,6 +4757,14 @@ int main(int argc, char **argv)
q->require_file=require_file;
save_file[0]=0;
}
+ /*
+ To force something being sent as a query to the mysqld one can
+ use the prefix "query". Remove "query" from string before executing
+ */
+ if (strncmp(q->query, "query ", 6) == 0)
+ {
+ q->query= q->first_argument;
+ }
run_query(&cur_con->mysql, q, flags);
query_executed= 1;
q->last_argument= q->end;
diff --git a/configure.in b/configure.in
index b49dffcb59f..3430bd8a5b5 100644
--- a/configure.in
+++ b/configure.in
@@ -1655,17 +1655,20 @@ AC_ARG_WITH(debug,
if test "$with_debug" = "yes"
then
# Medium debug.
- CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DDBUG_ON -DSAFE_MUTEX $CXXFLAGS"
+ AC_DEFINE([DBUG_ON], [1], [Use libdbug])
+ CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
- CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
- CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+ AC_DEFINE([DBUG_ON], [1], [Use libdbug])
+ CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
+ CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
- CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"
- CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
+ AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
+ CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
+ CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
fi
# Force static compilation to avoid linking problems/get more speed
diff --git a/dbug/dbug.c b/dbug/dbug.c
index c991daf3617..575481305e7 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -66,10 +66,13 @@
* Check of malloc on entry/exit (option "S")
*/
+#include <my_global.h>
+
+/* This file won't compile unless DBUG_OFF is undefined locally */
#ifdef DBUG_OFF
#undef DBUG_OFF
#endif
-#include <my_global.h>
+
#include <m_string.h>
#include <errno.h>
#if defined(MSDOS) || defined(__WIN__)
diff --git a/extra/perror.c b/extra/perror.c
index 82311c1b2c9..b26e516a101 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -218,8 +218,11 @@ int main(int argc,char *argv[])
On some system, like NETWARE, strerror(unknown_error) returns a
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
+
+ On Solaris 2.8 it might return NULL
*/
- msg= strerror(10000);
+ if ((msg= strerror(10000)) == NULL)
+ msg= "Unknown Error";
/*
Allocate a buffer for unknown_error since strerror always returns
@@ -258,7 +261,7 @@ int main(int argc,char *argv[])
found= 1;
msg= 0;
}
- else
+ else
#endif
msg = strerror(code);
@@ -278,20 +281,23 @@ int main(int argc,char *argv[])
else
puts(msg);
}
- if (!(msg=get_ha_error_msg(code)))
+
+ if (!found)
{
- if (!found)
- {
+ /* Error message still not found, look in handler error codes */
+ if (!(msg=get_ha_error_msg(code)))
+ {
fprintf(stderr,"Illegal error code: %d\n",code);
error=1;
- }
- }
- else
- {
- if (verbose)
- printf("MySQL error code %3d: %s\n",code,msg);
- else
- puts(msg);
+ }
+ else
+ {
+ found= 1;
+ if (verbose)
+ printf("MySQL error code %3d: %s\n",code,msg);
+ else
+ puts(msg);
+ }
}
}
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 91a9a758d1d..f029924e292 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -187,6 +187,7 @@ our $exe_mysqltest;
our $exe_slave_mysqld;
our $exe_im;
our $exe_my_print_defaults;
+our $exe_perror;
our $lib_udf_example;
our $exe_libtool;
@@ -811,6 +812,13 @@ sub command_line_setup () {
$opt_with_ndbcluster= 0;
}
+ # Check IM arguments
+ if ( $glob_win32 )
+ {
+ mtr_report("Disable Instance manager - not supported on Windows");
+ $opt_skip_im= 1;
+ }
+
# Check valgrind arguments
if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options)
{
@@ -1048,6 +1056,8 @@ sub executable_setup () {
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
+ $exe_perror=
+ mtr_exe_exists("$path_client_bindir/perror");
}
else
{
@@ -1060,6 +1070,8 @@ sub executable_setup () {
"$glob_basedir/server-tools/instance-manager/mysqlmanager");
$exe_my_print_defaults=
mtr_exe_exists("$glob_basedir/extra/my_print_defaults");
+ $exe_perror=
+ mtr_exe_exists("$glob_basedir/extra/perror");
}
if ( $glob_use_embedded_server )
@@ -1107,6 +1119,8 @@ sub executable_setup () {
"$glob_basedir/scripts/mysql_fix_privilege_tables");
$exe_my_print_defaults=
mtr_exe_exists("$path_client_bindir/my_print_defaults");
+ $exe_perror=
+ mtr_exe_exists("$path_client_bindir/perror");
$path_language= mtr_path_exists("$glob_basedir/share/mysql/english/",
"$glob_basedir/share/english/");
@@ -3103,6 +3117,7 @@ sub run_mysqltest ($) {
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
$ENV{'UDF_EXAMPLE_LIB'}=
($lib_udf_example ? basename($lib_udf_example) : "");
+ $ENV{'MY_PERROR'}= $exe_perror;
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_data_dir;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index d60efa083e0..a07ca21652b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -381,3 +381,14 @@ DROP TABLE t1;
select cast(NULL as decimal(6)) as t1;
t1
NULL
+set names latin1;
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+select hex(cast('a' as binary(2)));
+hex(cast('a' as binary(2)))
+6100
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+End of 5.0 tests
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 08ed5fc6439..bbe3aee1fb0 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -449,6 +449,8 @@ create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
describe t1;
Field Type Null Key Default Extra
f1 datetime YES NULL
@@ -458,7 +460,7 @@ f4 date YES NULL
f5 time YES NULL
select * from t1;
f1 f2 f3 f4 f5
-2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
+2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00
drop table t1;
create table t1 select "02 10" as a, "%d %H" as b;
select str_to_date(a,b) from t1;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 05f1c967e77..0946dc8f809 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -192,3 +192,13 @@ delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
select * from t3;
a b
drop table t1,t2,t3;
+create table t1(a date not null);
+insert into t1 values (0);
+select * from t1 where a is null;
+a
+0000-00-00
+delete from t1 where a is null;
+select count(*) from t1;
+count(*)
+0
+drop table t1;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 5d17afd8cfc..454790f2df6 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -967,6 +967,8 @@ CREATE TABLE federated.t1 (
`blurb` text default '',
PRIMARY KEY (blurb_id))
DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`blurb_id` int NOT NULL DEFAULT 0,
@@ -975,6 +977,8 @@ PRIMARY KEY (blurb_id))
ENGINE="FEDERATED"
DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+Warnings:
+Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
diff --git a/mysql-test/r/fulltext_distinct.result b/mysql-test/r/fulltext_distinct.result
index de0668ff28c..7fd42fab646 100644
--- a/mysql-test/r/fulltext_distinct.result
+++ b/mysql-test/r/fulltext_distinct.result
@@ -8,6 +8,8 @@ KEY kt(tag),
KEY kv(value(15)),
FULLTEXT KEY kvf(value)
) ENGINE=MyISAM;
+Warnings:
+Warning 1101 BLOB/TEXT column 'value' can't have a default value
CREATE TABLE t2 (
id_t2 mediumint unsigned NOT NULL default '0',
id_t1 mediumint unsigned NOT NULL default '0',
diff --git a/mysql-test/r/fulltext_update.result b/mysql-test/r/fulltext_update.result
index 5d3f95b318c..4a615c88fdd 100644
--- a/mysql-test/r/fulltext_update.result
+++ b/mysql-test/r/fulltext_update.result
@@ -9,6 +9,8 @@ name VARCHAR(80) DEFAULT '' NOT NULL,
FULLTEXT(url,description,shortdesc,longdesc),
PRIMARY KEY(gnr)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'longdesc' can't have a default value
insert into test (url,shortdesc,longdesc,description,name) VALUES
("http:/test.at", "kurz", "lang","desc", "name");
insert into test (url,shortdesc,longdesc,description,name) VALUES
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index e3d31566741..00d5ebfc351 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -79,3 +79,31 @@ uncompress(a) uncompressed_length(a)
NULL NULL
a 1
drop table t1;
+create table t1 (a varchar(32) not null);
+insert into t1 values ('foo');
+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
+select * from t1 where uncompress(a) is null;
+a
+foo
+Warnings:
+Error 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
+select *, uncompress(a) from t1;
+a uncompress(a)
+foo NULL
+Warnings:
+Error 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
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index f693c6190d5..dae856c4845 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -988,3 +988,17 @@ SUM(a)
6
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
+create table t1 select variance(0);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `variance(0)` double(8,4) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 select stddev(0);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `stddev(0)` double(8,4) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index db696f61fed..c7db2fc6364 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -667,6 +667,78 @@ timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
a1 a2 a3 a4
28 28 29 29
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27')
+0
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27')
+1
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28')
+2
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29');
+TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29')
+2
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27')
+0
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27')
+1
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28')
+2
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29');
+TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29')
+2
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27')
+0
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27')
+1
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28')
+2
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29');
+TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29')
+2
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27')
+0
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27')
+1
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28')
+2
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29');
+TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29')
+2
select date_add(time,INTERVAL 1 SECOND) from t1;
date_add(time,INTERVAL 1 SECOND)
NULL
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 28c59053435..b283d64395d 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -804,6 +804,8 @@ INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
@@ -820,6 +822,8 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
@@ -834,6 +838,8 @@ CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 7a0f689df36..e37dca9e86c 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -583,6 +583,8 @@ t1 CREATE TABLE `t1` (
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
geometry NOT NULL default '') ENGINE=MyISAM ;
+Warnings:
+Warning 1101 BLOB/TEXT column 'geo' can't have a default value
insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
diff --git a/mysql-test/r/have_perror.require b/mysql-test/r/have_perror.require
new file mode 100644
index 00000000000..260687c87f0
--- /dev/null
+++ b/mysql-test/r/have_perror.require
@@ -0,0 +1,2 @@
+have_perror
+1
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index eae023813b5..a983b32ba46 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -598,6 +598,8 @@ id int(11) DEFAULT '0' NOT NULL,
name tinytext DEFAULT '' NOT NULL,
UNIQUE id (id)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'name' can't have a default value
INSERT INTO t1 VALUES (1,'yes'),(2,'no');
CREATE TABLE t2 (
id int(11) DEFAULT '0' NOT NULL,
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index d70366a7589..9e426b6df46 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -104,4 +104,15 @@ c_cp932
| 2 | NULL |
| 3 | |
+------+------+
+create table t1(a int, b varchar(255), c int);
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b varchar(255) YES NULL
+c int(11) YES NULL
+Field Type Null Key Default Extra
+a int(11) YES NULL
+b varchar(255) YES NULL
+c int(11) YES NULL
+drop table t1;
+ERROR 1049 (42000) at line 1: Unknown database 'verylongdatabasenamethatshouldblowthe256byteslongbufferincom_con'
End of 5.0 tests
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 8055a33ec7d..d9ca863b6bc 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -441,3 +441,9 @@ select-me
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1
drop table t1;
drop table t1;
+sleep;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
+sleep;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
+;
+ERROR 42000: Query was empty
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index 09c4f9b29f9..d2111db24fe 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -748,3 +748,4 @@ f1 f2 f3
111111 aaaaaa 1
222222 bbbbbb 2
drop table t1;
+Illegal ndb error code: 1186
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index a36935a583d..9756ab49ac7 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -280,6 +280,8 @@ info text NOT NULL default '',
ipnr varchar(30) NOT NULL default '',
PRIMARY KEY (member_id)
) ENGINE=MyISAM PACK_KEYS=1;
+Warnings:
+Warning 1101 BLOB/TEXT column 'info' can't have a default value
insert into t1 (member_id) values (1),(2),(3);
select member_id, nickname, voornaam FROM t1
ORDER by lastchange_datum DESC LIMIT 2;
diff --git a/mysql-test/r/perror.result b/mysql-test/r/perror.result
new file mode 100644
index 00000000000..4946523bc42
--- /dev/null
+++ b/mysql-test/r/perror.result
@@ -0,0 +1 @@
+Illegal error code: 10000
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index d0cf11d0511..08a33734910 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -5,7 +5,9 @@ select @@sql_mode;
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
-INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29');
+INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
+INSERT INTO t1 VALUES('0000-10-31');
+ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
@@ -54,7 +56,6 @@ Warning 1265 Data truncated for column 'col1' at row 3
select * from t1;
col1
2004-01-01
-0000-10-31
2004-02-29
2004-01-02
2004-01-03
@@ -121,7 +122,9 @@ col1
drop table t1;
set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('0000-10-31 15:30:00');
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
@@ -141,7 +144,6 @@ ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1
select * from t1;
col1
2004-10-31 15:30:00
-0000-10-31 15:30:00
2004-02-29 15:30:00
drop table t1;
CREATE TABLE t1 (col1 timestamp);
@@ -204,6 +206,7 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -219,6 +222,7 @@ ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_ti
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -255,6 +259,7 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
@@ -262,6 +267,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -269,7 +275,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -282,6 +288,7 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
@@ -289,6 +296,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -296,7 +304,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
+ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 4fd220045c2..73b67a2241e 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -503,6 +503,8 @@ foobar boggle
fish 10
drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
select
charset(load_file('../../std_data/words.dat')),
@@ -788,3 +790,21 @@ NULL
616100000000
620000000000
drop table t1;
+create table t1 (a text default '');
+Warnings:
+Warning 1101 BLOB/TEXT column 'a' can't have a default value
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` text
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values (default);
+select * from t1;
+a
+NULL
+drop table t1;
+set @@sql_mode='TRADITIONAL';
+create table t1 (a text default '');
+ERROR 42000: BLOB/TEXT column 'a' can't have a default value
+set @@sql_mode='';
+End of 5.0 tests
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 85f899be5d8..2addb9c93eb 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -26,6 +26,8 @@ Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
+Warnings:
+Warning 1264 Out of range value adjusted for column 't' at row 5
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
@@ -34,7 +36,7 @@ t
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
-0000-01-01 00:00:00
+0000-00-00 00:00:00
0001-01-01 00:00:00
9999-12-31 00:00:00
2000-10-10 00:00:00
diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
index 1310a5b71dd..ec8211dc4bf 100644
--- a/mysql-test/r/type_ranges.result
+++ b/mysql-test/r/type_ranges.result
@@ -38,6 +38,9 @@ KEY (ulong),
KEY (ulonglong,ulong),
KEY (options,flags)
);
+Warnings:
+Warning 1101 BLOB/TEXT column 'mediumblob_col' can't have a default value
+Warning 1101 BLOB/TEXT column 'longblob_col' can't have a default value
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned NULL NO PRI NULL auto_increment #
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 7439f9132fb..3a197cd2a47 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -256,3 +256,39 @@ t1 CREATE TABLE `t1` (
`@first_var` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+set @a=18446744071710965857;
+select @a;
+@a
+18446744071710965857
+CREATE TABLE `bigfailure` (
+`afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+afield
+18446744071710965857
+select * from (SELECT afield FROM bigfailure) as b;
+afield
+18446744071710965857
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965857;
+afield
+18446744071710965857
+select * from bigfailure where afield = 18446744071710965856+1;
+afield
+18446744071710965857
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+@a
+18446744071710965857
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+@a
+18446744071710965857
+drop table bigfailure;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 533da542855..ecc92ed01d1 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -204,7 +204,19 @@ SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
DROP TABLE t1;
-# Bug @10237 (CAST(NULL DECIMAL) crashes server)
+
+#
+# Bug #10237 (CAST(NULL DECIMAL) crashes server)
#
select cast(NULL as decimal(6)) as t1;
+
+#
+# Bug #17903: cast to char results in binary
+#
+set names latin1;
+select hex(cast('a' as char(2) binary));
+select hex(cast('a' as binary(2)));
+select hex(cast('a' as char(2) binary));
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index 4284bd2a06d..677ffaa2860 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -171,3 +171,14 @@ delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
# This should be empty
select * from t3;
drop table t1,t2,t3;
+
+#
+# Bug #8143: deleting '0000-00-00' values using IS NULL
+#
+
+create table t1(a date not null);
+insert into t1 values (0);
+select * from t1 where a is null;
+delete from t1 where a is null;
+select count(*) from t1;
+drop table t1;
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 4ae749f2343..eeb5d509b94 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -57,3 +57,17 @@ select uncompress(a), uncompressed_length(a) from t1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #18539: uncompress(d) is null: impossible?
+#
+create table t1 (a varchar(32) not null);
+insert into t1 values ('foo');
+explain select * from t1 where uncompress(a) is null;
+select * from t1 where uncompress(a) is null;
+explain select *, uncompress(a) from t1;
+select *, uncompress(a) from t1;
+select *, uncompress(a), uncompress(a) is null from t1;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index e8c5fa18a25..ff8f7eb2d72 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -660,3 +660,14 @@ SELECT SUM(a) FROM t1 GROUP BY b/c;
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
+#
+# Bug #10966: Variance functions return wrong data type
+#
+
+create table t1 select variance(0);
+show create table t1;
+drop table t1;
+create table t1 select stddev(0);
+show create table t1;
+drop table t1;
+ \ No newline at end of file
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 6aaf51b0acb..c95d3e3319a 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -318,6 +318,37 @@ select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
+# bug 16226
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28');
+SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29');
+
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28');
+SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29');
+
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28');
+SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29');
+
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28');
+SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29');
+
+# end of bug
+
select date_add(time,INTERVAL 1 SECOND) from t1;
drop table t1;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 98fadcfc75d..9d412c43bb5 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -77,6 +77,21 @@ drop table t1;
#
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
+#
+# Bug#19265 describe command does not work from mysql prompt
+#
+
+create table t1(a int, b varchar(255), c int);
+--exec $MYSQL test -e "desc t1"
+--exec $MYSQL test -e "desc t1\g"
+drop table t1;
+
+#
+# Bug#21042 mysql client segfaults on importing a mysqldump export
+#
+--error 1
+--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 3968eb519e1..6a0b805f43b 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1125,3 +1125,18 @@ drop table t1;
drop table t1;
+#
+# Bug#19890 mysqltest: "query" command is broken
+#
+
+# It should be possible to use the command "query" to force mysqltest to
+# send the command to the server although it's a builtin mysqltest command.
+--error 1064
+query sleep;
+
+--error 1064
+--query sleep
+
+# Just an empty query command
+--error 1065
+query ;
diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test
index 5d79d5eb9f9..6c1a4e44f4b 100644
--- a/mysql-test/t/ndb_basic.test
+++ b/mysql-test/t/ndb_basic.test
@@ -700,3 +700,13 @@ select * from t1 order by f1;
select * from t1 order by f2;
select * from t1 order by f3;
drop table t1;
+
+#
+# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror
+#
+
+# As long there is no error code 1186 defined by NDB
+# we should get a message "Illegal ndb error code: 1186"
+--error 1
+--exec $MY_PERROR --ndb 1186 2>&1
+
diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test
new file mode 100644
index 00000000000..a4b99d8aa22
--- /dev/null
+++ b/mysql-test/t/perror.test
@@ -0,0 +1,19 @@
+#
+# Check if the variable MY_PERROR is set
+#
+--require r/have_perror.require
+disable_query_log;
+eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
+enable_query_log;
+
+--exec $MY_PERROR 150 > /dev/null
+--exec $MY_PERROR --silent 120 > /dev/null
+
+#
+# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror
+#
+
+# Test with error code 10000 as it's a common "unknown error"
+# As there is no error code defined for 10000, expect error
+--error 1
+--exec $MY_PERROR 10000 2>&1
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index ce269b42ee9..6f22b81172d 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -13,7 +13,9 @@ DROP TABLE IF EXISTS t1;
# Test INSERT with DATE
CREATE TABLE t1 (col1 date);
-INSERT INTO t1 VALUES('2004-01-01'),('0000-10-31'),('2004-02-29');
+INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
+--error 1292
+INSERT INTO t1 VALUES('0000-10-31');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
@@ -97,7 +99,9 @@ set @@sql_mode='ansi,traditional';
# Test INSERT with DATETIME
CREATE TABLE t1 (col1 datetime);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('0000-10-31 15:30:00'),('2004-02-29 15:30:00');
+INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
+--error 1292
+INSERT INTO t1 VALUES('0000-10-31 15:30:00');
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
@@ -190,6 +194,7 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+--error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -211,6 +216,7 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+--error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -264,6 +270,8 @@ INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
## Test INSERT with CAST AS DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+
+--error 1292
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292
@@ -290,6 +298,8 @@ INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
## Test INSERT with CAST AS DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+
+--error 1292
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292
@@ -356,6 +366,8 @@ INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
## Test INSERT with CONVERT to DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
+
+--error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292
@@ -381,6 +393,8 @@ INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
## Test INSERT with CONVERT to DATETIME into DATETIME
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
+
+--error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 503d7ffc0b9..6d79dcc863b 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -423,3 +423,18 @@ alter table t1 modify a binary(5);
select hex(a) from t1 order by a;
select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
drop table t1;
+
+#
+# Bug #19489: Inconsistent support for DEFAULT in TEXT columns
+#
+create table t1 (a text default '');
+show create table t1;
+insert into t1 values (default);
+select * from t1;
+drop table t1;
+set @@sql_mode='TRADITIONAL';
+--error ER_BLOB_CANT_HAVE_DEFAULT
+create table t1 (a text default '');
+set @@sql_mode='';
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index e1b23a1782f..58c52b59a5a 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -171,3 +171,34 @@ set @first_var= cast(NULL as CHAR);
create table t1 select @first_var;
show create table t1;
drop table t1;
+
+#
+# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
+#
+
+# First part, set user var to large number and select it
+set @a=18446744071710965857;
+select @a;
+
+# Second part, set user var from large number in table
+# then select it
+CREATE TABLE `bigfailure` (
+ `afield` BIGINT UNSIGNED NOT NULL
+);
+INSERT INTO `bigfailure` VALUES (18446744071710965857);
+SELECT * FROM bigfailure;
+select * from (SELECT afield FROM bigfailure) as b;
+select * from bigfailure where afield = (SELECT afield FROM bigfailure);
+select * from bigfailure where afield = 18446744071710965857;
+# This is fixed in 5.0, to be uncommented there
+#select * from bigfailure where afield = '18446744071710965857';
+select * from bigfailure where afield = 18446744071710965856+1;
+
+SET @a := (SELECT afield FROM bigfailure);
+SELECT @a;
+SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
+SELECT @a;
+SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
+SELECT @a;
+
+drop table bigfailure;
diff --git a/ndb/src/kernel/error/ndbd_exit_codes.c b/ndb/src/kernel/error/ndbd_exit_codes.c
index 07b276346a0..cb3272b38a9 100644
--- a/ndb/src/kernel/error/ndbd_exit_codes.c
+++ b/ndb/src/kernel/error/ndbd_exit_codes.c
@@ -247,7 +247,7 @@ int ndbd_exit_string(int err_no, char *str, unsigned int size)
ndbd_exit_classification cl;
ndbd_exit_status st;
const char *msg = ndbd_exit_message(err_no, &cl);
- if (msg[0] != '\0')
+ if (msg[0] != '\0' && cl != XUE)
{
const char *cl_msg = ndbd_exit_classification_message(cl, &st);
const char *st_msg = ndbd_exit_status_message(st);
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index c9d39260761..93bf23ed284 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -69,6 +69,7 @@ uint calc_days_in_year(uint year)
Here we assume that year and month is ok !
If month is 0 we allow any date. (This only happens if we allow zero
date parts in str_to_datetime())
+ Disallow dates with zero year and non-zero month and/or day.
RETURN
0 ok
@@ -85,7 +86,8 @@ static my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
(!(flags & TIME_INVALID_DATES) &&
ltime->month && ltime->day > days_in_month[ltime->month-1] &&
(ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
- ltime->day != 29)))
+ ltime->day != 29)) ||
+ (ltime->year == 0 && (ltime->month != 0 || ltime->day != 0)))
{
*was_cut= 2;
return TRUE;
diff --git a/sql/field.cc b/sql/field.cc
index 98de224f900..510e3bd259f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8265,7 +8265,8 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
comment= *fld_comment;
/*
- Set flag if this field doesn't have a default value
+ Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
+ it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
*/
if (!fld_default_value && !(fld_type_modifier & AUTO_INCREMENT_FLAG) &&
(fld_type_modifier & NOT_NULL_FLAG) && fld_type != FIELD_TYPE_TIMESTAMP)
@@ -8342,12 +8343,28 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
/* Allow empty as default value. */
String str,*res;
res= fld_default_value->val_str(&str);
- if (res->length())
+ /*
+ A default other than '' is always an error, and any non-NULL
+ specified default is an error in strict mode.
+ */
+ if (res->length() || (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES |
+ MODE_STRICT_ALL_TABLES)))
{
my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0),
fld_name); /* purecov: inspected */
DBUG_RETURN(TRUE);
}
+ else
+ {
+ /*
+ Otherwise a default of '' is just a warning.
+ */
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_BLOB_CANT_HAVE_DEFAULT,
+ ER(ER_BLOB_CANT_HAVE_DEFAULT),
+ fld_name);
+ }
def= 0;
}
flags|= BLOB_FLAG;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1d906b300b6..6df72fdf8c2 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -3406,6 +3406,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->length=0;
entry->update_query_id=0;
entry->collation.set(NULL, DERIVATION_IMPLICIT);
+ entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -3492,6 +3493,7 @@ Item_func_set_user_var::fix_length_and_dec()
type - type of new value
cs - charset info for new value
dv - derivation for new value
+ unsigned_arg - indiates if a value of type INT_RESULT is unsigned
RETURN VALUE
False - success, True - failure
@@ -3499,7 +3501,8 @@ Item_func_set_user_var::fix_length_and_dec()
static bool
update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
- Item_result type, CHARSET_INFO *cs, Derivation dv)
+ Item_result type, CHARSET_INFO *cs, Derivation dv,
+ bool unsigned_arg)
{
if (set_null)
{
@@ -3547,6 +3550,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
entry->collation.set(cs, dv);
+ entry->unsigned_flag= unsigned_arg;
}
entry->type=type;
return 0;
@@ -3555,7 +3559,8 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
bool
Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
- CHARSET_INFO *cs, Derivation dv)
+ CHARSET_INFO *cs, Derivation dv,
+ bool unsigned_arg)
{
/*
If we set a variable explicitely to NULL then keep the old
@@ -3564,7 +3569,7 @@ Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type,
if ((null_value= args[0]->null_value) && null_item)
type= entry->type; // Don't change type of item
if (::update_hash(entry, (null_value= args[0]->null_value),
- ptr, length, type, cs, dv))
+ ptr, length, type, cs, dv, unsigned_arg))
{
current_thd->fatal_error(); // Probably end of memory
null_value= 1;
@@ -3646,7 +3651,10 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
str->set(*(double*) value, decimals, &my_charset_bin);
break;
case INT_RESULT:
- str->set(*(longlong*) value, &my_charset_bin);
+ if (!unsigned_flag)
+ str->set(*(longlong*) value, &my_charset_bin);
+ else
+ str->set(*(ulonglong*) value, &my_charset_bin);
break;
case DECIMAL_RESULT:
my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
@@ -3717,6 +3725,7 @@ Item_func_set_user_var::check()
case INT_RESULT:
{
save_result.vint= args[0]->val_int();
+ unsigned_flag= args[0]->unsigned_flag;
break;
}
case STRING_RESULT:
@@ -3772,7 +3781,8 @@ Item_func_set_user_var::update()
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
+ INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
+ unsigned_flag);
break;
}
case STRING_RESULT:
@@ -4151,7 +4161,7 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref)
void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs)
{
if (::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs,
- DERIVATION_IMPLICIT))
+ DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
current_thd->fatal_error(); // Probably end of memory
}
@@ -4160,7 +4170,7 @@ void Item_user_var_as_out_param::set_value(const char *str, uint length,
CHARSET_INFO* cs)
{
if (::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs,
- DERIVATION_IMPLICIT))
+ DERIVATION_IMPLICIT, 0 /* unsigned_arg */))
current_thd->fatal_error(); // Probably end of memory
}
diff --git a/sql/item_func.h b/sql/item_func.h
index c54fc701c53..af1bdad199e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1157,8 +1157,6 @@ class Item_func_set_user_var :public Item_func
String *vstr;
my_decimal *vdec;
} save_result;
- String save_buff;
-
public:
LEX_STRING name; // keep it public
@@ -1169,8 +1167,8 @@ public:
longlong val_int();
String *val_str(String *str);
my_decimal *val_decimal(my_decimal *);
- bool update_hash(void *ptr, uint length, enum Item_result type,
- CHARSET_INFO *cs, Derivation dv);
+ bool update_hash(void *ptr, uint length, enum Item_result type,
+ CHARSET_INFO *cs, Derivation dv, bool unsigned_arg= 0);
bool check();
bool update();
enum Item_result result_type () const { return cached_result_type; }
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 5ceb462385c..c63a89351c6 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2968,6 +2968,16 @@ String *Item_func_uncompress::val_str(String *str)
if (res->is_empty())
return res;
+ /* If length is less than 4 bytes, data is corrupt */
+ if (res->length() <= 4)
+ {
+ push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_ZLIB_Z_DATA_ERROR,
+ ER(ER_ZLIB_Z_DATA_ERROR));
+ goto err;
+ }
+
+ /* Size of uncompressed data is stored as first 4 bytes of field */
new_size= uint4korr(res->ptr()) & 0x3FFFFFFF;
if (new_size > current_thd->variables.max_allowed_packet)
{
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 46b1b2fc248..7abbe232249 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -804,7 +804,7 @@ class Item_func_uncompress: public Item_str_func
String buffer;
public:
Item_func_uncompress(Item *a): Item_str_func(a){}
- void fix_length_and_dec(){max_length= MAX_BLOB_WIDTH;}
+ void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
};
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 5404021a348..5ca2b602c25 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1511,6 +1511,7 @@ static Item_result set_row(List<Item> &item_list, Item *item,
item->max_length= sel_item->max_length;
res_type= sel_item->result_type();
item->decimals= sel_item->decimals;
+ item->unsigned_flag= sel_item->unsigned_flag;
*maybe_null= sel_item->maybe_null;
if (!(row[i]= Item_cache::get_cache(res_type)))
return STRING_RESULT; // we should return something
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 4d70debb966..898ea28985b 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1256,9 +1256,6 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table,
sizeof(double)*2) + sizeof(longlong),
0, name, table, &my_charset_bin);
}
- if (hybrid_type == DECIMAL_RESULT)
- return new Field_new_decimal(max_length, maybe_null, name, table,
- decimals, unsigned_flag);
return new Field_double(max_length, maybe_null,name,table,decimals);
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index f4ff257aa4e..f1ea95214de 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -688,7 +688,7 @@ public:
{ return sample ? "var_samp(" : "variance("; }
Item *copy_or_same(THD* thd);
Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
- enum Item_result result_type () const { return hybrid_type; }
+ enum Item_result result_type () const { return REAL_RESULT; }
};
class Item_sum_std;
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 9e1962835c8..835be6554bc 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2877,6 +2877,8 @@ longlong Item_func_timestamp_diff::val_int()
{
uint year_beg, year_end, month_beg, month_end, day_beg, day_end;
uint years= 0;
+ uint second_beg, second_end, microsecond_beg, microsecond_end;
+
if (neg == -1)
{
year_beg= ltime2.year;
@@ -2885,6 +2887,10 @@ longlong Item_func_timestamp_diff::val_int()
month_end= ltime1.month;
day_beg= ltime2.day;
day_end= ltime1.day;
+ second_beg= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second;
+ second_end= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second;
+ microsecond_beg= ltime2.second_part;
+ microsecond_end= ltime1.second_part;
}
else
{
@@ -2894,6 +2900,10 @@ longlong Item_func_timestamp_diff::val_int()
month_end= ltime2.month;
day_beg= ltime1.day;
day_end= ltime2.day;
+ second_beg= ltime1.hour * 3600 + ltime1.minute * 60 + ltime1.second;
+ second_end= ltime2.hour * 3600 + ltime2.minute * 60 + ltime2.second;
+ microsecond_beg= ltime1.second_part;
+ microsecond_end= ltime2.second_part;
}
/* calc years */
@@ -2907,8 +2917,13 @@ longlong Item_func_timestamp_diff::val_int()
months+= 12 - (month_beg - month_end);
else
months+= (month_end - month_beg);
+
if (day_end < day_beg)
months-= 1;
+ else if ((day_end == day_beg) &&
+ ((second_end < second_beg) ||
+ (second_end == second_beg && microsecond_end < microsecond_beg)))
+ months-= 1;
}
switch (int_type) {
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 786a1ea4f4c..57ee7971c8d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2770,6 +2770,11 @@ You should consider changing lower_case_table_names to 1 or 2",
mysql_real_data_home);
lower_case_table_names= 0;
}
+ else
+ {
+ lower_case_file_system=
+ (test_if_case_insensitive(mysql_real_data_home) == 1);
+ }
/* Reset table_alias_charset, now that lower_case_table_names is set. */
table_alias_charset= (lower_case_table_names ?
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5134efcfb32..53a95a89b51 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2015,6 +2015,7 @@ class user_var_entry
ulong length;
query_id_t update_query_id, used_query_id;
Item_result type;
+ bool unsigned_flag;
double val_real(my_bool *null_value);
longlong val_int(my_bool *null_value);
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 381d1a71e31..b608773bf6e 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -91,6 +91,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
/* Handler didn't support fast delete; Delete rows one by one */
}
+ if (conds)
+ {
+ Item::cond_result result;
+ conds= remove_eq_conds(thd, conds, &result);
+ if (result == Item::COND_FALSE) // Impossible where
+ limit= 0;
+ }
+
table->used_keys.clear_all();
table->quick_keys.clear_all(); // Can't use 'only index'
select=make_select(table, 0, 0, conds, 0, &error);
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 8f98bab5c04..163801e2f1e 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -237,7 +237,7 @@ void udf_init()
}
}
if (error > 0)
- sql_print_error(ER(ER_GET_ERRNO), my_errno);
+ sql_print_error("Got unknown error: %d", my_errno);
end_read_record(&read_record_info);
new_thd->version--; // Force close to free memory
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 425945f525e..6d560d3d250 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -3089,7 +3089,7 @@ opt_bin_mod:
| BINARY { Lex->type|= BINCMP_FLAG; };
opt_bin_charset:
- /* empty */ { }
+ /* empty */ { Lex->charset= NULL; }
| ASCII_SYM { Lex->charset=&my_charset_latin1; }
| UNICODE_SYM
{