Commit 2be1005b authored by jan@hundin.mysql.fi's avatar jan@hundin.mysql.fi

Merge jlindstrom@build.mysql.com:/home/bk/mysql-4.1

into hundin.mysql.fi:/home/jan/mysql-4.1
parents 7d9766b1 07700678
...@@ -102,6 +102,7 @@ miguel@hegel.txg.br ...@@ -102,6 +102,7 @@ miguel@hegel.txg.br
miguel@light. miguel@light.
miguel@light.local miguel@light.local
miguel@sartre.local miguel@sartre.local
mikael@mc04.(none)
mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
mikron@mikael-ronstr-ms-dator.local mikron@mikael-ronstr-ms-dator.local
mleich@mysql.com mleich@mysql.com
...@@ -132,6 +133,7 @@ mwagner@here.mwagner.org ...@@ -132,6 +133,7 @@ mwagner@here.mwagner.org
mwagner@work.mysql.com mwagner@work.mysql.com
mydev@mysql.com mydev@mysql.com
mysql@home.(none) mysql@home.(none)
mysql@mc04.(none)
mysqldev@build.mysql2.com mysqldev@build.mysql2.com
mysqldev@melody.local mysqldev@melody.local
mysqldev@mysql.com mysqldev@mysql.com
...@@ -161,6 +163,7 @@ ram@ram.(none) ...@@ -161,6 +163,7 @@ ram@ram.(none)
ranger@regul.home.lan ranger@regul.home.lan
rburnett@build.mysql.com rburnett@build.mysql.com
root@home.(none) root@home.(none)
root@mc04.(none)
root@x3.internalnet root@x3.internalnet
salle@banica.(none) salle@banica.(none)
salle@geopard.(none) salle@geopard.(none)
......
...@@ -1548,16 +1548,43 @@ dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used ...@@ -1548,16 +1548,43 @@ dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
AC_ARG_WITH([ndb-sci],
AC_HELP_STRING([--with-ndb-sci=DIR],
[Provide MySQL with a custom location of
sci library. Given DIR, sci library is
assumed to be in $DIR/lib and header files
in $DIR/include.]),
[mysql_sci_dir=${withval}],
[mysql_sci_dir=""])
case "$mysql_sci_dir" in
"no" )
have_ndb_sci=no
AC_MSG_RESULT([-- not including sci transporter])
;;
* )
if test -f "$mysql_sci_dir/lib/libsisci.a" -a \
-f "$mysql_sci_dir/include/sisci_api.h"; then
NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])
AC_SUBST(NDB_SCI_INCLUDES)
AC_SUBST(NDB_SCI_LIBS)
have_ndb_sci="yes"
AC_MSG_RESULT([found sci transporter in $mysql_sci_dir/{include, lib}])
else
AC_MSG_RESULT([could not find sci transporter in $mysql_sci_dir/{include, lib}])
fi
;;
esac
AC_ARG_WITH([ndb-shm], AC_ARG_WITH([ndb-shm],
[ [
--with-ndb-shm Include the NDB Cluster shared memory transporter], --with-ndb-shm Include the NDB Cluster shared memory transporter],
[ndb_shm="$withval"], [ndb_shm="$withval"],
[ndb_shm=no]) [ndb_shm=no])
AC_ARG_WITH([ndb-sci],
[
--with-ndb-sci Include the NDB Cluster sci transporter],
[ndb_sci="$withval"],
[ndb_sci=no])
AC_ARG_WITH([ndb-test], AC_ARG_WITH([ndb-test],
[ [
--with-ndb-test Include the NDB Cluster ndbapi test programs], --with-ndb-test Include the NDB Cluster ndbapi test programs],
...@@ -1590,19 +1617,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ ...@@ -1590,19 +1617,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
;; ;;
esac esac
have_ndb_sci=no
case "$ndb_sci" in
yes )
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])
have_ndb_sci="yes"
;;
* )
AC_MSG_RESULT([-- not including sci transporter])
;;
esac
have_ndb_test=no have_ndb_test=no
case "$ndb_test" in case "$ndb_test" in
yes ) yes )
......
...@@ -34,7 +34,7 @@ mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) ...@@ -34,7 +34,7 @@ mysqlcheck_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqlshow_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqldump_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqlimport_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqltest_SOURCES= mysqltest.c mysqltest_SOURCES= mysqltest.c ../mysys/my_getsystime.c
mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqltest_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c
mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB) mysqlbinlog_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) $(DEPLIB)
......
...@@ -58,6 +58,13 @@ ...@@ -58,6 +58,13 @@
#include <stdarg.h> #include <stdarg.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <violite.h> #include <violite.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 256
#endif
#define MAX_QUERY 131072 #define MAX_QUERY 131072
#define MAX_VAR_NAME 256 #define MAX_VAR_NAME 256
...@@ -75,7 +82,7 @@ ...@@ -75,7 +82,7 @@
#ifndef MYSQL_MANAGER_PORT #ifndef MYSQL_MANAGER_PORT
#define MYSQL_MANAGER_PORT 23546 #define MYSQL_MANAGER_PORT 23546
#endif #endif
#define MAX_SERVER_ARGS 20 #define MAX_SERVER_ARGS 64
/* /*
Sometimes in a test the client starts before Sometimes in a test the client starts before
...@@ -132,6 +139,13 @@ static char *embedded_server_args[MAX_SERVER_ARGS]; ...@@ -132,6 +139,13 @@ static char *embedded_server_args[MAX_SERVER_ARGS];
static my_bool display_result_vertically= FALSE, display_metadata= FALSE; static my_bool display_result_vertically= FALSE, display_metadata= FALSE;
/* See the timer_output() definition for details */
static char *timer_file = NULL;
static ulonglong timer_start;
static int got_end_timer= FALSE;
static void timer_output(void);
static ulonglong timer_now(void);
static const char *embedded_server_groups[] = { static const char *embedded_server_groups[] = {
"server", "server",
"embedded", "embedded",
...@@ -230,6 +244,7 @@ Q_ENABLE_METADATA, Q_DISABLE_METADATA, ...@@ -230,6 +244,7 @@ Q_ENABLE_METADATA, Q_DISABLE_METADATA,
Q_EXEC, Q_DELIMITER, Q_EXEC, Q_DELIMITER,
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS, Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER,
Q_UNKNOWN, /* Unknown command. */ Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */ Q_COMMENT, /* Comments, ignored. */
...@@ -308,6 +323,8 @@ const char *command_names[]= ...@@ -308,6 +323,8 @@ const char *command_names[]=
"horizontal_results", "horizontal_results",
"query_vertical", "query_vertical",
"query_horizontal", "query_horizontal",
"start_timer",
"end_timer",
0 0
}; };
...@@ -844,10 +861,10 @@ int do_source(struct st_query* q) ...@@ -844,10 +861,10 @@ int do_source(struct st_query* q)
1 error 1 error
*/ */
int do_exec(struct st_query* q) static void do_exec(struct st_query* q)
{ {
int error= 0; int error;
DYNAMIC_STRING *ds; DYNAMIC_STRING *ds= NULL; /* Assign just to avoid warning */
DYNAMIC_STRING ds_tmp; DYNAMIC_STRING ds_tmp;
char buf[1024]; char buf[1024];
FILE *res_file; FILE *res_file;
...@@ -884,7 +901,15 @@ int do_exec(struct st_query* q) ...@@ -884,7 +901,15 @@ int do_exec(struct st_query* q)
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
replace_dynstr_append_mem(ds, buf, strlen(buf)); replace_dynstr_append_mem(ds, buf, strlen(buf));
}
error= pclose(res_file);
if (error != 0)
die("command \"%s\" failed", cmd);
if (!disable_result_log)
{
if (glob_replace) if (glob_replace)
free_replace(); free_replace();
...@@ -902,9 +927,6 @@ int do_exec(struct st_query* q) ...@@ -902,9 +927,6 @@ int do_exec(struct st_query* q)
if (ds == &ds_tmp) if (ds == &ds_tmp)
dynstr_free(&ds_tmp); dynstr_free(&ds_tmp);
} }
pclose(res_file);
DBUG_RETURN(error);
} }
...@@ -1986,6 +2008,8 @@ static struct my_option my_long_options[] = ...@@ -1986,6 +2008,8 @@ static struct my_option my_long_options[] =
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
{"test-file", 'x', "Read test from/in this file (default stdin).", {"test-file", 'x', "Read test from/in this file (default stdin).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"timer-file", 'm', "File where the timing in micro seconds is stored.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmpdir", 't', "Temporary directory where sockets are put.", {"tmpdir", 't', "Temporary directory where sockets are put.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR, {"user", 'u', "User for login.", (gptr*) &user, (gptr*) &user, 0, GET_STR,
...@@ -2047,6 +2071,19 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -2047,6 +2071,19 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
die("Could not open %s: errno = %d", argument, errno); die("Could not open %s: errno = %d", argument, errno);
break; break;
} }
case 'm':
{
static char buff[FN_REFLEN];
if (!test_if_hard_path(argument))
{
strxmov(buff, opt_basedir, argument, NullS);
argument= buff;
}
fn_format(buff, argument, "", "", 4);
timer_file= buff;
unlink(timer_file); /* Ignore error, may not exist */
break;
}
case 'p': case 'p':
if (argument) if (argument)
{ {
...@@ -2128,7 +2165,7 @@ char* safe_str_append(char* buf, const char* str, int size) ...@@ -2128,7 +2165,7 @@ char* safe_str_append(char* buf, const char* str, int size)
void str_to_file(const char* fname, char* str, int size) void str_to_file(const char* fname, char* str, int size)
{ {
int fd; int fd;
char buff[FN_REFLEN]; char buff[MAXPATHLEN];
if (!test_if_hard_path(fname)) if (!test_if_hard_path(fname))
{ {
strxmov(buff, opt_basedir, fname, NullS); strxmov(buff, opt_basedir, fname, NullS);
...@@ -2599,6 +2636,9 @@ int main(int argc, char **argv) ...@@ -2599,6 +2636,9 @@ int main(int argc, char **argv)
DBUG_ENTER("main"); DBUG_ENTER("main");
DBUG_PROCESS(argv[0]); DBUG_PROCESS(argv[0]);
/* Use all time until exit if no explicit 'start_timer' */
timer_start= timer_now();
save_file[0]=0; save_file[0]=0;
TMPDIR[0]=0; TMPDIR[0]=0;
memset(cons, 0, sizeof(cons)); memset(cons, 0, sizeof(cons));
...@@ -2811,7 +2851,16 @@ int main(int argc, char **argv) ...@@ -2811,7 +2851,16 @@ int main(int argc, char **argv)
(void) mysql_ping(&cur_con->mysql); (void) mysql_ping(&cur_con->mysql);
break; break;
case Q_EXEC: case Q_EXEC:
(void) do_exec(q); do_exec(q);
break;
case Q_START_TIMER:
/* Overwrite possible earlier start of timer */
timer_start= timer_now();
break;
case Q_END_TIMER:
/* End timer before ending mysqltest */
timer_output();
got_end_timer= TRUE;
break; break;
default: processed = 0; break; default: processed = 0; break;
} }
...@@ -2847,6 +2896,8 @@ int main(int argc, char **argv) ...@@ -2847,6 +2896,8 @@ int main(int argc, char **argv)
printf("ok\n"); printf("ok\n");
} }
if (!got_end_timer)
timer_output(); /* No end_timer cmd, end it */
free_used_memory(); free_used_memory();
exit(error ? 1 : 0); exit(error ? 1 : 0);
return error ? 1 : 0; /* Keep compiler happy */ return error ? 1 : 0; /* Keep compiler happy */
...@@ -2900,6 +2951,45 @@ static int read_server_arguments(const char *name) ...@@ -2900,6 +2951,45 @@ static int read_server_arguments(const char *name)
return 0; return 0;
} }
/****************************************************************************\
*
* A primitive timer that give results in milliseconds if the
* --timer-file=<filename> is given. The timer result is written
* to that file when the result is available. To not confuse
* mysql-test-run with an old obsolete result, we remove the file
* before executing any commands. The time we measure is
*
* - If no explicit 'start_timer' or 'end_timer' is given in the
* test case, the timer measure how long we execute in mysqltest.
*
* - If only 'start_timer' is given we measure how long we execute
* from that point until we terminate mysqltest.
*
* - If only 'end_timer' is given we measure how long we execute
* from that we enter mysqltest to the 'end_timer' is command is
* executed.
*
* - If both 'start_timer' and 'end_timer' are given we measure
* the time between executing the two commands.
*
\****************************************************************************/
static void timer_output(void)
{
if (timer_file)
{
char buf[1024];
ulonglong timer= timer_now() - timer_start;
sprintf(buf,"%llu",timer);
str_to_file(timer_file,buf,strlen(buf));
}
}
static ulonglong timer_now(void)
{
return my_getsystime() / 10000;
}
/**************************************************************************** /****************************************************************************
* Handle replacement of strings * Handle replacement of strings
****************************************************************************/ ****************************************************************************/
......
...@@ -3024,11 +3024,11 @@ AC_SUBST([ndb_port_base]) ...@@ -3024,11 +3024,11 @@ AC_SUBST([ndb_port_base])
ndb_transporter_opt_objs="" ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes if test X"$have_ndb_shm" = Xyes
then then
ndb_transporter_opt_objs="$(ndb_transporter_opt_objs) SHM_Transporter.lo SHM_Transporter.unix.lo" ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
fi fi
if test X"$have_ndb_sci" = Xyes if test X"$have_ndb_sci" = Xyes
then then
ndb_transporter_opt_objs="$(ndb_transporter_opt_objs) SCI_Transporter.lo" ndb_transporter_opt_objs="$ndb_transporter_opt_objs SCI_Transporter.lo"
fi fi
AC_SUBST([ndb_transporter_opt_objs]) AC_SUBST([ndb_transporter_opt_objs])
......
...@@ -1190,13 +1190,13 @@ execute stmt1 using @arg00 ; ...@@ -1190,13 +1190,13 @@ execute stmt1 using @arg00 ;
######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ######## ######## SELECT .. WHERE column(year)=value(DOUBLE(m,n)/DOUBLE) ########
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
...@@ -540,6 +540,10 @@ FROM t9, ...@@ -540,6 +540,10 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
--enable_metadata --enable_metadata
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
#
# Result log was disabled upon test case failure in the optimized build.
#
--disable_result_log
execute stmt1 ; execute stmt1 ;
--disable_metadata --disable_metadata
execute stmt1 ; execute stmt1 ;
...@@ -588,6 +592,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, ...@@ -588,6 +592,7 @@ execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
--disable_metadata --disable_metadata
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
--enable_result_log
drop table t2 ; drop table t2 ;
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ IndexMemory= CHOOSE_IndexMemory ...@@ -6,6 +6,7 @@ IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000 TimeBetweenWatchDogCheck= 30000
DataDir= CHOOSE_FILESYSTEM DataDir= CHOOSE_FILESYSTEM
MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
[ndbd] [ndbd]
HostName= CHOOSE_HOSTNAME_1 HostName= CHOOSE_HOSTNAME_1
......
...@@ -44,7 +44,8 @@ initial_ndb= ...@@ -44,7 +44,8 @@ initial_ndb=
status_ndb= status_ndb=
ndb_diskless=0 ndb_diskless=0
ndb_con_op=100000 ndb_no_ord=512
ndb_con_op=105000
ndb_dmem=80M ndb_dmem=80M
ndb_imem=24M ndb_imem=24M
...@@ -65,6 +66,7 @@ while test $# -gt 0; do ...@@ -65,6 +66,7 @@ while test $# -gt 0; do
status_ndb=1 status_ndb=1
;; ;;
--small) --small)
ndb_no_ord=128
ndb_con_op=10000 ndb_con_op=10000
ndb_dmem=40M ndb_dmem=40M
ndb_imem=12M ndb_imem=12M
...@@ -128,6 +130,7 @@ port_transporter=`expr $ndb_mgmd_port + 2` ...@@ -128,6 +130,7 @@ port_transporter=`expr $ndb_mgmd_port + 2`
if [ $initial_ndb ] ; then if [ $initial_ndb ] ; then
sed \ sed \
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \ -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \ -e s,"CHOOSE_DataMemory","$ndb_dmem",g \
-e s,"CHOOSE_IndexMemory","$ndb_imem",g \ -e s,"CHOOSE_IndexMemory","$ndb_imem",g \
......
This diff is collapsed.
reset master;
create database `drop-temp+table-test`;
use `drop-temp+table-test`;
create temporary table `table:name` (a int);
select get_lock("a",10);
get_lock("a",10)
1
select get_lock("a",10);
get_lock("a",10)
1
show binlog events;
drop database `drop-temp+table-test`;
drop table if exists t1,t2;
create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
ERROR 23000: Duplicate entry '16' for key 1
insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
select * from t2;
payoutID
1
4
6
9
10
11
12
14
16
19
20
22
drop table t1,t2;
CREATE TABLE `t1` (
`numeropost` bigint(20) unsigned NOT NULL default '0',
`icone` tinyint(4) unsigned NOT NULL default '0',
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
`contenu` text NOT NULL,
`pseudo` varchar(50) NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`ip` bigint(11) NOT NULL default '0',
`signature` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`,`numreponse`)
,KEY `ip` (`ip`),
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
) ENGINE=MyISAM;
CREATE TABLE `t2` (
`numeropost` bigint(20) unsigned NOT NULL default '0',
`icone` tinyint(4) unsigned NOT NULL default '0',
`numreponse` bigint(20) unsigned NOT NULL auto_increment,
`contenu` text NOT NULL,
`pseudo` varchar(50) NOT NULL default '',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`ip` bigint(11) NOT NULL default '0',
`signature` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`numeropost`,`numreponse`),
KEY `ip` (`ip`),
KEY `date` (`date`),
KEY `pseudo` (`pseudo`),
KEY `numreponse` (`numreponse`)
) ENGINE=MyISAM;
INSERT INTO t2
(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
(9,1,56,'test','joce','2001-07-25 13:50:53'
,3649052399,0);
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
WHERE numeropost=9 ORDER BY numreponse ASC;
show variables like '%bulk%';
Variable_name Value
bulk_insert_buffer_size 8388608
INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
WHERE numeropost=9 ORDER BY numreponse ASC;
DROP TABLE t1,t2;
create table t1(a int, unique(a));
insert into t1 values(2);
create table t2(a int);
insert into t2 values(1),(2);
reset master;
insert into t1 select * from t2;
ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
select * from t1;
a
1
2
drop table t1, t2;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
insert into t1 values (a+3);
insert into t1 values (4),(a+5);
insert into t1 select * from t1;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
insert into t1 select * from t1 as t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
insert into t2 select * from t1 as t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
insert into t1 select t2.a from t1,t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
insert into t1 select * from t1,t1;
ERROR 42000: Not unique table/alias: 't1'
drop table t1,t2;
create table t1 (a int not null primary key, b char(10));
create table t2 (a int not null, b char(10));
insert into t1 values (1,"t1:1"),(3,"t1:3");
insert into t2 values (2,"t2:2"), (3,"t2:3");
insert into t1 select * from t2;
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 t1:1
3 t1:3
2 t2:2
replace into t1 select * from t2;
select * from t1;
a b
1 t1:1
3 t2:3
2 t2:2
drop table t1,t2;
CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
drop table t1,t2;
CREATE TABLE t1(
Month date NOT NULL,
Type tinyint(3) unsigned NOT NULL auto_increment,
Field int(10) unsigned NOT NULL,
Count int(10) unsigned NOT NULL,
UNIQUE KEY Month (Month,Type,Field)
);
insert into t1 Values
(20030901, 1, 1, 100),
(20030901, 1, 2, 100),
(20030901, 2, 1, 100),
(20030901, 2, 2, 100),
(20030901, 3, 1, 100);
select * from t1;
Month Type Field Count
2003-09-01 1 1 100
2003-09-01 1 2 100
2003-09-01 2 1 100
2003-09-01 2 2 100
2003-09-01 3 1 100
Select null, Field, Count From t1 Where Month=20030901 and Type=2;
NULL Field Count
NULL 1 100
NULL 2 100
create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2
select * from t2;
No Field Count
0 1 100
0 2 100
drop table t1, t2;
...@@ -72,4 +72,82 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8 ...@@ -72,4 +72,82 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 100 3 4 5 PENDING 0000-00-00 00:00:00 1 100 3 4 5 PENDING 0000-00-00 00:00:00
1 101 3 4 5 PENDING 0000-00-00 00:00:00 1 101 3 4 5 PENDING 0000-00-00 00:00:00
2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00 2 102 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
delete from t1;
insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
SET SQL_MODE='';
insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
0 0 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 99 PENDING EXTRA 2004-01-01 00:00:00
alter table t1 drop column col4_5;
insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
col6 col1 col3 fourth col4 col5 col7 col8
0 0 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
1 103 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
2 104 4 3 5 PENDING EXTRA 2004-01-01 00:00:00
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
ALTER TABLE t1 ADD COLUMN c int not null;
select * from t1 order by a;
a b c
9410 9412 0
select * from t1 order by a;
a b c
9410 9412 0
alter table t1 drop c;
select * from t1 order by a;
a b
9410 9412
drop table t1;
select * from t1 order by a;
ERROR 42S02: Table 'test.t1' doesn't exist
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1 order by a;
a b
0 1
17 18
alter table t1 modify column a int not null auto_increment;
select * from t1 order by a;
a b
0 1
17 18
INSERT INTO t1 VALUES (0,19),(20,21);
select * from t1 order by a;
a b
0 1
17 18
18 19
20 21
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1;
a b
17 18
0 1
alter table t1 add c int not null unique auto_increment;
select * from t1 order by a;
a b c
0 1 2
17 18 1
INSERT INTO t1 VALUES (18,19,3),(20,21,0);
select * from t1 order by a;
a b c
0 1 2
17 18 1
18 19 3
20 21 4
drop table t1; drop table t1;
drop table if exists t1;
create table t1 (
a char(3) character set latin1 collate latin1_bin primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
insert into t1 values('AAA');
select * from t1 order by a;
a
AAA
aAa
aaa
select * from t1 where a = 'aAa';
a
aAa
select * from t1 where a = 'aaa';
a
aaa
select * from t1 where a = 'AaA';
a
select * from t1 where a = 'AAA';
a
AAA
drop table t1;
create table t1 (
a char(3) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 1
insert into t1 values('AAA');
ERROR 23000: Duplicate entry 'AAA' for key 1
select * from t1 order by a;
a
aAa
select * from t1 where a = 'aAa';
a
aAa
select * from t1 where a = 'aaa';
a
aAa
select * from t1 where a = 'AaA';
a
aAa
select * from t1 where a = 'AAA';
a
aAa
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
select * from t1 where a = 'aAa';
p a
1 aAa
select * from t1 where a = 'aaa';
p a
2 aaa
select * from t1 where a = 'AaA';
p a
select * from t1 where a = 'AAA';
p a
3 AAA
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
ERROR 23000: Can't write, because of unique constraint, to table 't1'
insert into t1 values(3, 'AAA');
ERROR 23000: Can't write, because of unique constraint, to table 't1'
select * from t1 order by p;
p a
1 aAa
select * from t1 where a = 'aAa';
p a
1 aAa
select * from t1 where a = 'aaa';
p a
1 aAa
select * from t1 where a = 'AaA';
p a
1 aAa
select * from t1 where a = 'AAA';
p a
1 aAa
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
index(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
explain select * from t1 where a = 'zZz' order by p;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
4 aAa
select * from t1 where a = 'aaa' order by p;
p a
2 aaa
5 aaa
select * from t1 where a = 'AaA' order by p;
p a
select * from t1 where a = 'AAA' order by p;
p a
3 AAA
6 AAA
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
index(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
explain select * from t1 where a = 'zZz' order by p;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'aaa' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'AaA' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'AAA' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
drop table t1;
...@@ -4,7 +4,7 @@ PORT varchar(16) NOT NULL, ...@@ -4,7 +4,7 @@ PORT varchar(16) NOT NULL,
ACCESSNODE varchar(16) NOT NULL, ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL, POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL, ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL, CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16), PROVIDER varchar(16),
TEXPIRE int unsigned, TEXPIRE int unsigned,
NUM_IP int unsigned, NUM_IP int unsigned,
......
set global max_allowed_packet=100;
set max_allowed_packet=100;
set global net_buffer_length=100;
set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
1024
select repeat('a',2000);
repeat('a',2000)
NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1024) - truncated
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default;
set max_allowed_packet=default;
set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
len
100
select length(repeat('a',2000));
length(repeat('a',2000))
2000
...@@ -908,53 +908,11 @@ FROM t9, ...@@ -908,53 +908,11 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr execute stmt1 ;
def scalar_s 5 21 7 Y 32768 4 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s, GROUP BY t9.c15 LIMIT 1) as scalar_s,
...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ; ...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def scalar_s 5 23 2 Y 32768 31 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ; drop table t2 ;
select 1 < (select a from t1) ; select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
...@@ -3192,17 +3108,21 @@ found ...@@ -3192,17 +3108,21 @@ found
true true
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
found found
true
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
found found
true
drop table t1, t9; drop table t1, t9;
...@@ -908,53 +908,11 @@ FROM t9, ...@@ -908,53 +908,11 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr execute stmt1 ;
def scalar_s 5 21 7 Y 32768 4 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s, GROUP BY t9.c15 LIMIT 1) as scalar_s,
...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ; ...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def scalar_s 5 23 2 Y 32768 31 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ; drop table t2 ;
select 1 < (select a from t1) ; select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
...@@ -3175,17 +3091,21 @@ found ...@@ -3175,17 +3091,21 @@ found
true true
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
found found
true
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
found found
true
drop table t1, t9; drop table t1, t9;
...@@ -909,53 +909,11 @@ FROM t9, ...@@ -909,53 +909,11 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr execute stmt1 ;
def scalar_s 5 21 7 Y 32768 4 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s, GROUP BY t9.c15 LIMIT 1) as scalar_s,
...@@ -978,56 +936,14 @@ set @arg09= 40e-1 ; ...@@ -978,56 +936,14 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def scalar_s 5 23 2 Y 32768 31 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
18 1 0 1
2 0 1 0
18 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ; drop table t2 ;
select 1 < (select a from t1) ; select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
...@@ -3176,17 +3092,21 @@ found ...@@ -3176,17 +3092,21 @@ found
true true
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
found found
true
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
found found
true
drop table t1, t9; drop table t1, t9;
This diff is collapsed.
...@@ -908,53 +908,11 @@ FROM t9, ...@@ -908,53 +908,11 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr execute stmt1 ;
def scalar_s 5 21 7 Y 32768 4 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
18.0000 1 0 1
execute stmt1 ;
scalar_s exists_s in_s in_row_s
2.0000 0 1 0
2.0000 0 1 0
18.0000 1 0 1
18.0000 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s, GROUP BY t9.c15 LIMIT 1) as scalar_s,
...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ; ...@@ -977,56 +935,14 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def scalar_s 5 23 2 Y 32768 31 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
18 1 0 1
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
2 0 1 0
2 0 1 0
18 1 0 1
18 1 0 1
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2
1 PRIMARY t9 ALL NULL NULL NULL NULL 3 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ; drop table t2 ;
select 1 < (select a from t1) ; select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
...@@ -3175,17 +3091,21 @@ found ...@@ -3175,17 +3091,21 @@ found
true true
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
found found
true
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
found found
true
drop table t1, t9; drop table t1, t9;
...@@ -909,53 +909,11 @@ FROM t9, ...@@ -909,53 +909,11 @@ FROM t9,
(select c25 x, c32 y from t2) tt WHERE x = c25 ' ; (select c25 x, c32 y from t2) tt WHERE x = c25 ' ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr execute stmt1 ;
def scalar_s 5 21 7 Y 32768 4 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
execute stmt1 ;
scalar_s exists_s in_s in_row_s
18.0000 1 0 1
2.0000 0 1 0
18.0000 1 0 1
2.0000 0 1 0
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 ; execute stmt1 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 ; execute stmt1 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
set @stmt= ' SELECT set @stmt= ' SELECT
(SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2 (SELECT SUM(c1+c12+?) FROM t2 where (t9.c2-?)=t2.c2
GROUP BY t9.c15 LIMIT 1) as scalar_s, GROUP BY t9.c15 LIMIT 1) as scalar_s,
...@@ -978,56 +936,14 @@ set @arg09= 40e-1 ; ...@@ -978,56 +936,14 @@ set @arg09= 40e-1 ;
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def scalar_s 5 23 2 Y 32768 31 8
def exists_s 8 1 1 N 32769 0 8
def in_s 8 21 1 Y 32768 0 8
def in_row_s 8 21 1 Y 32768 0 8
scalar_s exists_s in_s in_row_s
18 1 0 1
2 0 1 0
18 1 0 1
2 0 1 0
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
scalar_s exists_s in_s in_row_s
18 1 0 1
2 0 1 0
18 1 0 1
2 0 1 0
set @stmt= concat('explain ',@stmt); set @stmt= concat('explain ',@stmt);
prepare stmt1 from @stmt ; prepare stmt1 from @stmt ;
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32801 0 8
def select_type 253 19 18 N 1 31 8
def table 253 64 10 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 8 3 0 Y 32800 0 8
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32801 0 8
def Extra 253 255 44 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06,
@arg07, @arg08, @arg09 ; @arg07, @arg08, @arg09 ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t9 ALL NULL NULL NULL NULL 2
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 2 Using where
6 DERIVED t2 ALL NULL NULL NULL NULL 2
5 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
4 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort
drop table t2 ; drop table t2 ;
select 1 < (select a from t1) ; select 1 < (select a from t1) ;
ERROR 21000: Subquery returns more than 1 row ERROR 21000: Subquery returns more than 1 row
...@@ -3154,17 +3070,21 @@ found ...@@ -3154,17 +3070,21 @@ found
true true
set @arg00= 1.991e+3 ; set @arg00= 1.991e+3 ;
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= 1.991e+3 ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01 ;
found found
true
select 'true' as found from t9 select 'true' as found from t9
where c1= 20 and c17= @arg00 ; where c1= 20 and abs(c17 - @arg00) < 0.01 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= 1.991e+3" ; where c1= 20 and abs(c17 - 1.991e+3) < 0.01" ;
execute stmt1 ; execute stmt1 ;
found found
true
prepare stmt1 from "select 'true' as found from t9 prepare stmt1 from "select 'true' as found from t9
where c1= 20 and c17= ?" ; where c1= 20 and abs(c17 - ?) < 0.01" ;
execute stmt1 using @arg00 ; execute stmt1 using @arg00 ;
found found
true
drop table t1, t9; drop table t1, t9;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
drop table if exists t1;
SELECT 10,10.0,10.,.1e+2,100.0e-1;
10 10.0 10. .1e+2 100.0e-1
10 10.0 10 10 10
SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
6e-05 -6e-05 --6e-05 -6e-05+1.000000
6e-05 -6e-05 6e-05 0.99994
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
10 10 10 10 10 10 0.1 0.1 0.1
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
f1 float NULL YES NULL
f2 double NULL YES NULL
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
Warnings:
Warning 1264 Data truncated; out of range for column 'f1' at row 7
Warning 1264 Data truncated; out of range for column 'f1' at row 8
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
select * from t1;
f1 f2
10 10
100000 100000
1.23457e+09 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
1e-05 1e-05
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
0 1e-50
0 1e-150
drop table t1;
create table t1 (datum double);
insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
select * from t1;
datum
0.5
1
1.5
2
2.5
select * from t1 where datum < 1.5;
datum
0.5
1
select * from t1 where datum > 1.5;
datum
2
2.5
select * from t1 where datum = 1.5;
datum
1.5
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
select a from t1 order by a;
a
-0.010
-0.002
-0.000
0.000
1.000
select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (c1 double, c2 varchar(20));
insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
col
140.36
create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
select * from t2;
col1 col2 col3 col4
140.36 121.00000 121 3.47850542618522e-07
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`col1` double default NULL,
`col2` double(22,5) default NULL,
`col3` double default NULL,
`col4` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2;
create table t1 (a float);
insert into t1 values (1);
select max(a),min(a),avg(a) from t1;
max(a) min(a) avg(a)
1 1 1
drop table t1;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
f float NULL YES NULL
f2 float NULL YES NULL
f3 float(6,2) NULL YES NULL
d double NULL YES NULL
d2 double NULL YES NULL
d3 double(10,3) NULL YES NULL
de decimal(10,0) NULL YES NULL
de2 decimal(6,0) NULL YES NULL
de3 decimal(5,2) NULL YES NULL
n decimal(10,0) NULL YES NULL
n2 decimal(8,0) NULL YES NULL
n3 decimal(7,6) NULL YES NULL
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
select a from t1 order by a;
a
-0.010
-0.002
-0.000
0.000
1.000
select min(a) from t1;
min(a)
-0.010
drop table t1;
create table t1 (a float(200,100), b double(200,100));
insert t1 values (1.0, 2.0);
select * from t1;
a b
1.000000000000000000000000000000 2.000000000000000000000000000000
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` float(200,30) default NULL,
`b` double(200,30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (c20 char);
insert into t1 values (5000.0);
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
This diff is collapsed.
-- disable_result_log
--exec ../tests/client_test --testcase --user=root --socket=var/tmp/master.sock --port=$MYSQL_TCP_PORT
...@@ -47,6 +47,71 @@ select * from t1 order by col1; ...@@ -47,6 +47,71 @@ select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00'); insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status; show table status;
select * from t1 order by col1; select * from t1 order by col1;
delete from t1;
insert into t1 values (0,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
SET SQL_MODE='';
insert into t1 values (1,0,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
alter table t1 drop column col4_5;
insert into t1 values (2,0,4,3,5,"PENDING","EXTRA",'2004-01-01 00:00:00');
select * from t1 order by col1;
drop table t1;
#
# Check that invalidating dictionary cache works
#
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
connect (con1,localhost,,,test);
connect (con2,localhost,,,test);
connection con1;
ALTER TABLE t1 ADD COLUMN c int not null;
select * from t1 order by a;
connection con2;
select * from t1 order by a;
alter table t1 drop c;
connection con1;
select * from t1 order by a;
drop table t1;
connection con2;
--error 1146
select * from t1 order by a;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1 order by a;
alter table t1 modify column a int not null auto_increment;
select * from t1 order by a;
INSERT INTO t1 VALUES (0,19),(20,21);
select * from t1 order by a;
drop table t1;
CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY,
b INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (0,1),(17,18);
select * from t1;
alter table t1 add c int not null unique auto_increment;
select * from t1 order by a;
INSERT INTO t1 VALUES (18,19,3),(20,21,0);
select * from t1 order by a;
drop table t1; drop table t1;
#--disable_warnings #--disable_warnings
......
This diff is collapsed.
...@@ -9,7 +9,7 @@ CREATE TABLE t1 ( ...@@ -9,7 +9,7 @@ CREATE TABLE t1 (
ACCESSNODE varchar(16) NOT NULL, ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL, POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL, ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL, CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16), PROVIDER varchar(16),
TEXPIRE int unsigned, TEXPIRE int unsigned,
NUM_IP int unsigned, NUM_IP int unsigned,
......
...@@ -3,7 +3,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \ ...@@ -3,7 +3,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
...@@ -3,7 +3,7 @@ LDADD += \ ...@@ -3,7 +3,7 @@ LDADD += \
$(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
* *
* NdbDictionary::Column * NdbDictionary::Column
* setName() * setName()
* setPrimaryKey()
* setType() * setType()
* setLength() * setLength()
* setPrimaryKey()
* setNullable() * setNullable()
* *
* NdbDictionary::Table * NdbDictionary::Table
...@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb) ...@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb)
* Column REG_NO * Column REG_NO
*/ */
myColumn.setName("REG_NO"); myColumn.setName("REG_NO");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb) ...@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb)
* Column BRAND * Column BRAND
*/ */
myColumn.setName("BRAND"); myColumn.setName("BRAND");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb) ...@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb)
* Column COLOR * Column COLOR
*/ */
myColumn.setName("COLOR"); myColumn.setName("COLOR");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -454,6 +454,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData) ...@@ -454,6 +454,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database
/******************************************* /*******************************************
...@@ -493,5 +494,3 @@ int main() ...@@ -493,5 +494,3 @@ int main()
std::cout << "Number of temporary errors: " << tempErrors << std::endl; std::cout << "Number of temporary errors: " << tempErrors << std::endl;
delete myNdb; delete myNdb;
} }
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable; NdbDictionary::Table myTable;
NdbDictionary::Column myColumn; NdbDictionary::Column myColumn;
...@@ -78,16 +79,16 @@ int main() ...@@ -78,16 +79,16 @@ int main()
myTable.setName("MYTABLENAME"); myTable.setName("MYTABLENAME");
myColumn.setName("ATTR1"); myColumn.setName("ATTR1");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
myColumn.setName("ATTR2"); myColumn.setName("ATTR2");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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