Commit e32c90c6 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0-ndb
parents 925d09be 14e3d36a
......@@ -254,11 +254,14 @@ bkpush.log
bkpush.log*
build.log
build_tags.sh
client/decimal.c
client/insert_test
client/log_event.cc
client/log_event.h
client/mf_iocache.c
client/mf_iocache.cc
client/my_decimal.cc
client/my_decimal.h
client/mysql
client/mysqladmin
client/mysqladmin.c
......@@ -328,9 +331,12 @@ help.h
include/my_config.h
include/my_global.h
include/mysql_version.h
include/mysqld_ername.h
include/mysqld_error.h
include/readline
include/readline/*.h
include/readline/readline.h
include/sql_state.h
include/widec.h
innobase/autom4te-2.53.cache/*
innobase/autom4te-2.53.cache/output.0
......@@ -432,6 +438,7 @@ libmysqld/log_event.cc
libmysqld/md5.c
libmysqld/mf_iocache.cc
libmysqld/mini_client.cc
libmysqld/my_decimal.cc
libmysqld/my_time.c
libmysqld/net_pkg.cc
libmysqld/net_serv.cc
......@@ -985,6 +992,7 @@ support-files/mysql-3.23.29-gamma.spec
support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysql.spec
support-files/ndb-config-2-node.ini
tags
test/ndbapi/bank/bankCreator
test/ndbapi/bank/bankMakeGL
......@@ -1052,7 +1060,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
include/mysqld_ername.h
include/mysqld_error.h
include/sql_state.h
support-files/ndb-config-2-node.ini
This diff is collapsed.
......@@ -151,6 +151,7 @@ monty@tramp.mysql.fi
monty@work.mysql.com
mronstrom@build.mysql.com
mronstrom@mysql.com
mskold@bk-internal.mysql.com
mskold@mysql.com
msvensson@build.mysql.com
msvensson@neptunus.homeip.net
......
......@@ -34,7 +34,8 @@ mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c
mysqlmanagerc_SOURCES = mysqlmanagerc.c
sql_src=log_event.h mysql_priv.h log_event.cc
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK
......@@ -43,6 +44,10 @@ link_sources:
for f in $(sql_src) ; do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(top_srcdir)/sql/$$f $(srcdir)/$$f; \
done; \
for f in $(strings_src) ; do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(top_srcdir)/strings/$$f $(srcdir)/$$f; \
done;
# Don't update the files from bitkeeper
......
......@@ -1280,8 +1280,14 @@ int main(int argc, char** argv)
*/
#ifdef __WIN__
#include "my_decimal.h"
#include "decimal.c"
#include "my_decimal.cpp"
#include "log_event.cpp"
#else
#include "my_decimal.h"
#include "decimal.c"
#include "my_decimal.cc"
#include "log_event.cc"
#endif
......
......@@ -26,7 +26,9 @@ typedef struct st_decimal {
decimal_digit *buf;
} decimal;
int decimal2string(decimal *from, char *to, int *to_len);
int decimal2string(decimal *from, char *to, int *to_len,
int fixed_precision, int fixed_decimals,
char filler);
int string2decimal(char *from, decimal *to, char **end);
int string2decimal_fixed(char *from, decimal *to, char **end);
int decimal2ulonglong(decimal *from, ulonglong *to);
......@@ -35,6 +37,7 @@ int decimal2longlong(decimal *from, longlong *to);
int longlong2decimal(longlong from, decimal *to);
int decimal2double(decimal *from, double *to);
int double2decimal(double from, decimal *to);
void decimal_optimize_fraction(decimal *from);
int decimal2bin(decimal *from, char *to, int precision, int scale);
int bin2decimal(char *from, decimal *to, int precision, int scale);
......@@ -50,6 +53,7 @@ int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr);
int decimal_mod(decimal *from1, decimal *from2, decimal *to);
int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode);
int decimal_is_zero(decimal *from);
void max_decimal(int precision, int frac, decimal *to);
/* set a decimal to zero */
......@@ -65,7 +69,8 @@ int decimal_is_zero(decimal *from);
of the decimal (including decimal dot, possible sign and \0)
*/
#define decimal_string_size(dec) ((dec)->intg + (dec)->frac + ((dec)->frac > 0) + 2)
#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \
(dec)->frac + ((dec)->frac > 0) + 2)
/* negate a decimal */
#define decimal_neg(dec) do { (dec)->sign^=1; } while(0)
......
......@@ -211,6 +211,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
MYSQL_TYPE_BIT,
MYSQL_TYPE_NEWDECIMAL=246,
MYSQL_TYPE_ENUM=247,
MYSQL_TYPE_SET=248,
MYSQL_TYPE_TINY_BLOB=249,
......@@ -226,6 +227,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
/* For backward compatibility */
#define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS
#define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL
#define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL
#define FIELD_TYPE_TINY MYSQL_TYPE_TINY
#define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT
#define FIELD_TYPE_LONG MYSQL_TYPE_LONG
......@@ -341,7 +343,8 @@ struct rand_struct {
/* The following is for user defined functions */
enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};
enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT,
DECIMAL_RESULT};
typedef struct st_udf_args
{
......
......@@ -3186,6 +3186,8 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
param->store_param_func= store_param_str;
/*
For variable length types user must set either length or
......@@ -3512,6 +3514,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
default:
{
/*
......@@ -4249,6 +4253,8 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
break;
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
DBUG_ASSERT(param->buffer_length != 0);
param->fetch_result= fetch_result_str;
break;
......@@ -4308,6 +4314,7 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
field->max_length= MAX_DATE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
......
......@@ -62,7 +62,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc protocol_cursor.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
libmysqld_a_SOURCES=
......
......@@ -284,6 +284,11 @@ our $opt_warnings;
our $opt_with_ndbcluster;
our $opt_with_openssl;
our $exe_ndb_mgm;
our $path_ndb_tools_dir;
our $path_ndb_backup_dir;
our $file_ndb_testrun_log;
our $flag_ndb_status_ok= 1;
######################################################################
#
......@@ -297,6 +302,7 @@ sub command_line_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_and_cleanup ();
sub ndbcluster_install ();
sub ndbcluster_start ();
sub ndbcluster_stop ();
sub run_benchmarks ($);
......@@ -346,18 +352,12 @@ sub main () {
kill_and_cleanup();
mysql_install_db();
if ( $opt_with_ndbcluster and ! $glob_use_running_ndbcluster )
{
ndbcluster_start(); # We start the cluster storage engine
}
# mysql_loadstd(); FIXME copying from "std_data" .frm and
# .MGR but there are none?!
}
if ( $opt_start_and_exit )
{
# FIXME what about ndb?
if ( mysqld_start('master',0,[],[]) )
{
mtr_report("Servers started, exiting");
......@@ -551,6 +551,8 @@ sub command_line_setup () {
$master->[0]->{'path_myport'}= $opt_master_myport;
$master->[0]->{'start_timeout'}= 400; # enough time create innodb tables
$master->[0]->{'ndbcluster'}= 1; # ndbcluster not started
$master->[1]->{'path_myddir'}= "$glob_mysql_test_dir/var/master1-data";
$master->[1]->{'path_myerr'}= "$glob_mysql_test_dir/var/log/master1.err";
$master->[1]->{'path_mylog'}= "$glob_mysql_test_dir/var/log/master1.log";
......@@ -681,6 +683,10 @@ sub command_line_setup () {
$glob_use_running_ndbcluster= 1;
$opt_with_ndbcluster= 1;
}
else
{
$opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
}
# FIXME
......@@ -786,6 +792,9 @@ sub executable_setup () {
$exe_mysql_fix_system_tables= "$glob_basedir/scripts/mysql_fix_privilege_tables";
$path_language= "$glob_basedir/sql/share/english/";
$path_charsetsdir= "$glob_basedir/sql/share/charsets";
$path_ndb_tools_dir= "$glob_basedir/ndb/tools";
$exe_ndb_mgm= "$glob_basedir/ndb/src/mgmclient/ndb_mgm";
}
else
{
......@@ -846,6 +855,9 @@ sub executable_setup () {
$exe_mysqltest="$path_client_bindir/mysqltest";
$exe_mysql_client_test="$path_client_bindir/mysql_client_test";
}
$path_ndb_tools_dir= "$glob_basedir/bin";
$exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm";
}
# FIXME special $exe_master_mysqld and $exe_slave_mysqld
......@@ -860,6 +872,10 @@ sub executable_setup () {
{
$exe_slave_mysqld= $exe_mysqld;
}
$path_ndb_backup_dir=
"$glob_mysql_test_dir/var/ndbcluster-$opt_ndbcluster_port";
$file_ndb_testrun_log= "$glob_mysql_test_dir/var/log/ndb_testrun.log";
}
......@@ -949,22 +965,19 @@ sub kill_and_cleanup () {
mtr_report("Killing Possible Leftover Processes");
mkpath("$glob_mysql_test_dir/var/log"); # Needed for mysqladmin log
mtr_kill_leftovers();
}
if ( $opt_with_ndbcluster and ! $glob_use_running_ndbcluster )
{
ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1;
}
mtr_report("Removing Stale Files");
rmtree("$glob_mysql_test_dir/var/log");
rmtree("$glob_mysql_test_dir/var/ndbcluster");
rmtree("$glob_mysql_test_dir/var/ndbcluster-$opt_ndbcluster_port");
rmtree("$glob_mysql_test_dir/var/run");
rmtree("$glob_mysql_test_dir/var/tmp");
mkpath("$glob_mysql_test_dir/var/log");
mkpath("$glob_mysql_test_dir/var/ndbcluster");
mkpath("$glob_mysql_test_dir/var/run");
mkpath("$glob_mysql_test_dir/var/tmp");
mkpath($opt_tmpdir);
......@@ -1002,26 +1015,67 @@ sub kill_and_cleanup () {
# FIXME why is there a different start below?!
sub ndbcluster_start () {
sub ndbcluster_install () {
mtr_report("Starting ndbcluster");
if ( ! $opt_with_ndbcluster or $glob_use_running_ndbcluster )
{
return 0;
}
mtr_report("Install ndbcluster");
my $ndbcluster_opts= $opt_bench ? "" : "--small";
# FIXME check result code?!
mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
["--port-base=$opt_ndbcluster_port",
my $ndbcluster_port_base= $opt_ndbcluster_port + 2;
if ( mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
["--port=$opt_ndbcluster_port",
"--port-base=$ndbcluster_port_base",
"--data-dir=$glob_mysql_test_dir/var",
$ndbcluster_opts,
"--diskless",
"--initial",
"--initial"],
"", "", "", "") )
{
mtr_error("Error ndbcluster_install");
return 1;
}
ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1;
return 0;
}
sub ndbcluster_start () {
if ( ! $opt_with_ndbcluster or $glob_use_running_ndbcluster )
{
return 0;
}
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
if ( mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
["--port=$opt_ndbcluster_port",
"--data-dir=$glob_mysql_test_dir/var"],
"", "", "", "");
"", "/dev/null", "", "") )
{
mtr_error("Error ndbcluster_install");
return 1;
}
return 0;
}
sub ndbcluster_stop () {
if ( ! $opt_with_ndbcluster or $glob_use_running_ndbcluster )
{
return;
}
my $ndbcluster_port_base= $opt_ndbcluster_port + 2;
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
mtr_run("$glob_mysql_test_dir/ndb/ndbcluster",
["--data-dir=$glob_mysql_test_dir/var",
"--port-base=$opt_ndbcluster_port",
["--port=$opt_ndbcluster_port",
"--data-dir=$glob_mysql_test_dir/var",
"--stop"],
"", "", "", "");
"", "/dev/null", "", "");
return;
}
......@@ -1129,11 +1183,6 @@ sub run_suite () {
stop_masters_slaves();
}
if ( $opt_with_ndbcluster and ! $glob_use_running_ndbcluster )
{
ndbcluster_stop();
}
if ( $opt_gcov )
{
gcov_collect(); # collect coverage information
......@@ -1162,6 +1211,13 @@ sub mysql_install_db () {
install_db('slave', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'});
if ( ndbcluster_install() )
{
# failed to install, disable usage but flag that its no ok
$opt_with_ndbcluster= 0;
$flag_ndb_status_ok= 0;
}
return 0;
}
......@@ -1224,6 +1280,9 @@ sub run_testcase ($) {
mtr_tonewfile($opt_current_test,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
# ----------------------------------------------------------------------
# If marked to skip, just print out and return.
# Note that a test case not marked as 'skip' can still be
......@@ -1297,6 +1356,15 @@ sub run_testcase ($) {
if ( ! $opt_local_master )
{
if ( $master->[0]->{'ndbcluster'} )
{
$master->[0]->{'ndbcluster'}= ndbcluster_start();
if ( $master->[0]->{'ndbcluster'} )
{
report_failure_and_restart($tinfo);
return;
}
}
if ( ! $master->[0]->{'pid'} )
{
$master->[0]->{'pid'}=
......@@ -1614,18 +1682,9 @@ sub mysqld_arguments ($$$$$) {
if ( $opt_with_ndbcluster )
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
if ( $glob_use_running_ndbcluster )
{
mtr_add_arg($args,"--ndb-connectstring=%s", $prefix,
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$opt_ndbconnectstring);
}
else
{
mtr_add_arg($args,"--ndb-connectstring=host=localhost:%d",
$prefix, $opt_ndbcluster_port);
}
}
# FIXME always set nowdays??? SMALL_SERVER
mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
......@@ -1828,6 +1887,12 @@ sub stop_masters () {
}
}
if ( ! $master->[0]->{'ndbcluster'} )
{
ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1;
}
mtr_stop_mysqld_servers(\@args);
}
......@@ -1903,6 +1968,13 @@ sub run_mysqltest ($$) {
$ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'NDB_STATUS_OK'}= $flag_ndb_status_ok;
$ENV{'NDB_MGM'}= $exe_ndb_mgm;
$ENV{'NDB_BACKUP_DIR'}= $path_ndb_backup_dir;
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
$ENV{'NDB_TOOLS_OUTPUT'}= $file_ndb_testrun_log;
$ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
my $exe= $exe_mysqltest;
my $args;
......
......@@ -7,7 +7,7 @@ select 9223372036854775807,-009223372036854775808;
9223372036854775807 -9223372036854775808
select +9999999999999999999,-9999999999999999999;
9999999999999999999 -9999999999999999999
9999999999999999999 -10000000000000000000
9999999999999999999 -9999999999999999999
select cast(9223372036854775808 as unsigned)+1;
cast(9223372036854775808 as unsigned)+1
9223372036854775809
......@@ -16,7 +16,7 @@ select 9223372036854775808+1;
9223372036854775809
select -(0-3),round(-(0-3)), round(9999999999999999999);
-(0-3) round(-(0-3)) round(9999999999999999999)
3 3 10000000000000000000
3 3 9999999999999999999
create table t1 (a bigint unsigned not null, primary key(a));
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t1;
......
......@@ -91,7 +91,10 @@ CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
CASE WHEN 1 THEN 1.0 END AS c9
CASE WHEN 1 THEN 1.0 END AS c9,
CASE WHEN 1 THEN 0.1e1 else 0.1 END AS c10,
CASE WHEN 1 THEN 0.1e1 else 1 END AS c11,
CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
;
SHOW CREATE TABLE t1;
Table Create Table
......@@ -100,11 +103,14 @@ t1 CREATE TABLE `t1` (
`c2` varchar(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c3` varbinary(1) NOT NULL default '',
`c4` varbinary(1) NOT NULL default '',
`c5` varbinary(3) NOT NULL default '',
`c6` varbinary(3) NOT NULL default '',
`c7` double(3,1) NOT NULL default '0.0',
`c8` double(3,1) NOT NULL default '0.0',
`c9` double(3,1) default NULL
`c5` varbinary(4) NOT NULL default '',
`c6` varbinary(4) NOT NULL default '',
`c7` decimal(5,1) NOT NULL default '0.0',
`c8` decimal(5,1) NOT NULL default '0.0',
`c9` decimal(5,1) default NULL,
`c10` double NOT NULL default '0',
`c11` double NOT NULL default '0',
`c12` varbinary(5) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT CASE
......@@ -146,11 +152,11 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(1)` int(1) NOT NULL default '0',
`COALESCE(1.0)` double(3,1) NOT NULL default '0.0',
`COALESCE(1.0)` decimal(5,1) NOT NULL default '0.0',
`COALESCE('a')` varchar(1) NOT NULL default '',
`COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0',
`COALESCE(1,1.0)` decimal(5,1) NOT NULL default '0.0',
`COALESCE(1,'1')` varbinary(1) NOT NULL default '',
`COALESCE(1.1,'1')` varbinary(3) NOT NULL default '',
`COALESCE(1.1,'1')` varbinary(4) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
......@@ -103,9 +103,9 @@ Field Type Null Key Default Extra
a datetime NO 0000-00-00 00:00:00
b time NO 00:00:00
c date NO 0000-00-00
d bigint(17) NO 0
e double(18,1) NO 0.0
f bigint(17) NO 0
d int(2) NO 0
e decimal(6,1) NO 0.0
f bigint(18) NO 0
drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2;
......@@ -418,7 +418,7 @@ d date YES NULL
e varchar(1) NO
f datetime YES NULL
g time YES NULL
h longblob NO
h varbinary(23) NO
dd time YES NULL
select * from t2;
a b c d e f g h dd
......@@ -437,7 +437,7 @@ t2 CREATE TABLE `t2` (
`ifnull(e,e)` bigint(20) default NULL,
`ifnull(f,f)` float(3,2) default NULL,
`ifnull(g,g)` double(4,3) default NULL,
`ifnull(h,h)` decimal(5,4) default NULL,
`ifnull(h,h)` decimal(6,4) default NULL,
`ifnull(i,i)` year(4) default NULL,
`ifnull(j,j)` date default NULL,
`ifnull(k,k)` datetime NOT NULL default '0000-00-00 00:00:00',
......
......@@ -462,5 +462,5 @@ rout int(11) default '0'
INSERT INTO t1 VALUES ('1',1,0);
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
html prod
1 0.00
1 0.00000
drop table t1;
drop table if exists t1,t2;
select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL;
0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL
1 1 1 1
select 0<=>0,0.0<=>0.0,0E0=0E0,"A"<=>"A",NULL<=>NULL;
0<=>0 0.0<=>0.0 0E0=0E0 "A"<=>"A" NULL<=>NULL
1 1 1 1 1
select 1<=>0,0<=>NULL,NULL<=>0;
1<=>0 0<=>NULL NULL<=>0
0 0 0
......@@ -11,6 +11,12 @@ select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
select "A"<=>"B","A"<=>NULL,NULL<=>"A";
"A"<=>"B" "A"<=>NULL NULL<=>"A"
0 0 0
select 0<=>0.0, 0.0<=>0E0, 0E0<=>"0", 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
0<=>0.0 0.0<=>0E0 0E0<=>"0" 10.0<=>1E1 10<=>10.0 10<=>1E1
1 1 1 1 1 1
select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
1.0<=>0E1 10<=>NULL NULL<=>0.0 NULL<=>0E0
0 0 0 0
create table t1 (id int, value int);
create table t2 (id int, value int);
insert into t1 values (1,null);
......
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
2 0 3 1.60 3 3 3 4
2 0 3 1.60000 3 3 3 4
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
......
......@@ -440,12 +440,12 @@ create table t2 (user_id integer not null, date date);
insert into t2 values (1, '2002-06-09'),(2, '2002-06-09'),(1, '2002-06-09'),(3, '2002-06-09'),(4, '2002-06-09'),(4, '2002-06-09');
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
gender dist_count percentage
F 3 60.00
M 1 20.00
F 3 60.00000
M 1 20.00000
select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
gender dist_count percentage
M 1 20.00
F 3 60.00
M 1 20.00000
F 3 60.00000
drop table t1,t2;
CREATE TABLE t1 (ID1 int, ID2 int, ID int NOT NULL AUTO_INCREMENT,PRIMARY KEY(ID
));
......@@ -629,15 +629,6 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
select group_concat( distinct col1 ) as alias from t1
group by col2 having alias like '%';
alias
1,2
1,2
1
drop table t1;
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
......@@ -650,3 +641,39 @@ select 1 and min(a) is null from t1;
1 and min(a) is null
1
drop table t1;
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
select group_concat( distinct col1 ) as alias from t1
group by col2 having alias like '%';
alias
1,2
1,2
1
drop table t1;
create table t1 (a integer, b integer, c integer);
insert into t1 (a,b) values (1,2),(1,3),(2,5);
select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
a r2 r1
1 1.0 2
select a, rand()*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
a r2 r1
1 1 2
select a,sum(b) from t1 where a=1 group by c;
a sum(b)
1 5
select a*sum(b) from t1 where a=1 group by c;
a*sum(b)
5
select sum(a)*sum(b) from t1 where a=1 group by c;
sum(a)*sum(b)
10
select a,sum(b) from t1 where a=1 group by c having a=1;
a sum(b)
1 5
select a as d,sum(b) from t1 where a=1 group by c having d=1;
d sum(b)
1 5
select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
d
10
drop table t1;
......@@ -69,9 +69,11 @@ id select_type table type possible_keys key key_len ref rows Extra
select pk from t1 where key2 = 1 and key1 = 1;
pk
26
27
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
pk
26
27
drop table t1;
create table t1 (
pk int primary key auto_increment,
......
......@@ -56,7 +56,7 @@ pk1 pk2
95 59
explain select * from t1 where badkey=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1 key1 4 const 101 Using where
1 SIMPLE t1 ref key1 key1 4 const 100 Using where
explain select * from t1 where pk1 < 7500 and key1 = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL 38 Using intersect(key1,PRIMARY); Using where
......@@ -74,13 +74,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 199 Using sort_union(pktail2ok,key1); Using where
explain select * from t1 where pktail3bad=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1,pktail3bad pktail3bad 4 const ROWS Using where
1 SIMPLE t1 ref key1,pktail3bad key1 4 const 100 Using where
explain select * from t1 where pktail4bad=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1,pktail4bad pktail4bad 4 const 99 Using where
1 SIMPLE t1 ref key1,pktail4bad key1 4 const 100 Using where
explain select * from t1 where pktail5bad=1 and key1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref key1,pktail5bad pktail5bad 4 const 99 Using where
1 SIMPLE t1 ref key1,pktail5bad key1 4 const 100 Using where
explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 4,4 NULL 1 Using intersect(key1,key2); Using where; Using index
......
......@@ -380,26 +380,6 @@ delete from mysql.db where user='joe';
delete from mysql.tables_priv where user='joe';
delete from mysql.columns_priv where user='joe';
flush privileges;
create procedure px5 ()
begin
declare v int;
declare c cursor for select version from
information_schema.tables where table_schema <> 'information_schema';
open c;
fetch c into v;
select v;
close c;
end;//
call px5()//
v
9
call px5()//
v
9
select sql_mode from information_schema.ROUTINES;
sql_mode
drop procedure px5;
create table t1 (a int not null auto_increment,b int, primary key (a));
insert into t1 values (1,1),(NULL,3),(NULL,4);
select AUTO_INCREMENT from information_schema.tables where table_name = 't1';
......
......@@ -41,8 +41,8 @@ lock tables t1 write;
check table t2;
Table Op Msg_type Msg_text
test.t2 check error Table 't2' was not locked with LOCK TABLES
insert into t1 select nr from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
insert into t1 select index1,nr from t1;
ERROR 42000: INSERT command denied to user 'root'@'localhost' for column 'index1' in table 't1'
unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
......
......@@ -2,7 +2,7 @@ drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def 1 8 1 1 N 32897 0 63
def 1.0 5 3 3 N 32897 1 63
def 1.0 246 4 3 N 161 1 63
def -1 8 2 2 N 32897 0 63
def hello 253 5 5 N 1 31 8
def NULL 6 0 0 Y 32896 0 63
......@@ -18,7 +18,7 @@ def test t1 t1 d d 3 11 0 Y 32768 0 63
def test t1 t1 e e 8 20 0 Y 32768 0 63
def test t1 t1 f f 4 3 0 Y 32768 2 63
def test t1 t1 g g 5 4 0 Y 32768 3 63
def test t1 t1 h h 0 7 0 Y 32768 4 63
def test t1 t1 h h 246 5 0 Y 0 4 63
def test t1 t1 i i 13 4 0 Y 32864 0 63
def test t1 t1 j j 10 10 0 Y 128 0 63
def test t1 t1 k k 7 19 0 N 1249 0 63
......
......@@ -19,13 +19,13 @@ INSERT INTO t1 VALUES (1), (2);
</database>
</mysqldump>
DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
CREATE TABLE `t1` (
`a` decimal(240,20) default NULL
`a` decimal(64,20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999');
......
......@@ -164,48 +164,48 @@ product country_id year sum(profit)
NULL NULL NULL 7785
select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup;
prod year 1+1 sum(profit)/count(*)
Calculator:1 :1999: 2 50.00
Calculator:1 :2000: 2 75.00
Calculator:1 NULL 2 62.50
Calculator:2 :2000: 2 75.00
Calculator:2 NULL 2 75.00
Computer:1 :1999: 2 1350.00
Computer:1 :2000: 2 1500.00
Computer:1 NULL 2 1400.00
Computer:2 :2000: 2 1350.00
Computer:2 NULL 2 1350.00
Phone:3 :2003: 2 10.00
Phone:3 NULL 2 10.00
TV:1 :1999: 2 125.00
TV:1 :2000: 2 150.00
TV:1 NULL 2 133.33
TV:2 :2000: 2 100.00
TV:2 NULL 2 100.00
NULL NULL 2 519.00
Calculator:1 :1999: 2 50.00000
Calculator:1 :2000: 2 75.00000
Calculator:1 NULL 2 62.50000
Calculator:2 :2000: 2 75.00000
Calculator:2 NULL 2 75.00000
Computer:1 :1999: 2 1350.00000
Computer:1 :2000: 2 1500.00000
Computer:1 NULL 2 1400.00000
Computer:2 :2000: 2 1350.00000
Computer:2 NULL 2 1350.00000
Phone:3 :2003: 2 10.00000
Phone:3 NULL 2 10.00000
TV:1 :1999: 2 125.00000
TV:1 :2000: 2 150.00000
TV:1 NULL 2 133.33333
TV:2 :2000: 2 100.00000
TV:2 NULL 2 100.00000
NULL NULL 2 519.00000
select product, sum(profit)/count(*) from t1 group by product with rollup;
product sum(profit)/count(*)
Calculator 68.75
Computer 1380.00
Phone 10.00
TV 120.00
NULL 519.00
Calculator 68.75000
Computer 1380.00000
Phone 10.00000
TV 120.00000
NULL 519.00000
select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup;
prod sum(profit)/count(*)
Calc 68.75
Comp 1380.00
Phon 10.00
TV 120.00
NULL 519.00
Calc 68.75000
Comp 1380.00000
Phon 10.00000
TV 120.00000
NULL 519.00000
select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup;
concat(product,':',country_id) 1+1 sum(profit)/count(*)
Calculator:1 2 62.50
Calculator:2 2 75.00
Computer:1 2 1400.00
Computer:2 2 1350.00
Phone:3 2 10.00
TV:1 2 133.33
TV:2 2 100.00
NULL 2 519.00
Calculator:1 2 62.50000
Calculator:2 2 75.00000
Computer:1 2 1400.00000
Computer:2 2 1350.00000
Phone:3 2 10.00000
TV:1 2 133.33333
TV:2 2 100.00000
NULL 2 519.00000
select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup;
product country year sum(profit)
Calculator India 2000 150
......
......@@ -293,7 +293,7 @@ t2 MyISAM 9 Fixed 0 0 0 64424509439 1024 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show table status from test like ''t9%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t9 MyISAM 10 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
t9 MyISAM 10 Dynamic 2 216 432 4294967295 2048 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
Variable_name Value
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2674,6 +2674,7 @@ Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Out of range value adjusted for column 'c7' at row 1
Note 1265 Data truncated for column 'c12' at row 1
Warning 1264 Out of range value adjusted for column 'c12' at row 1
execute my_select ;
c1 1
......@@ -2724,6 +2725,7 @@ Warning 1265 Data truncated for column 'c4' at row 1
Warning 1265 Data truncated for column 'c5' at row 1
Warning 1265 Data truncated for column 'c6' at row 1
Warning 1264 Out of range value adjusted for column 'c7' at row 1
Note 1265 Data truncated for column 'c12' at row 1
Warning 1264 Out of range value adjusted for column 'c12' at row 1
execute my_select ;
c1 -1
......
......@@ -14,6 +14,8 @@ row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3))
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
1
Warnings:
Error 1366 Incorrect decimal value: '' for column '' at row -1
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
1
......
......@@ -84,27 +84,27 @@ slave-bin.000001 229 User var 2 272 @`i2`=-12345678901234
slave-bin.000001 272 User var 2 315 @`i3`=0
slave-bin.000001 315 User var 2 358 @`i4`=-1
slave-bin.000001 358 Query 1 470 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
slave-bin.000001 470 User var 2 513 @`r1`=12.5
slave-bin.000001 513 User var 2 556 @`r2`=-12.5
slave-bin.000001 556 Query 1 654 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 654 User var 2 703 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 703 User var 2 738 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 738 User var 2 780 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 780 User var 2 822 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 822 User var 2 864 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 864 Query 1 983 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 983 User var 2 1009 @`n1`=NULL
slave-bin.000001 1009 Query 1 1100 use `test`; insert into t1 values (@n1)
slave-bin.000001 1100 User var 2 1126 @`n2`=NULL
slave-bin.000001 1126 Query 1 1217 use `test`; insert into t1 values (@n2)
slave-bin.000001 1217 Query 1 1334 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1334 User var 2 1376 @`a`=2
slave-bin.000001 1376 Query 1 1477 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1477 User var 2 1514 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 1514 Query 1 1647 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1647 User var 2 1689 @`a`=5
slave-bin.000001 1689 Query 1 1784 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1784 User var 2 1809 @`a`=NULL
slave-bin.000001 1809 Query 1 1911 use `test`; insert into t1 values (@a),(@a),(@a*5)
slave-bin.000001 470 User var 2 509 @`r1`=12.5
slave-bin.000001 509 User var 2 548 @`r2`=-12.5
slave-bin.000001 548 Query 1 646 use `test`; insert into t1 values (@r1), (@r2)
slave-bin.000001 646 User var 2 695 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
slave-bin.000001 695 User var 2 730 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
slave-bin.000001 730 User var 2 772 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 772 User var 2 814 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
slave-bin.000001 814 User var 2 856 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
slave-bin.000001 856 Query 1 975 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
slave-bin.000001 975 User var 2 1001 @`n1`=NULL
slave-bin.000001 1001 Query 1 1092 use `test`; insert into t1 values (@n1)
slave-bin.000001 1092 User var 2 1118 @`n2`=NULL
slave-bin.000001 1118 Query 1 1209 use `test`; insert into t1 values (@n2)
slave-bin.000001 1209 Query 1 1326 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
slave-bin.000001 1326 User var 2 1368 @`a`=2
slave-bin.000001 1368 Query 1 1469 use `test`; insert into t1 values (@a+(@b:=@a+1))
slave-bin.000001 1469 User var 2 1506 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
slave-bin.000001 1506 Query 1 1639 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
slave-bin.000001 1639 User var 2 1681 @`a`=5
slave-bin.000001 1681 Query 1 1776 use `test`; insert into t1 values (@a),(@a)
slave-bin.000001 1776 User var 2 1801 @`a`=NULL
slave-bin.000001 1801 Query 1 1903 use `test`; insert into t1 values (@a),(@a),(@a*5)
drop table t1;
stop slave;
......@@ -1672,7 +1672,7 @@ fld1 count(*)
158402 4181
select sum(Period)/count(*) from t1;
sum(Period)/count(*)
9410.00
9410.00000
select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
companynr count sum diff func
37 12543 309394878010 0.0000 464091
......@@ -2109,7 +2109,7 @@ select @b;
aaaa
select @c;
@c
6.26
6.260
create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
......
......@@ -120,15 +120,8 @@ ERROR 42000: End-label bar without match
create procedure foo()
return 42|
ERROR 42000: RETURN is only allowed in a FUNCTION
create function foo() returns int
begin
declare x int;
select max(c) into x from test.t;
return x;
end|
ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION
create procedure p(x int)
insert into test.t1 values (x)|
set @x = x|
create function f(x int) returns int
return x+42|
call p()|
......@@ -336,10 +329,6 @@ ERROR 42S22: Unknown column 'valname' in 'order clause'
drop procedure bug1965|
select 1 into a|
ERROR 42000: Undeclared variable: a
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t)|
ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION
drop table if exists t3|
create table t3 (column_1_0 int)|
create procedure bug1653()
......@@ -354,7 +343,7 @@ drop table t3|
create procedure bug2259()
begin
declare v1 int;
declare c1 cursor for select s1 from t10;
declare c1 cursor for select s1 from t1;
fetch c1 into v1;
end|
call bug2259()|
......@@ -458,7 +447,9 @@ create procedure bug3294()
begin
declare continue handler for sqlexception drop table t5;
drop table t5;
drop table t5;
end|
create table t5 (x int)|
call bug3294()|
ERROR 42S02: Unknown table 't5'
drop procedure bug3294|
......
......@@ -693,7 +693,7 @@ drop procedure if exists create_select|
create procedure create_select(x char(16), y int)
begin
insert into test.t1 values (x, y);
create table test.t3 select * from test.t1;
create temporary table test.t3 select * from test.t1;
insert into test.t3 values (concat(x, "2"), y+2);
end|
drop table if exists t3|
......@@ -775,11 +775,11 @@ drop procedure if exists hndlr1|
create procedure hndlr1(val int)
begin
declare x int default 0;
declare foo condition for 1146;
declare foo condition for 1136;
declare bar condition for sqlstate '42S98'; # Just for testing syntax
declare zip condition for sqlstate value '42S99'; # Just for testing syntax
declare continue handler for foo set x = 1;
insert into test.t666 values ("hndlr1", val); # Non-existing table
insert into test.t1 values ("hndlr1", val, 2); # Too many values
if (x) then
insert into test.t1 values ("hndlr1", val); # This instead then
end if;
......@@ -795,8 +795,8 @@ create procedure hndlr2(val int)
begin
declare x int default 0;
begin
declare exit handler for sqlstate '42S02' set x = 1;
insert into test.t666 values ("hndlr2", val); # Non-existing table
declare exit handler for sqlstate '21S01' set x = 1;
insert into test.t1 values ("hndlr2", val, 2); # Too many values
end;
insert into test.t1 values ("hndlr2", x);
end|
......@@ -820,7 +820,7 @@ if val < 10 then
begin
declare y int;
set y = val + 10;
insert into test.t666 values ("hndlr3", y); # Non-existing table
insert into test.t1 values ("hndlr3", y, 2); # Too many values
if x then
insert into test.t1 values ("hndlr3", y);
end if;
......@@ -1239,18 +1239,6 @@ call bug2227(9)|
1.3 x y 42 z
1.3 9 2.6 42 zzz
drop procedure bug2227|
drop procedure if exists bug2614|
create procedure bug2614()
begin
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
call bug2614()|
call bug2614()|
drop table t3|
drop procedure bug2614|
drop function if exists bug2674|
create function bug2674() returns int
return @@sort_buffer_size|
......@@ -1551,7 +1539,7 @@ drop procedure if exists bug2460_2|
create procedure bug2460_2()
begin
drop table if exists t3;
create table t3 (s1 int);
create temporary table t3 (s1 int);
insert into t3 select 1 union select 1;
end|
call bug2460_2()|
......@@ -1681,22 +1669,6 @@ call bug4726()|
call bug4726()|
drop procedure bug4726|
drop table t3|
drop table if exists t3|
create table t3 (s1 int)|
insert into t3 values (3), (4)|
drop procedure if exists bug4318|
create procedure bug4318()
handler t3 read next|
handler t3 open|
call bug4318()|
s1
3
call bug4318()|
s1
4
handler t3 close|
drop procedure bug4318|
drop table t3|
drop procedure if exists bug4902|
create procedure bug4902()
begin
......@@ -2302,22 +2274,110 @@ show procedure status like 'bar'|
Db Name Type Definer Modified Created Security_type Comment
test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333
drop procedure bar|
drop table t1;
drop table t2;
drop procedure if exists p1;
create procedure p1 () select (select s1 from t1) from t1;
create table t1 (s1 int);
call p1();
(select s1 from t1)
insert into t1 values (1);
call p1();
(select s1 from t1)
drop procedure if exists p1|
create procedure p1 ()
select (select s1 from t3) from t3|
create table t3 (s1 int)|
call p1()|
(select s1 from t3)
insert into t3 values (1)|
call p1()|
(select s1 from t3)
1
drop procedure p1;
drop table t1;
drop function if exists foo;
create function `foo` () returns int return 5;
select `foo` ();
drop procedure p1|
drop table t3|
drop function if exists foo|
create function `foo` () returns int
return 5|
select `foo` ()|
`foo` ()
5
drop function `foo`;
drop function `foo`|
drop function if exists t1max|
Warnings:
Note 1305 FUNCTION t1max does not exist
create function t1max() returns int
begin
declare x int;
select max(data) into x from t1;
return x;
end|
insert into t1 values ("foo", 3), ("bar", 2), ("zip", 5), ("zap", 1)|
select t1max()|
t1max()
5
drop function t1max|
drop table if exists t3|
create table t3 (
v char(16) not null primary key,
c int unsigned not null
)|
create function getcount(s char(16)) returns int
begin
declare x int;
select count(*) into x from t3 where v = s;
if x = 0 then
insert into t3 values (s, 1);
else
update t3 set c = c+1 where v = s;
end if;
return x;
end|
select * from t1 where data = getcount("bar")|
id data
zap 1
select * from t3|
v c
bar 4
select getcount("zip")|
getcount("zip")
0
select getcount("zip")|
getcount("zip")
1
select * from t3|
v c
bar 4
zip 2
select getcount(id) from t1 where data = 3|
getcount(id)
0
select getcount(id) from t1 where data = 5|
getcount(id)
1
select * from t3|
v c
bar 4
zip 3
foo 1
drop table t3|
drop function getcount|
drop function if exists bug5240|
create function bug5240 () returns int
begin
declare x int;
declare c cursor for select data from t1 limit 1;
open c;
fetch c into x;
close c;
return x;
end|
delete from t1|
insert into t1 values ("answer", 42)|
select id, bug5240() from t1|
id bug5240()
42 42
drop function bug5240|
drop function if exists bug5278|
create function bug5278 () returns char
begin
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
return 'okay';
end|
select bug5278()|
ERROR 42000: Can't find any matching row in the user table
select bug5278()|
ERROR 42000: Can't find any matching row in the user table
drop function bug5278|
drop table t1;
drop table t2;
......@@ -386,4 +386,18 @@ p mask example
20 \\\\% \\\\%
20 \\\\% \\\\_
DROP TABLE t1;
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\\b a\\\"b a'\\b a'\\\"b
a\\b a\\\"b a'\\b a'\\\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\\b a\\\'b a"\\b a"\\\'b
a\\b a\\\'b a"\\b a"\\\'b
SET @@SQL_MODE='';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
a\b a\"b a'\b a'\"b
a\b a\"b a'\b a'\"b
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
a\b a\'b a"\b a"\'b
a\b a\'b a"\b a"\'b
SET @@SQL_MODE=@OLD_SQL_MODE;
......@@ -531,7 +531,6 @@ Warning 1264 Out of range value adjusted for column 'col1' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 1
Warning 1264 Out of range value adjusted for column 'col1' at row 2
Warning 1264 Out of range value adjusted for column 'col2' at row 2
Warning 1264 Out of range value adjusted for column 'col2' at row 2
UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1;
col1 col2
......@@ -556,6 +555,7 @@ INSERT INTO t1 VALUES(-9223372036854775808,0),(0,0),(9223372036854775807,1844674
INSERT INTO t1 VALUES('-9223372036854775808','0'),('9223372036854775807','18446744073709551615');
INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674407370954000.0);
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(9223372036854775808);
INSERT INTO t1 (col2) VALUES(-1);
INSERT INTO t1 (col2) VALUES(18446744073709551616);
......@@ -595,6 +595,7 @@ Error 1365 Division by 0
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
Warnings:
Warning 1264 Out of range value adjusted for column 'col1' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616');
Warnings:
......@@ -616,9 +617,8 @@ col1 col2
9223372036854775807 18446744073709551615
-9223372036854775808 0
9223372036854775807 18446744073709551615
-9223372036854773760 0
9223372036854775807 1844674407370953984
-9223372036854775808 NULL
-9223372036854774000 0
9223372036854775700 1844674407370954000
-9223372036854775808 NULL
NULL 18446744073709551615
2 NULL
......@@ -632,12 +632,17 @@ NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (col1 NUMERIC(4,2));
INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01);
Warnings:
Note 1265 Data truncated for column 'col1' at row 2
Note 1265 Data truncated for column 'col1' at row 5
INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01');
Warnings:
Note 1265 Data truncated for column 'col1' at row 2
Note 1265 Data truncated for column 'col1' at row 4
INSERT INTO t1 VALUES (101.55);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES (101);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES (-101.55);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES (1010.55);
......@@ -645,7 +650,9 @@ ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES (1010);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES ('101.55');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES ('101');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES ('-101.55');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 VALUES ('-1010.55');
......@@ -661,14 +668,15 @@ ERROR 22012: Division by 0
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR HY000: Incorrect decimal value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 01000: Data truncated for column 'col1' at row 1
ERROR HY000: Incorrect decimal value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
Warnings:
Note 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
Note 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Error 1365 Division by 0
......@@ -695,22 +703,19 @@ NULL
11.00
10.00
10.55
10.55
-10.55
10.56
-10.55
-10.56
11.00
10.00
101.55
101.00
101.55
101.00
1.00
2.00
NULL
999.99
99.99
-99.99
999.99
99.99
-99.99
999.99
99.99
-99.99
DROP TABLE t1;
CREATE TABLE t1 (col1 FLOAT, col2 FLOAT UNSIGNED);
......
......@@ -890,7 +890,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 Using index
2 DEPENDENT SUBQUERY t2 index_subquery a a 5 func 2 Using index
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a chicking NULL))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
CREATE TABLE t3 (a int(11) default '0');
INSERT INTO t3 VALUES (1),(2),(3);
SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
......@@ -1462,25 +1462,25 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 chicking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL)))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 chicking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 Using index
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 chicking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL)))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL s1 5 NULL 3 Using index
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 1 Using index; Using where
Warnings:
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 chicking NULL where (`test`.`t2`.`s1` < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
Note 1003 select `test`.`t1`.`s1` AS `s1`,not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < _latin1'a2'))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
drop table t1,t2;
create table t2 (a int, b int);
create table t3 (a int);
......
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
gender CHAR(1),
......
......@@ -156,6 +156,9 @@ insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
insert into t1 values ("-.1"),("+.1"),(".1");
insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'a' at row 2
insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
......@@ -164,7 +167,7 @@ Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
......@@ -172,24 +175,24 @@ Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
-0.00
+0.00
01.00
+01.00
-01.00
0.00
0.00
1.00
1.00
-1.00
-0.10
+0.10
0.10
000000001.00
+00000001.00
-00000001.00
111111111.11
111111111.11
0.10
1.00
1.00
-1.00
99999999.99
99999999.99
-11111111.11
-99999999.99
999999999.99
999999999.99
999999999.99
99999999.99
99999999.99
99999999.99
0.00
-99999999.99
123.40
......@@ -222,7 +225,7 @@ Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
......@@ -231,15 +234,15 @@ select * from t1;
a
0.00
0.00
+0.00
01.00
+01.00
0.00
1.00
1.00
0.00
0.00
+0.10
0.10
00000001.00
+0000001.00
0.10
1.00
1.00
0.00
99999999.99
99999999.99
......@@ -280,7 +283,7 @@ Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
......@@ -319,6 +322,9 @@ insert into t1 values (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
insert into t1 values (-.1),(+.1),(.1);
insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'a' at row 2
insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
......@@ -327,12 +333,15 @@ Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values (1e+100),(1e-100),(-1e+100);
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
-0.00
0.00
0.00
1.00
1.00
......@@ -343,13 +352,13 @@ a
1.00
1.00
-1.00
111111111.11
111111111.11
99999999.99
99999999.99
-11111111.11
-99999999.99
999999999.99
999999999.99
999999999.99
99999999.99
99999999.99
99999999.99
0.00
-99999999.99
123.40
......@@ -362,16 +371,17 @@ create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'a' at row 6
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
-9999999999
-1
+1
01
+0000000001
12345678901
99999999999
1
1
1
9999999999
9999999999
drop table t1;
create table t1 (a decimal unsigned);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
......@@ -381,11 +391,11 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
0
0
+1
01
+000000001
9999999999
9999999999
1
1
1
1234567890
9999999999
drop table t1;
......@@ -397,8 +407,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
0000000000
0000000000
9999999999
9999999999
0000000001
0000000001
0000000001
......@@ -413,8 +423,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
0000000000
0000000000
9999999999
9999999999
0000000001
0000000001
0000000001
......@@ -424,19 +434,17 @@ drop table t1;
create table t1(a decimal(10,0));
insert into t1 values ("1e4294967295");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'a' at row 1
select * from t1;
a
99999999999
9999999999
delete from t1;
insert into t1 values("1e4294967297");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'a' at row 1
select * from t1;
a
99999999999
9999999999
drop table t1;
CREATE TABLE t1 (a_dec DECIMAL(-1,0));
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 '-1,0))' at line 1
......@@ -448,7 +456,7 @@ CREATE TABLE t1 (a_dec DECIMAL(0,11));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a_dec` decimal(12,11) default NULL
`a_dec` decimal(11,11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
create table t1(a decimal(7,3));
......@@ -456,64 +464,64 @@ insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000
select * from t1;
a
1.000
+1.000
1.000
-1.000
00001.000
+0001.000
-0001.000
1.000
1.000
-1.000
10.000
10.000
-10.000
10.000
10.000
+10.000
-10.000
00010.000
+0010.000
-0010.000
100.000
+100.000
100.000
-100.000
100.000
100.000
-100.000
00100.000
+0100.000
-0100.000
1000.000
+1000.000
1000.000
-1000.000
01000.000
+1000.000
1000.000
1000.000
-1000.000
10000.000
10000.000
9999.999
9999.999
-9999.999
10000.000
10000.000
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
99999.999
99999.999
9999.999
9999.999
-9999.999
drop table t1;
create table t1(a decimal(7,3) unsigned);
......@@ -521,22 +529,22 @@ insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000
select * from t1;
a
1.000
+1.000
1.000
0.000
0001.000
+001.000
1.000
1.000
0.000
10.000
+10.000
10.000
0.000
0010.000
+010.000
10.000
10.000
0.000
100.000
+100.000
100.000
0.000
0100.000
+100.000
100.000
100.000
0.000
1000.000
1000.000
......
......@@ -66,7 +66,7 @@ select a from t1 order by a;
a
-0.010
-0.002
-0.000
0.000
0.000
1.000
select min(a) from t1;
......@@ -119,7 +119,7 @@ select a from t1 order by a;
a
-0.010
-0.002
-0.000
0.000
0.000
1.000
select min(a) from t1;
......@@ -142,6 +142,9 @@ create table t1 (c20 char);
insert into t1 values (5000.0);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
insert into t1 values (0.5e4);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
......
This diff is collapsed.
......@@ -87,6 +87,8 @@ DROP INDEX test ON t1;
insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
Warning 1264 Out of range value adjusted for column 'utiny' at row 1
......@@ -122,7 +124,7 @@ select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,ut
auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col
10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1
11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2
12 0.33 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
12 0.33333333 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3
13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 18446744073709551615 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1
14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 18446744069414584321 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295
15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295
......@@ -174,7 +176,7 @@ Warning 1265 Data truncated for column 'new_field' at row 7
select * from t2;
auto string mediumblob_col new_field
1 2 2 ne
2 0.33 ne
2 0.33333333 ne
3 -1 -1 ne
4 -429496729 -4294967295 ne
5 4294967295 4294967295 ne
......@@ -268,7 +270,7 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto bigint(17) unsigned NULL NO PRI 0 select,insert,update,references
auto int(6) unsigned NULL NO PRI 0 select,insert,update,references
t1 bigint(1) NULL NO 0 select,insert,update,references
t2 varchar(1) latin1_swedish_ci NO select,insert,update,references
t3 varchar(256) latin1_swedish_ci NO select,insert,update,references
......
......@@ -565,7 +565,7 @@ a
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` double(53,1) NOT NULL default '0.0'
`a` decimal(20,1) NOT NULL default '0.0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
......@@ -788,11 +788,11 @@ create table t3 select * from t2 union select * from t1;
select * from t3;
d
1.234567800
100000000.0
100000000.000000000
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`d` decimal(10,9) default NULL
`d` decimal(19,9) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2,t3;
create table t1 select 1 union select -1;
......
......@@ -113,8 +113,8 @@ select @a:=0;
select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
@a @a:=@a+count(*) count(*) @a
0 1 1 0
0 2 2 0
0 3 3 0
0 3 2 0
0 6 3 0
select @a:=0;
@a:=0
0
......
......@@ -500,14 +500,15 @@ t1 CREATE TABLE `t1` (
`c5` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) default NULL,
`c2` double default NULL,
`c3` longtext
`c2` decimal(64,30) default NULL,
`c3` longtext,
`c4` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
......
......@@ -448,7 +448,7 @@ create view v1 as select a+1 from t1;
create table t2 select * from v1;
show columns from t2;
Field Type Null Key Default Extra
a+1 bigint(17) YES NULL
a+1 bigint(12) YES NULL
select * from t2;
a+1
2
......@@ -889,10 +889,6 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
drop view v1;
create view v1 (a,a) as select 'a','a';
ERROR 42S21: Duplicate column name 'a'
create procedure p1 () begin declare v int; create view v1 as select v; end;//
call p1();
ERROR HY000: View's SELECT contains a variable or parameter
drop procedure p1;
create table t1 (col1 int,col2 char(22));
insert into t1 values(5,'Hello, world of views');
create view v1 as select * from t1;
......
......@@ -58,7 +58,10 @@ CREATE TABLE t1 SELECT
CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
CASE WHEN 1 THEN 1.0 END AS c9
CASE WHEN 1 THEN 1.0 END AS c9,
CASE WHEN 1 THEN 0.1e1 else 0.1 END AS c10,
CASE WHEN 1 THEN 0.1e1 else 1 END AS c11,
CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
;
SHOW CREATE TABLE t1;
DROP TABLE t1;
......
......@@ -11,10 +11,12 @@ drop table if exists t1,t2;
# First some simple tests
#
select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL;
select 0<=>0,0.0<=>0.0,0E0=0E0,"A"<=>"A",NULL<=>NULL;
select 1<=>0,0<=>NULL,NULL<=>0;
select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
select "A"<=>"B","A"<=>NULL,NULL<=>"A";
select 0<=>0.0, 0.0<=>0E0, 0E0<=>"0", 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
#
# Test with tables
......
......@@ -457,6 +457,14 @@ SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
DROP TABLE t1;
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
select min(a) is null or null from t1;
select 1 and min(a) is null from t1;
drop table t1;
# Test for BUG#5400: GROUP_CONCAT returns everything twice.
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
......@@ -465,12 +473,18 @@ select group_concat( distinct col1 ) as alias from t1
drop table t1;
#
# Test BUG#8216 when referring in HAVING to n alias which is rand() function
#
#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
create table t1 (a int);
insert into t1 values(null);
select min(a) is null from t1;
select min(a) is null or null from t1;
select 1 and min(a) is null from t1;
create table t1 (a integer, b integer, c integer);
insert into t1 (a,b) values (1,2),(1,3),(2,5);
select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
select a, rand()*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
select a,sum(b) from t1 where a=1 group by c;
select a*sum(b) from t1 where a=1 group by c;
select sum(a)*sum(b) from t1 where a=1 group by c;
select a,sum(b) from t1 where a=1 group by c having a=1;
select a as d,sum(b) from t1 where a=1 group by c having d=1;
select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
drop table t1;
......@@ -189,23 +189,27 @@ delete from mysql.tables_priv where user='joe';
delete from mysql.columns_priv where user='joe';
flush privileges;
delimiter //;
create procedure px5 ()
begin
declare v int;
declare c cursor for select version from
information_schema.tables where table_schema <> 'information_schema';
open c;
fetch c into v;
select v;
close c;
end;//
call px5()//
call px5()//
delimiter ;//
select sql_mode from information_schema.ROUTINES;
drop procedure px5;
# QQ This results in NULLs instead of the version numbers when
# QQ a LOCK TABLES is in effect when selecting from
# QQ information_schema.tables. Until this bug has been fixed,
# QQ this test is disabled /pem
#delimiter //;
#create procedure px5 ()
#begin
#declare v int;
#declare c cursor for select version from
#information_schema.tables where table_schema <> 'information_schema';
#open c;
#fetch c into v;
#select v;
#close c;
#end;//
#
#call px5()//
#call px5()//
#delimiter ;//
#select sql_mode from information_schema.ROUTINES;
#drop procedure px5;
create table t1 (a int not null auto_increment,b int, primary key (a));
insert into t1 values (1,1),(NULL,3),(NULL,4);
......
......@@ -53,8 +53,8 @@ check table t1;
# Check error message
lock tables t1 write;
check table t2;
--error 1100
insert into t1 select nr from t1;
--error 1143
insert into t1 select index1,nr from t1;
unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
......
......@@ -14,7 +14,7 @@ DROP TABLE t1;
# Bug #2005
#
CREATE TABLE t1 (a decimal(240, 20));
CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
--exec $MYSQL_DUMP --compact test t1
......
......@@ -163,18 +163,9 @@ end loop bar|
create procedure foo()
return 42|
# Doesn't allow queries in FUNCTIONs (for now :-( )
--error 1314
create function foo() returns int
begin
declare x int;
select max(c) into x from test.t;
return x;
end|
# Wrong number of arguments
create procedure p(x int)
insert into test.t1 values (x)|
set @x = x|
create function f(x int) returns int
return x+42|
......@@ -439,14 +430,6 @@ drop procedure bug1965|
--error 1327
select 1 into a|
#
# BUG#1654
#
--error 1314
create function bug1654()
returns int
return (select sum(t.data) from test.t2 t)|
#
# BUG#1653
#
......@@ -475,7 +458,7 @@ drop table t3|
create procedure bug2259()
begin
declare v1 int;
declare c1 cursor for select s1 from t10;
declare c1 cursor for select s1 from t1;
fetch c1 into v1;
end|
......@@ -628,8 +611,10 @@ create procedure bug3294()
begin
declare continue handler for sqlexception drop table t5;
drop table t5;
drop table t5;
end|
create table t5 (x int)|
--error 1051
call bug3294()|
drop procedure bug3294|
......
......@@ -859,7 +859,7 @@ drop procedure if exists create_select|
create procedure create_select(x char(16), y int)
begin
insert into test.t1 values (x, y);
create table test.t3 select * from test.t1;
create temporary table test.t3 select * from test.t1;
insert into test.t3 values (concat(x, "2"), y+2);
end|
......@@ -970,12 +970,12 @@ drop procedure if exists hndlr1|
create procedure hndlr1(val int)
begin
declare x int default 0;
declare foo condition for 1146;
declare foo condition for 1136;
declare bar condition for sqlstate '42S98'; # Just for testing syntax
declare zip condition for sqlstate value '42S99'; # Just for testing syntax
declare continue handler for foo set x = 1;
insert into test.t666 values ("hndlr1", val); # Non-existing table
insert into test.t1 values ("hndlr1", val, 2); # Too many values
if (x) then
insert into test.t1 values ("hndlr1", val); # This instead then
end if;
......@@ -994,9 +994,9 @@ begin
declare x int default 0;
begin
declare exit handler for sqlstate '42S02' set x = 1;
declare exit handler for sqlstate '21S01' set x = 1;
insert into test.t666 values ("hndlr2", val); # Non-existing table
insert into test.t1 values ("hndlr2", val, 2); # Too many values
end;
insert into test.t1 values ("hndlr2", x);
......@@ -1027,7 +1027,7 @@ begin
declare y int;
set y = val + 10;
insert into test.t666 values ("hndlr3", y); # Non-existing table
insert into test.t1 values ("hndlr3", y, 2); # Too many values
if x then
insert into test.t1 values ("hndlr3", y);
end if;
......@@ -1517,23 +1517,30 @@ drop procedure bug2227|
#
# BUG#2614
#
--disable_warnings
drop procedure if exists bug2614|
--enable_warnings
create procedure bug2614()
begin
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
--disable_warnings
call bug2614()|
--enable_warnings
call bug2614()|
drop table t3|
drop procedure bug2614|
# QQ The second insert doesn't work with temporary tables (it was an
# QQ ordinary table before we changed the locking scheme). It results
# QQ in an error: 1137: Can't reopen table: 't3'
# QQ which is a known limit with temporary tables.
# QQ For this reason we can't run this test any more (i.e., if we modify
# QQ it, it's no longer a test case for the bug), but we keep it here
# QQ anyway, for tracability.
#--disable_warnings
#drop procedure if exists bug2614|
#--enable_warnings
#create procedure bug2614()
#begin
# drop table if exists t3;
# create temporary table t3 (id int default '0' not null);
# insert into t3 select 12;
# insert into t3 select * from t3;
#end|
#
#--disable_warnings
#call bug2614()|
#--enable_warnings
#call bug2614()|
#drop table t3|
#drop procedure bug2614|
#
# BUG#2674
......@@ -1912,7 +1919,7 @@ drop procedure if exists bug2460_2|
create procedure bug2460_2()
begin
drop table if exists t3;
create table t3 (s1 int);
create temporary table t3 (s1 int);
insert into t3 select 1 union select 1;
end|
......@@ -2093,27 +2100,28 @@ drop table t3|
#
# BUG#4318
#
--disable_warnings
drop table if exists t3|
--enable_warnings
create table t3 (s1 int)|
insert into t3 values (3), (4)|
--disable_warnings
drop procedure if exists bug4318|
--enable_warnings
create procedure bug4318()
handler t3 read next|
handler t3 open|
# Expect no results, as tables are closed, but there shouldn't be any errors
call bug4318()|
call bug4318()|
handler t3 close|
drop procedure bug4318|
drop table t3|
#QQ Don't know if HANDLER commands can work with SPs, or at all...
#--disable_warnings
#drop table if exists t3|
#--enable_warnings
#
#create table t3 (s1 int)|
#insert into t3 values (3), (4)|
#
#--disable_warnings
#drop procedure if exists bug4318|
#--enable_warnings
#create procedure bug4318()
# handler t3 read next|
#
#handler t3 open|
## Expect no results, as tables are closed, but there shouldn't be any errors
#call bug4318()|
#call bug4318()|
#handler t3 close|
#
#drop procedure bug4318|
#drop table t3|
#
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
......@@ -2712,30 +2720,136 @@ show create procedure bar|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'bar'|
drop procedure bar|
delimiter ;|
drop table t1;
drop table t2;
#
# rexecution
#
--disable_warnings
drop procedure if exists p1;
drop procedure if exists p1|
--enable_warnings
create procedure p1 () select (select s1 from t1) from t1;
create table t1 (s1 int);
call p1();
insert into t1 values (1);
call p1();
drop procedure p1;
drop table t1;
create procedure p1 ()
select (select s1 from t3) from t3|
create table t3 (s1 int)|
call p1()|
insert into t3 values (1)|
call p1()|
drop procedure p1|
drop table t3|
#
# backticks
#
--disable_warnings
drop function if exists foo;
drop function if exists foo|
--enable_warnings
create function `foo` () returns int
return 5|
select `foo` ()|
drop function `foo`|
#
# Implicit LOCK/UNLOCK TABLES for table access in functions
#
--disable_warning
drop function if exists t1max|
--enable_warnings
create function t1max() returns int
begin
declare x int;
select max(data) into x from t1;
return x;
end|
insert into t1 values ("foo", 3), ("bar", 2), ("zip", 5), ("zap", 1)|
select t1max()|
drop function t1max|
--disable_warnings
drop table if exists t3|
--enable_warnings
create table t3 (
v char(16) not null primary key,
c int unsigned not null
)|
create function getcount(s char(16)) returns int
begin
declare x int;
select count(*) into x from t3 where v = s;
if x = 0 then
insert into t3 values (s, 1);
else
update t3 set c = c+1 where v = s;
end if;
return x;
end|
select * from t1 where data = getcount("bar")|
select * from t3|
select getcount("zip")|
select getcount("zip")|
select * from t3|
select getcount(id) from t1 where data = 3|
select getcount(id) from t1 where data = 5|
select * from t3|
drop table t3|
drop function getcount|
#
# Former BUG#1654
# QQ Currently crashes
#
#create function bug1654() returns int
# return (select sum(t1.data) from test.t1 t)|
#
#select bug1654()|
#
# BUG#5240: Stored procedure crash if function has cursor declaration
#
--disable_warnings
drop function if exists bug5240|
--enable_warnings
create function bug5240 () returns int
begin
declare x int;
declare c cursor for select data from t1 limit 1;
open c;
fetch c into x;
close c;
return x;
end|
delete from t1|
insert into t1 values ("answer", 42)|
# QQ BUG: This returns the wrong result, id=42 instead of "answer".
select id, bug5240() from t1|
drop function bug5240|
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
#
--disable_warnings
drop function if exists bug5278|
--enable_warnings
create function `foo` () returns int return 5;
select `foo` ();
drop function `foo`;
create function bug5278 () returns char
begin
SET PASSWORD FOR 'bob'@'%.loc.gov' = PASSWORD('newpass');
return 'okay';
end|
--error 1133
select bug5278()|
--error 1133
select bug5278()|
drop function bug5278|
delimiter ;|
drop table t1;
drop table t2;
......@@ -174,4 +174,14 @@ order by masks.p, example;
DROP TABLE t1;
# Bug #6368: Make sure backslashes mixed with doubled quotes are handled
# correctly in NO_BACKSLASH_ESCAPES mode
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
SET @@SQL_MODE='';
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
SET @@SQL_MODE=@OLD_SQL_MODE;
......@@ -388,9 +388,7 @@ INSERT INTO t1 VALUES(-9223372036854775808,0),(0,0),(9223372036854775807,1844674
INSERT INTO t1 VALUES('-9223372036854775808','0'),('9223372036854775807','18446744073709551615');
INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674407370954000.0);
# The following should give an error, but doesn't until we fix the interface
# for Field_longlong::store()
-- error 1264
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
INSERT INTO t1 (col1) VALUES(9223372036854775808);
INSERT INTO t1 (col2) VALUES(-1);
......@@ -449,7 +447,9 @@ INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+
-- The 2 following inserts should generate a warning, but doesn't yet
-- because NUMERIC works like DECIMAL
--error 1264
INSERT INTO t1 VALUES (101.55);
--error 1264
INSERT INTO t1 VALUES (101);
--error 1264
INSERT INTO t1 VALUES (-101.55);
......@@ -459,7 +459,9 @@ INSERT INTO t1 VALUES (1010.55);
INSERT INTO t1 VALUES (1010);
-- The 2 following inserts should generate a warning, but doesn't yet
-- because NUMERIC works like DECIMAL
--error 1264
INSERT INTO t1 VALUES ('101.55');
--error 1264
INSERT INTO t1 VALUES ('101');
--error 1264
INSERT INTO t1 VALUES ('-101.55');
......@@ -475,11 +477,13 @@ UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
--error 1365
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
--error 1265
#--error 1265
--error 1366
INSERT INTO t1 (col1) VALUES ('');
--error 1265
#--error 1265
--error 1366
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
#--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 values (1/0);
......
......@@ -2,7 +2,7 @@
# Various tests for SUM(DISTINCT ...)
#
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (
......
......@@ -84,6 +84,7 @@ drop table t1;
#
create table t1 (c20 char);
insert into t1 values (5000.0);
insert into t1 values (0.5e4);
drop table t1;
# Errors
......
This diff is collapsed.
......@@ -368,8 +368,8 @@ show create table t1;
drop table t1;
#
# What types and widths have variables?
set @arg00= 8, @arg01= 8.8, @arg02= 'a string';
create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4;
show create table t1;
drop table t1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -57,4 +57,5 @@ class Item_sum_unique_users :public Item_sum_num
return new Item_sum_unique_users(thd, this);
}
void print(String *str) { str->append("0.0", 3); }
Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment