mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
Merge bk-internal:/home/bk/mysql-5.0-maint
into rama.(none):/home/jimw/my/mysql-5.0-16881
This commit is contained in:
commit
ad78212d9f
54 changed files with 468 additions and 55 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
15
configure.in
15
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
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -1048,6 +1049,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 +1063,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 +1112,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 +3110,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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. ");
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
2
mysql-test/r/have_perror.require
Normal file
2
mysql-test/r/have_perror.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
have_perror
|
||||
1
|
|
@ -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,
|
||||
|
|
|
@ -104,4 +104,14 @@ 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;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
2
mysql-test/r/perror.result
Normal file
2
mysql-test/r/perror.result
Normal file
|
@ -0,0 +1,2 @@
|
|||
Illegal ndb error code: 1186
|
||||
Illegal error code: 1186
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 #
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
@ -77,6 +77,15 @@ 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;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
|
|
|
@ -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 ;
|
||||
|
|
23
mysql-test/t/perror.test
Normal file
23
mysql-test/t/perror.test
Normal file
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
# As there is an error code defined for 1186, expect error
|
||||
--error 1
|
||||
--exec $MY_PERROR 1186 2>&1
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
21
sql/field.cc
21
sql/field.cc
|
@ -8363,7 +8363,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)
|
||||
|
@ -8440,12 +8441,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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2004,6 +2004,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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue