mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 4.1 -> 5.0
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged configure.in: Auto merged include/my_global.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/subselect.test: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_berkeley.cc: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/records.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged tests/client_test.c: Auto merged
This commit is contained in:
4
mysql-test/include/have_ndb.inc
Normal file
4
mysql-test/include/have_ndb.inc
Normal file
@ -0,0 +1,4 @@
|
||||
-- require r/have_ndb.require
|
||||
disable_query_log;
|
||||
show variables like "have_ndbcluster";
|
||||
enable_query_log;
|
@ -77,7 +77,8 @@ EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/ch
|
||||
fi
|
||||
|
||||
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
|
||||
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $EXTRA_ARG"
|
||||
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndbcluster --skip-bdb \
|
||||
$EXTRA_ARG"
|
||||
echo "running $mysqld_boot"
|
||||
|
||||
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
|
||||
|
@ -212,6 +212,8 @@ EXTRA_MYSQL_TEST_OPT=""
|
||||
EXTRA_MYSQLDUMP_OPT=""
|
||||
EXTRA_MYSQLBINLOG_OPT=""
|
||||
USE_RUNNING_SERVER=""
|
||||
USE_NDBCLUSTER=""
|
||||
USE_RUNNING_NDBCLUSTER=""
|
||||
DO_GCOV=""
|
||||
DO_GDB=""
|
||||
MANUAL_GDB=""
|
||||
@ -241,6 +243,11 @@ while test $# -gt 0; do
|
||||
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
|
||||
--local) USE_RUNNING_SERVER="" ;;
|
||||
--extern) USE_RUNNING_SERVER="1" ;;
|
||||
--with-ndbcluster)
|
||||
USE_NDBCLUSTER="--ndbcluster" ;;
|
||||
--ndbconnectstring=*)
|
||||
USE_NDBCLUSTER="--ndbcluster" ;
|
||||
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;;
|
||||
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
|
||||
--local-master)
|
||||
MASTER_MYPORT=3306;
|
||||
@ -274,6 +281,7 @@ while test $# -gt 0; do
|
||||
--skip-rpl) NO_SLAVE=1 ;;
|
||||
--skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
|
||||
--do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
|
||||
--start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;;
|
||||
--warnings | --log-warnings)
|
||||
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings"
|
||||
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings"
|
||||
@ -670,7 +678,7 @@ report_stats () {
|
||||
$ECHO "The log files in $MY_LOG_DIR may give you some hint"
|
||||
$ECHO "of what when wrong."
|
||||
$ECHO "If you want to report this error, please read first the documentation at"
|
||||
$ECHO "http://www.mysql.com/doc/M/y/MySQL_test_suite.html"
|
||||
$ECHO "http://www.mysql.com/doc/en/MySQL_test_suite.html"
|
||||
fi
|
||||
|
||||
if test -z "$USE_RUNNING_SERVER"
|
||||
@ -894,6 +902,7 @@ start_master()
|
||||
--local-infile \
|
||||
--exit-info=256 \
|
||||
--core \
|
||||
$USE_NDBCLUSTER \
|
||||
--datadir=$MASTER_MYDDIR \
|
||||
--pid-file=$MASTER_MYPID \
|
||||
--socket=$MASTER_MYSOCK \
|
||||
@ -919,6 +928,7 @@ start_master()
|
||||
--character-sets-dir=$CHARSETSDIR \
|
||||
--default-character-set=$CHARACTER_SET \
|
||||
--core \
|
||||
$USE_NDBCLUSTER \
|
||||
--tmpdir=$MYSQL_TMP_DIR \
|
||||
--language=$LANGUAGE \
|
||||
--innodb_data_file_path=ibdata1:50M \
|
||||
@ -1031,7 +1041,7 @@ start_slave()
|
||||
--core --init-rpl-role=slave \
|
||||
--tmpdir=$MYSQL_TMP_DIR \
|
||||
--language=$LANGUAGE \
|
||||
--skip-innodb --skip-slave-start \
|
||||
--skip-innodb --skip-ndbcluster --skip-slave-start \
|
||||
--slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
|
||||
--report-host=127.0.0.1 --report-user=root \
|
||||
--report-port=$slave_port \
|
||||
@ -1198,31 +1208,31 @@ run_testcase ()
|
||||
echo $tname > $CURRENT_TEST
|
||||
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`
|
||||
if [ "$USE_MANAGER" = 1 ] ; then
|
||||
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
|
||||
many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
|
||||
fi
|
||||
if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
|
||||
#skip_test $tname
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$SKIP_TEST" ] ; then
|
||||
SKIP_THIS_TEST=`$EXPR \( $tname : "$SKIP_TEST" \) != 0`
|
||||
if [ x$SKIP_THIS_TEST = x1 ] ;
|
||||
then
|
||||
skip_test $tname;
|
||||
return;
|
||||
if [ "$SKIP_TEST" ] ; then
|
||||
if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then
|
||||
skip_test $tname
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$DO_TEST" ] ; then
|
||||
DO_THIS_TEST=`$EXPR \( $tname : "$DO_TEST" \) != 0`
|
||||
if [ x$DO_THIS_TEST = x0 ] ;
|
||||
then
|
||||
skip_test $tname;
|
||||
return;
|
||||
if [ "$DO_TEST" ] ; then
|
||||
if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then
|
||||
: #empty command to keep some shells happy
|
||||
else
|
||||
#skip_test $tname
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ;
|
||||
then
|
||||
skip_test $tname;
|
||||
if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then
|
||||
skip_test $tname
|
||||
return
|
||||
fi
|
||||
|
||||
@ -1402,7 +1412,17 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$USE_NDBCLUSTER" ]
|
||||
then
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
# Kill any running ndbcluster stuff
|
||||
./ndb/stop_ndbcluster
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove files that can cause problems
|
||||
$RM -rf $MYSQL_TEST_DIR/var/ndbcluster
|
||||
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
|
||||
|
||||
# Remove old berkeley db log files that can confuse the server
|
||||
@ -1412,6 +1432,20 @@ then
|
||||
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
|
||||
$ECHO "Installing Test Databases"
|
||||
mysql_install_db
|
||||
|
||||
if [ ! -z "$USE_NDBCLUSTER" ]
|
||||
then
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
echo "Starting ndbcluster"
|
||||
./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
|
||||
export NDB_CONNECTSTRING=`cat Ndb.cfg`
|
||||
else
|
||||
export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
|
||||
echo "Using ndbcluster at $NDB_CONNECTSTRING"
|
||||
fi
|
||||
fi
|
||||
|
||||
start_manager
|
||||
|
||||
# Do not automagically start daemons if we are in gdb or running only one test
|
||||
@ -1492,6 +1526,15 @@ then
|
||||
mysql_stop
|
||||
fi
|
||||
|
||||
if [ ! -z "$USE_NDBCLUSTER" ]
|
||||
then
|
||||
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
|
||||
then
|
||||
# Kill any running ndbcluster stuff
|
||||
./ndb/stop_ndbcluster
|
||||
fi
|
||||
fi
|
||||
|
||||
stop_manager
|
||||
report_stats
|
||||
$ECHO
|
||||
|
148
mysql-test/ndb/install_ndbcluster
Executable file
148
mysql-test/ndb/install_ndbcluster
Executable file
@ -0,0 +1,148 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2004 MySQL AB
|
||||
# For a more info consult the file COPYRIGHT distributed with this file
|
||||
|
||||
# This scripts starts the table handler ndbcluster
|
||||
|
||||
# configurable parameters, make sure to change in mysqlcluterd as well
|
||||
port_base="22" # using ports port_base{"00","01", etc}
|
||||
fsdir=`pwd`
|
||||
# end configurable parameters
|
||||
|
||||
libdir=`pwd`/../ndb/lib
|
||||
bindir=`pwd`/../ndb/bin
|
||||
|
||||
pidfile=ndbcluster.pid
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--initial)
|
||||
flags_ndb=$flags_ndb" -i"
|
||||
initial_ndb=1
|
||||
;;
|
||||
--data-dir=*)
|
||||
fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
|
||||
;;
|
||||
--port-base=*)
|
||||
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
|
||||
;;
|
||||
-- ) shift; break ;;
|
||||
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
|
||||
* ) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exec_ndb=$bindir/ndb
|
||||
exec_mgmtsrvr=$bindir/mgmtsrvr
|
||||
fs_ndb=$fsdir/ndbcluster
|
||||
fs_mgm_1=$fs_ndb/1.ndb_mgm
|
||||
fs_ndb_2=$fs_ndb/2.ndb_db
|
||||
fs_ndb_3=$fs_ndb/3.ndb_db
|
||||
fs_name_2=$fs_ndb/node-2-fs
|
||||
fs_name_3=$fs_ndb/node-3-fs
|
||||
|
||||
NDB_HOME=
|
||||
export NDB_CONNECTSTRING
|
||||
if [ ! -x $fsdir ]; then
|
||||
echo "$fsdir missing"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x $exec_ndb ]; then
|
||||
echo "$exec_ndb missing"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -x $exec_mgmtsrv ]; then
|
||||
echo "$exec_mgmtsrvr missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
start_default_ndbcluster() {
|
||||
|
||||
# do some checks
|
||||
|
||||
NDB_CONNECTSTRING=
|
||||
|
||||
if [ $initial_ndb ] ; then
|
||||
[ -d $fs_ndb ] || mkdir $fs_ndb
|
||||
[ -d $fs_mgm_1 ] || mkdir $fs_mgm_1
|
||||
[ -d $fs_ndb_2 ] || mkdir $fs_ndb_2
|
||||
[ -d $fs_ndb_3 ] || mkdir $fs_ndb_3
|
||||
[ -d $fs_name_2 ] || mkdir $fs_name_2
|
||||
[ -d $fs_name_3 ] || mkdir $fs_name_3
|
||||
fi
|
||||
if [ -d "$fs_ndb" -a -d "$fs_mgm_1" -a -d "$fs_ndb_2" -a -d "$fs_ndb_3" -a -d "$fs_name_2" -a -d "$fs_name_3" ]; then :; else
|
||||
echo "$fs_ndb filesystem directory does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set som help variables
|
||||
|
||||
ndb_host="localhost"
|
||||
ndb_port=$port_base"00"
|
||||
NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_port;nodeid="
|
||||
|
||||
|
||||
# Start management server as deamon
|
||||
|
||||
NDB_ID="1"
|
||||
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
|
||||
|
||||
# Edit file system path and ports in config file
|
||||
|
||||
if [ $initial_ndb ] ; then
|
||||
sed \
|
||||
-e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
|
||||
-e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \
|
||||
-e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \
|
||||
-e s,"CHOOSE_PORT_BASE",$port_base,g \
|
||||
< ndb/ndb_config_2_node.ini \
|
||||
> "$fs_mgm_1/config.ini"
|
||||
fi
|
||||
|
||||
if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
|
||||
echo "Unable to start $exec_mgmtsrvr from `pwd`"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
|
||||
|
||||
# Start database node
|
||||
|
||||
NDB_ID="2"
|
||||
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
|
||||
( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
|
||||
|
||||
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
|
||||
|
||||
# Start database node
|
||||
|
||||
NDB_ID="3"
|
||||
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
|
||||
( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
|
||||
|
||||
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
|
||||
|
||||
# Start management client
|
||||
|
||||
sleep 5
|
||||
echo "show" | $bindir/mgmtclient $ndb_host $ndb_port
|
||||
|
||||
# test if Ndb Cluster starts properly
|
||||
|
||||
NDB_ID="11"
|
||||
NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
|
||||
#if ( export LD_LIBRARY_PATH=$libdir ; $bindir/list_tables ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
|
||||
if ( export LD_LIBRARY_PATH=$libdir ; $bindir/waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
|
||||
echo "Ndbcluster startup failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $NDB_CONNECTSTRING > Ndb.cfg
|
||||
|
||||
cat `find $fs_ndb -name 'node*.pid'` > $pidfile
|
||||
}
|
||||
|
||||
start_default_ndbcluster
|
||||
|
||||
exit 0
|
133
mysql-test/ndb/ndb_config_2_node.ini
Normal file
133
mysql-test/ndb/ndb_config_2_node.ini
Normal file
@ -0,0 +1,133 @@
|
||||
[DB DEFAULT]
|
||||
#NoOfFragmentLogfiles: 1
|
||||
#TimeBetweenLocalCheckpoints: 31
|
||||
NoOfReplicas: 2
|
||||
|
||||
[COMPUTER]
|
||||
Id: 1
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_1
|
||||
|
||||
[COMPUTER]
|
||||
Id: 2
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_2
|
||||
|
||||
[COMPUTER]
|
||||
Id: 3
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_3
|
||||
|
||||
[COMPUTER]
|
||||
Id: 4
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_4
|
||||
|
||||
[COMPUTER]
|
||||
Id: 5
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_5
|
||||
|
||||
[COMPUTER]
|
||||
Id: 6
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_6
|
||||
|
||||
[COMPUTER]
|
||||
Id: 7
|
||||
ByteOrder: Little
|
||||
HostName: CHOOSE_HOSTNAME_7
|
||||
|
||||
[MGM]
|
||||
Id: 1
|
||||
ExecuteOnComputer: 1
|
||||
PortNumber: CHOOSE_PORT_BASE00
|
||||
PortNumberStats: CHOOSE_PORT_BASE01
|
||||
|
||||
|
||||
[DB]
|
||||
Id: 2
|
||||
ExecuteOnComputer: 2
|
||||
FileSystemPath: CHOOSE_FILESYSTEM_NODE_2
|
||||
|
||||
[DB]
|
||||
Id: 3
|
||||
ExecuteOnComputer: 3
|
||||
FileSystemPath: CHOOSE_FILESYSTEM_NODE_3
|
||||
|
||||
[API]
|
||||
Id: 11
|
||||
ExecuteOnComputer: 4
|
||||
|
||||
[API]
|
||||
Id: 12
|
||||
ExecuteOnComputer: 5
|
||||
|
||||
[API]
|
||||
Id: 13
|
||||
ExecuteOnComputer: 6
|
||||
|
||||
[API]
|
||||
Id: 14
|
||||
ExecuteOnComputer: 7
|
||||
|
||||
# Mgmtsrvr connections
|
||||
|
||||
[TCP]
|
||||
NodeId1: 1
|
||||
NodeId2: 2
|
||||
PortNumber: CHOOSE_PORT_BASE02
|
||||
|
||||
[TCP]
|
||||
NodeId1: 1
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE03
|
||||
|
||||
# Ndb nodes connections
|
||||
|
||||
[TCP]
|
||||
NodeId1: 2
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE04
|
||||
|
||||
# Api connections
|
||||
|
||||
[TCP]
|
||||
NodeId1: 11
|
||||
NodeId2: 2
|
||||
PortNumber: CHOOSE_PORT_BASE05
|
||||
|
||||
[TCP]
|
||||
NodeId1: 11
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE06
|
||||
|
||||
[TCP]
|
||||
NodeId1: 12
|
||||
NodeId2: 2
|
||||
PortNumber: CHOOSE_PORT_BASE07
|
||||
|
||||
[TCP]
|
||||
NodeId1: 12
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE08
|
||||
|
||||
[TCP]
|
||||
NodeId1: 13
|
||||
NodeId2: 2
|
||||
PortNumber: CHOOSE_PORT_BASE09
|
||||
|
||||
[TCP]
|
||||
NodeId1: 13
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE10
|
||||
|
||||
[TCP]
|
||||
NodeId1: 14
|
||||
NodeId2: 2
|
||||
PortNumber: CHOOSE_PORT_BASE11
|
||||
|
||||
[TCP]
|
||||
NodeId1: 14
|
||||
NodeId2: 3
|
||||
PortNumber: CHOOSE_PORT_BASE12
|
52
mysql-test/ndb/stop_ndbcluster
Executable file
52
mysql-test/ndb/stop_ndbcluster
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2004 MySQL AB
|
||||
# For a more info consult the file COPYRIGHT distributed with this file
|
||||
|
||||
# This scripts stops the table handler ndbcluster
|
||||
|
||||
bindir=`pwd`/../ndb/bin
|
||||
pidfile=ndbcluster.pid
|
||||
cfgfile=Ndb.cfg
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
--port-base=*)
|
||||
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
|
||||
;;
|
||||
-- ) shift; break ;;
|
||||
--* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
|
||||
* ) break ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
stop_default_ndbcluster() {
|
||||
|
||||
if [ ! -f $pidfile ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f $cfgfile ] ; then
|
||||
echo "$cfgfile missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
|
||||
ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
|
||||
|
||||
# Start management client
|
||||
|
||||
exec_mgmtclient="$bindir/mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
|
||||
|
||||
echo "$exec_mgmtclient"
|
||||
echo "all stop" | $exec_mgmtclient
|
||||
|
||||
sleep 5
|
||||
|
||||
kill `cat $pidfile`
|
||||
rm $pidfile
|
||||
}
|
||||
|
||||
stop_default_ndbcluster
|
||||
|
||||
exit 0
|
@ -63,7 +63,7 @@ CREATE TABLE t1 (
|
||||
AUFNR varchar(12) NOT NULL default '',
|
||||
PLNFL varchar(6) NOT NULL default '',
|
||||
VORNR varchar(4) NOT NULL default '',
|
||||
xstatus_vor smallint(5) unsigned NOT NULL default '0',
|
||||
xstatus_vor smallint(5) unsigned NOT NULL default '0'
|
||||
);
|
||||
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
|
||||
INSERT INTO t1 VALUES ('40004712','000001','0020',0);
|
||||
|
@ -31,3 +31,68 @@ EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
create table t1 (a int not null);
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` char(255) NOT NULL default '',
|
||||
`Min_value` char(255) default NULL,
|
||||
`Max_value` char(255) default NULL,
|
||||
`Min_length` bigint(11) NOT NULL default '0',
|
||||
`Max_length` bigint(11) NOT NULL default '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL default '0',
|
||||
`Nulls` bigint(11) NOT NULL default '0',
|
||||
`Avg_value_or_avg_length` char(255) NOT NULL default '',
|
||||
`Std` char(255) default NULL,
|
||||
`Optimal_fieldtype` char(64) NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1 where 0=1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t1 values(1);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` char(255) NOT NULL default '',
|
||||
`Min_value` char(255) default NULL,
|
||||
`Max_value` char(255) default NULL,
|
||||
`Min_length` bigint(11) NOT NULL default '0',
|
||||
`Max_length` bigint(11) NOT NULL default '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL default '0',
|
||||
`Nulls` bigint(11) NOT NULL default '0',
|
||||
`Avg_value_or_avg_length` char(255) NOT NULL default '',
|
||||
`Std` char(255) default NULL,
|
||||
`Optimal_fieldtype` char(64) NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
|
||||
insert into t1 values(2);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` char(255) NOT NULL default '',
|
||||
`Min_value` char(255) default NULL,
|
||||
`Max_value` char(255) default NULL,
|
||||
`Min_length` bigint(11) NOT NULL default '0',
|
||||
`Max_length` bigint(11) NOT NULL default '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL default '0',
|
||||
`Nulls` bigint(11) NOT NULL default '0',
|
||||
`Avg_value_or_avg_length` char(255) NOT NULL default '',
|
||||
`Std` char(255) default NULL,
|
||||
`Optimal_fieldtype` char(64) NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
|
||||
drop table t1,t2;
|
||||
|
@ -203,7 +203,7 @@ a
|
||||
2
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check error The storage engine for the table doesn't support check
|
||||
test.t1 check note The storage engine for the table doesn't support check
|
||||
drop table t1;
|
||||
create table t1 (a int,b varchar(20)) engine=bdb;
|
||||
insert into t1 values (1,""), (2,"testing");
|
||||
|
@ -274,6 +274,12 @@ create database `db1 `;
|
||||
ERROR 42000: Incorrect database name 'db1 '
|
||||
create table t1(`a ` int);
|
||||
ERROR 42000: Incorrect column name 'a '
|
||||
create table t1 (a int,);
|
||||
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 ')' at line 1
|
||||
create table t1 (a int,,b int);
|
||||
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 'b int)' at line 1
|
||||
create table t1 (,b int);
|
||||
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 'b int)' at line 1
|
||||
create table t1 (a int, key(a));
|
||||
create table t2 (b int, foreign key(b) references t1(a), key(b));
|
||||
drop table if exists t1,t2;
|
||||
|
@ -92,3 +92,22 @@ select @ujis3 = CONVERT(@utf83 USING ujis);
|
||||
select @ujis4 = CONVERT(@utf84 USING ujis);
|
||||
@ujis4 = CONVERT(@utf84 USING ujis)
|
||||
1
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1 (c1 varchar(8)) default character set 'ujis';
|
||||
insert into t1 values (0xA4A2),(0xA2A2),(0xA4A2);
|
||||
select c1 as 'no index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
|
||||
no index
|
||||
<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>
|
||||
create index idx_c1 on t1(c1);
|
||||
select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
|
||||
using index
|
||||
<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>
|
||||
select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
|
||||
no index
|
||||
<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>
|
||||
drop table t1;
|
||||
|
@ -251,7 +251,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`N` int(11) unsigned NOT NULL default '0',
|
||||
`M` tinyint(1) default '0',
|
||||
`M` tinyint(1) default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
|
@ -221,6 +221,68 @@ select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
|
||||
max(t1.a2) max(t2.a1)
|
||||
zzz BBB
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
|
||||
drop table t1;
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551612 18446744073709551615
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551613 18446744073709551613
|
||||
18446744073709551614 18446744073709551614
|
||||
18446744073709551615 18446744073709551615
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
select avg(2) from t1;
|
||||
avg(2)
|
||||
NULL
|
||||
drop table t1;
|
||||
create table t1(
|
||||
a1 char(3) primary key,
|
||||
a2 smallint,
|
||||
@ -562,52 +624,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
|
||||
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
|
||||
drop table t1;
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
@ -632,14 +648,11 @@ select a from t1 having a=1;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551612 18446744073709551615
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551613 18446744073709551613
|
||||
18446744073709551614 18446744073709551614
|
||||
18446744073709551615 18446744073709551615
|
||||
create table t1 (a int);
|
||||
select variance(2) from t1;
|
||||
variance(2)
|
||||
NULL
|
||||
select stddev(2) from t1;
|
||||
stddev(2)
|
||||
NULL
|
||||
drop table t1;
|
||||
|
@ -84,9 +84,9 @@ bbbb bb bbbbbbbb aaaa bbbb
|
||||
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
|
||||
replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL')
|
||||
this is a REAL test
|
||||
select soundex(''),soundex('he'),soundex('hello all folks');
|
||||
soundex('') soundex('he') soundex('hello all folks')
|
||||
H000 H4142
|
||||
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||
soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb')
|
||||
H000 H4142 I51231
|
||||
select 'mood' sounds like 'mud';
|
||||
'mood' sounds like 'mud'
|
||||
1
|
||||
@ -281,7 +281,7 @@ CREATE TABLE t1 (
|
||||
wid int(10) unsigned NOT NULL auto_increment,
|
||||
data_podp date default NULL,
|
||||
status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy',
|
||||
PRIMARY KEY(wid),
|
||||
PRIMARY KEY(wid)
|
||||
);
|
||||
INSERT INTO t1 VALUES (8,NULL,'real');
|
||||
INSERT INTO t1 VALUES (9,NULL,'nowy');
|
||||
@ -639,3 +639,21 @@ name
|
||||
aaaaaaaaaaccccc
|
||||
bbbbbbbbbbddddd
|
||||
drop table t1, t2;
|
||||
create table t1 (c1 INT, c2 INT UNSIGNED);
|
||||
insert into t1 values ('21474836461','21474836461');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
Warning 1265 Data truncated for column 'c2' at row 1
|
||||
insert into t1 values ('-21474836461','-21474836461');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
Warning 1265 Data truncated for column 'c2' at row 1
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
Warning 1265 Data truncated for column 'c2' at row 1
|
||||
select * from t1;
|
||||
c1 c2
|
||||
2147483647 4294967295
|
||||
-2147483648 0
|
||||
drop table t1;
|
||||
|
@ -352,6 +352,36 @@ extract(SECOND FROM "1999-01-02 10:11:12")
|
||||
select extract(MONTH FROM "2001-02-00");
|
||||
extract(MONTH FROM "2001-02-00")
|
||||
2
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND
|
||||
1968-01-20 03:14:08
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND
|
||||
1968-01-20 03:15:07
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND
|
||||
8895-03-27 22:11:40
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND
|
||||
6255-04-08 15:04:32
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE
|
||||
5983-01-24 02:08:00
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR
|
||||
2019-08-15 16:00:00
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND
|
||||
NULL
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE
|
||||
NULL
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
|
||||
"1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR
|
||||
NULL
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
|
||||
"1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND
|
||||
NULL
|
||||
create table t1 (ctime varchar(20));
|
||||
insert into t1 values ('2001-01-12 12:23:40');
|
||||
select ctime, hour(ctime) from t1;
|
||||
|
@ -750,3 +750,10 @@ analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
g GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(g)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
|
||||
drop table t1;
|
||||
|
@ -76,6 +76,8 @@ delete from mysql.db where user='mysqltest_1';
|
||||
delete from mysql.tables_priv where user='mysqltest_1';
|
||||
delete from mysql.columns_priv where user='mysqltest_1';
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
|
||||
create table t1 (a int);
|
||||
GRANT select,update,insert on t1 to mysqltest_1@localhost;
|
||||
GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
|
||||
|
2
mysql-test/r/have_ndb.require
Normal file
2
mysql-test/r/have_ndb.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
have_ndbcluster YES
|
22
mysql-test/r/innodb-lock.result
Normal file
22
mysql-test/r/innodb-lock.result
Normal file
@ -0,0 +1,22 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
set autocommit=0;
|
||||
lock table t1 write;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
commit;
|
||||
update t1 set x=2 where id = 0;
|
||||
commit;
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
commit;
|
||||
drop table t1;
|
@ -467,7 +467,7 @@ ERROR 23000: Duplicate entry 'test2' for key 2
|
||||
select * from t1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
3 test2 this will work
|
||||
4 test2 this will work
|
||||
select * from t1 where id=1;
|
||||
id ggid email passwd
|
||||
1 this will work
|
||||
|
@ -49,14 +49,14 @@ test.t1 optimize status OK
|
||||
check table t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
test.t2 check error The storage engine for the table doesn't support check
|
||||
test.t2 check note The storage engine for the table doesn't support check
|
||||
repair table t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
test.t2 repair error The storage engine for the table doesn't support repair
|
||||
test.t2 repair note The storage engine for the table doesn't support repair
|
||||
check table t2,t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 check error The storage engine for the table doesn't support check
|
||||
test.t2 check note The storage engine for the table doesn't support check
|
||||
test.t1 check status OK
|
||||
lock tables t1 write;
|
||||
check table t2,t1;
|
||||
|
@ -206,3 +206,32 @@ select i from t1 where b=repeat(_utf8 'b',310);
|
||||
i
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam;
|
||||
insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g');
|
||||
explain select 1 from t1 where id =2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
explain select 1 from t1 where id =2 or id=3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
explain select name from t1 where id =2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id);
|
||||
explain select 1 from t1 where id =2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref id id 4 const 1 Using where; Using index
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
|
||||
INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
|
||||
SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
numeropost
|
||||
1
|
||||
EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const numreponse numreponse 4 const 1 Using index
|
||||
FLUSH TABLES;
|
||||
SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
numeropost
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -85,6 +85,12 @@ select @@key_cache_block_size;
|
||||
set global keycache1.key_buffer_size=1024*1024;
|
||||
create table t1 (p int primary key, a char(10)) delay_key_write=1;
|
||||
create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
|
||||
show status like 'key_blocks_used';
|
||||
Variable_name Value
|
||||
Key_blocks_used 0
|
||||
show status like 'key_blocks_unused';
|
||||
Variable_name Value
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
@ -100,6 +106,12 @@ p i a
|
||||
4 3 zzzz
|
||||
update t1 set p=2 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
show status like 'key_blocks_used';
|
||||
Variable_name Value
|
||||
Key_blocks_used 4
|
||||
show status like 'key_blocks_unused';
|
||||
Variable_name Value
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
cache index t1 key (`primary`) in keycache1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache status OK
|
||||
@ -256,6 +268,12 @@ Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache status OK
|
||||
test.t2 assign_to_keycache status OK
|
||||
drop table t1,t2,t3;
|
||||
show status like 'key_blocks_used';
|
||||
Variable_name Value
|
||||
Key_blocks_used 4
|
||||
show status like 'key_blocks_unused';
|
||||
Variable_name Value
|
||||
Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
set global keycache2.key_buffer_size=0;
|
||||
set global keycache3.key_buffer_size=100;
|
||||
set global keycache3.key_buffer_size=0;
|
||||
|
@ -13,7 +13,7 @@ t1
|
||||
AB%
|
||||
describe select * from t1 where t1="ABC";
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1 Using index
|
||||
describe select * from t1 where t1="ABCD";
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
|
@ -68,7 +68,7 @@ SHOW CREATE TABLE T1;
|
||||
Table Create Table
|
||||
T1 CREATE TABLE `T1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
RENAME TABLE T1 TO T2;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
|
@ -1,4 +1,5 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
drop database if exists mysqltest;
|
||||
create table t1(id1 int not null auto_increment primary key, t char(12));
|
||||
create table t2(id2 int not null, t char(12));
|
||||
create table t3(id3 int not null, t char(12), index(id3));
|
||||
@ -323,6 +324,7 @@ a b
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
update t1,t2 set t1.b=t2.b, t1.a=t2.a where t1.a=t2.a and not exists (select * from t2 where t2.a > 10);
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL);
|
||||
@ -402,7 +404,7 @@ DELETE t1 FROM t1, t2 AS t3;
|
||||
DELETE t4 FROM t1, t1 AS t4;
|
||||
DELETE t3 FROM t1 AS t3, t1 AS t4;
|
||||
DELETE t1 FROM t1 AS t3, t2 AS t4;
|
||||
ERROR 42000: Not unique table/alias: 't1'
|
||||
ERROR 42S02: Unknown table 't1' in MULTI DELETE
|
||||
INSERT INTO t1 values (1),(2);
|
||||
INSERT INTO t2 values (1),(2);
|
||||
DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1;
|
||||
@ -435,6 +437,23 @@ select * from t2;
|
||||
c2_id c2_p_id c2_note c2_active
|
||||
1 1 A Note 1
|
||||
drop table t1, t2;
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 (a int, b int, primary key (a));
|
||||
create table mysqltest.t2 (a int, b int, primary key (a));
|
||||
create table mysqltest.t3 (a int, b int, primary key (a));
|
||||
grant select on mysqltest.* to mysqltest_1@localhost;
|
||||
grant update on mysqltest.t1 to mysqltest_1@localhost;
|
||||
update t1, t2 set t1.b=1 where t1.a=t2.a;
|
||||
update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
|
||||
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
drop database mysqltest;
|
||||
create table t1 (a int, primary key (a));
|
||||
create table t2 (a int, primary key (a));
|
||||
create table t3 (a int, primary key (a));
|
||||
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
|
||||
ERROR 42S02: Unknown table 't3' in MULTI DELETE
|
||||
drop table t1, t2, t3;
|
||||
set @ttype_save=@@storage_engine;
|
||||
set @@storage_engine=innodb;
|
||||
create table t1 ( c char(8) not null );
|
||||
|
@ -504,3 +504,28 @@ test.t1 968604391
|
||||
test.t2 968604391
|
||||
test.t3 NULL
|
||||
drop table t1,t2;
|
||||
create table t1 (a int, key (a));
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A NULL NULL NULL YES BTREE
|
||||
alter table t1 disable keys;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
|
||||
create table t2 (a int);
|
||||
insert t1 select * from t2;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
|
||||
alter table t1 enable keys;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 1000 NULL NULL YES BTREE
|
||||
alter table t1 engine=heap;
|
||||
alter table t1 disable keys;
|
||||
Warnings:
|
||||
Note 1031 Table storage engine for 't1' doesn't have this option
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a NULL NULL NULL NULL YES HASH
|
||||
drop table t1,t2;
|
||||
|
@ -21,31 +21,38 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (a decimal(240, 20));
|
||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` decimal(240,20) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a double);
|
||||
INSERT INTO t1 VALUES (-9e999999);
|
||||
CREATE TABLE `t1` (
|
||||
`a` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` VALUES (RES);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
ERROR 42S22: Unknown column '1.2345' in 'field list'
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
CREATE TABLE `t1` (
|
||||
`a` decimal(10,5) default NULL,
|
||||
`b` float default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
|
||||
CREATE TABLE `t1` (
|
||||
`a` decimal(10,5) default NULL,
|
||||
`b` float default NULL
|
||||
);
|
||||
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
@ -53,13 +60,14 @@ INSERT INTO t1 VALUES (-9e999999);
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` double default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
`a` decimal(10,5) default NULL,
|
||||
`b` float default NULL
|
||||
);
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (RES);
|
||||
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
@ -68,6 +76,20 @@ UNLOCK TABLES;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
CREATE TABLE `t1` (
|
||||
`a` decimal(10,5) default NULL,
|
||||
`b` float default NULL
|
||||
);
|
||||
|
||||
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||
@ -180,27 +202,9 @@ UNLOCK TABLES;
|
||||
|
||||
DROP TABLE t1;
|
||||
create table ```a` (i int);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
|
||||
DROP TABLE IF EXISTS ```a`;
|
||||
CREATE TABLE ```a` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE ```a` DISABLE KEYS */;
|
||||
LOCK TABLES ```a` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE ```a` ENABLE KEYS */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
drop table ```a`;
|
||||
create table t1(a int);
|
||||
|
||||
|
82
mysql-test/r/ndb_basic.result
Normal file
82
mysql-test/r/ndb_basic.result
Normal file
@ -0,0 +1,82 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
SELECT pk1 FROM t1;
|
||||
pk1
|
||||
9410
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9410 9412
|
||||
SELECT t1.* FROM t1;
|
||||
pk1 attr1
|
||||
9410 9412
|
||||
UPDATE t1 SET attr1=1 WHERE pk1=9410;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9410 1
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=1;
|
||||
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9410 1
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
|
||||
DELETE FROM t1 WHERE attr1=4;
|
||||
SELECT * FROM t1 order by pk1;
|
||||
pk1 attr1
|
||||
3 5
|
||||
5 5
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9411 9413
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
|
||||
INSERT INTO t1 values(3456, 7890);
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
3456 7890
|
||||
UPDATE t1 SET id=2 WHERE id2=12;
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
3456 7890
|
||||
UPDATE t1 SET id=1234 WHERE id2=7890;
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
1234 7890
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
|
||||
SELECT * FROM t1;
|
||||
id id2
|
||||
3456 7890
|
||||
3456 7890
|
||||
3456 7890
|
||||
DELETE FROM t1 WHERE id = 3456;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDBCLUSTER;
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDB;
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
DROP TABLE t1;
|
43
mysql-test/r/ndb_cache.result
Normal file
43
mysql-test/r/ndb_cache.result
Normal file
@ -0,0 +1,43 @@
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
reset query cache;
|
||||
flush status;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE t1 (a int) ENGINE=ndbcluster;
|
||||
CREATE TABLE t2 (a int);
|
||||
select * from t1;
|
||||
a
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 0
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t2;
|
||||
a
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from t1;
|
||||
a
|
||||
select * from t2;
|
||||
a
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
drop table t1, t2;
|
||||
SET GLOBAL query_cache_size=0;
|
@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
|
||||
explain select * from t1 where a=2 and b = 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const a,b a 9 const,const 1
|
||||
1 SIMPLE t1 const a,b a 9 const,const 1 Using index
|
||||
explain select * from t1 where a<=>b limit 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index
|
||||
|
@ -4,6 +4,14 @@ create database test_$1;
|
||||
create table test_$1.r1 (i int) raid_type=1;
|
||||
create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
|
||||
drop database test_$1;
|
||||
create database test_$1;
|
||||
create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
|
||||
show create table test_$1.r2;
|
||||
Table Create Table
|
||||
r2 CREATE TABLE `r2` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 RAID_TYPE=striped RAID_CHUNKS=255 RAID_CHUNKSIZE=256
|
||||
drop database test_$1;
|
||||
CREATE TABLE t1 (
|
||||
id int unsigned not null auto_increment primary key,
|
||||
c char(255) not null
|
||||
|
@ -7,7 +7,7 @@ test.t1 repair status OK
|
||||
alter table t1 ENGINE=HEAP;
|
||||
repair table t1 use_frm;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error The storage engine for the table doesn't support repair
|
||||
test.t1 repair note The storage engine for the table doesn't support repair
|
||||
drop table t1;
|
||||
create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
|
||||
insert into t1 values(1, "One");
|
||||
@ -28,3 +28,12 @@ repair table t1 use_frm;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error Table 'test.t1' doesn't exist
|
||||
create table t1 engine=myisam SELECT 1,"table 1";
|
||||
flush tables;
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error Can't open file: 't1.MYI' (errno: 130)
|
||||
repair table t1 use_frm;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair warning Number of rows changed from 0 to 1
|
||||
test.t1 repair status OK
|
||||
drop table t1;
|
@ -1,8 +0,0 @@
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair error Can't open file: 't1.MYI' (errno: 130)
|
||||
repair table t1 use_frm;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair warning Number of rows changed from 0 to 1
|
||||
test.t1 repair status OK
|
||||
drop table t1;
|
21
mysql-test/r/rpl_multi_delete2.result
Normal file
21
mysql-test/r/rpl_multi_delete2.result
Normal file
@ -0,0 +1,21 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
delete t1.* from t1, t2 where t1.a = t2.a;
|
||||
select * from t1;
|
||||
a
|
||||
select * from t2;
|
||||
a
|
||||
1
|
||||
select * from t1;
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1,t2;
|
@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
b int unsigned
|
||||
) ENGINE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
|
22
mysql-test/r/rpl_server_id1.result
Normal file
22
mysql-test/r/rpl_server_id1.result
Normal file
@ -0,0 +1,22 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
stop slave;
|
||||
change master to master_port=SLAVE_PORT;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
show status like "slave_running";
|
||||
Variable_name Value
|
||||
Slave_running ON
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
drop table t1;
|
24
mysql-test/r/rpl_server_id2.result
Normal file
24
mysql-test/r/rpl_server_id2.result
Normal file
@ -0,0 +1,24 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
stop slave;
|
||||
change master to master_port=SLAVE_PORT;
|
||||
show slave status;
|
||||
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
|
||||
127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
1
|
||||
stop slave;
|
||||
drop table t1;
|
@ -43,7 +43,7 @@ wait_timeout 28800
|
||||
show variables like "this_doesn't_exists%";
|
||||
Variable_name Value
|
||||
show table status from test like "this_doesn't_exists%";
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
show databases;
|
||||
Database
|
||||
mysql
|
||||
@ -90,8 +90,8 @@ test_set set( 'val1', 'val2', 'val3' ) not null default '',
|
||||
name char(20) default 'O''Brien' comment 'O''Brien as default',
|
||||
c int not null comment 'int column',
|
||||
`c-b` int comment 'name with a minus',
|
||||
`space 2` int comment 'name with a space',
|
||||
) comment = 'it\'s a table' ;
|
||||
`space 2` int comment 'name with a space'
|
||||
) comment = 'it\'s a table' ;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@ -309,7 +309,7 @@ insert into t1 values (1),(2);
|
||||
insert into t2 values (1),(2);
|
||||
insert into t3 values (1,1),(2,2);
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 2 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -317,7 +317,7 @@ insert into t1 values (3),(4);
|
||||
insert into t2 values (3),(4);
|
||||
insert into t3 values (3,3),(4,4);
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 4 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -325,7 +325,7 @@ insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 5 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -333,7 +333,7 @@ delete from t1 where a=3;
|
||||
delete from t2 where b=3;
|
||||
delete from t3 where a=3;
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 4 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -341,7 +341,7 @@ delete from t1;
|
||||
delete from t2;
|
||||
delete from t3;
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 0 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -349,7 +349,7 @@ insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 1 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
@ -357,7 +357,7 @@ delete from t1 where a=5;
|
||||
delete from t2 where b=5;
|
||||
delete from t3 where a=5;
|
||||
show table status;
|
||||
Name Type 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
|
||||
Name Engine 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
|
||||
t1 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
|
@ -266,7 +266,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2 limit 1))
|
||||
Note 1003 select high_priority test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
|
||||
select * from t3 where a >= all (select b from t2);
|
||||
a
|
||||
7
|
||||
@ -327,7 +327,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select high_priority test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq) limit 1)
|
||||
Note 1003 select high_priority test.t6.patient_uq AS `patient_uq`,test.t6.clinic_uq AS `clinic_uq` from test.t6 where exists(select test.t7.uq AS `uq`,test.t7.name AS `name` from test.t7 where (test.t7.uq = test.t6.clinic_uq))
|
||||
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
|
||||
ERROR 23000: Column: 'a' in field list is ambiguous
|
||||
drop table if exists t1,t2,t3;
|
||||
@ -357,10 +357,10 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
|
||||
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
|
||||
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 35 const 1
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 35 1
|
||||
1 PRIMARY t8 const PRIMARY PRIMARY 35 const 1 Using index
|
||||
4 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
|
||||
2 SUBQUERY t8 const PRIMARY PRIMARY 35 const 1
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 35 1
|
||||
3 SUBQUERY t8 const PRIMARY PRIMARY 35 1 Using index
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t8.pseudo AS `pseudo`,(select test.t8.email AS `email` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from test.t8 where (test.t8.pseudo = (select test.t8.pseudo AS `pseudo` from test.t8 where (test.t8.pseudo = _latin1'joce')))
|
||||
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
|
||||
@ -537,7 +537,7 @@ Warnings:
|
||||
Note 1003 select high_priority max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
|
||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t1.numreponse AS `numreponse` from test.t1 where ((test.t1.numeropost = _latin1'1') and (test.t1.numreponse = 3))
|
||||
@ -736,7 +736,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) limit 1 union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3)) limit 1))
|
||||
Note 1003 select high_priority test.t2.id AS `id` from test.t2 where <in_optimizer>(test.t2.id,<exists>(select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(1)) union select 1 AS `Not_used` having (<cache>(test.t2.id) = <null_helper>(3))))
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
|
||||
id
|
||||
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
|
||||
@ -899,7 +899,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a) limit 1)) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
|
||||
Note 1003 select high_priority test.t1.a AS `a`,<in_optimizer>(test.t1.a,<exists>(select 1 AS `Not_used` from test.t2 join test.t3 where ((test.t3.a = test.t2.a) and ((<cache>(test.t1.a) = test.t2.a) or isnull(test.t2.a))) having <is_not_null_test>(test.t2.a))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from test.t1
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (a float);
|
||||
select 10.5 IN (SELECT * from t1 LIMIT 1);
|
||||
@ -1159,7 +1159,7 @@ CREATE TABLE `t1` (
|
||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`)
|
||||
) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 (pseudo) VALUES ('test');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
@ -1170,7 +1170,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
INSERT INTO t1 (pseudo) VALUES ('test1');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
0 IN (SELECT 1 FROM t1 a)
|
||||
@ -1180,7 +1180,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||
Warnings:
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a limit 1)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
Note 1003 select high_priority <in_optimizer>(0,<exists>(select 1 AS `Not_used` from test.t1 a)) AS `0 IN (SELECT 1 FROM t1 a)`
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL default '0',
|
||||
@ -1264,7 +1264,7 @@ CREATE TABLE `t1` (
|
||||
`email` varchar(60) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email` (`email`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`)
|
||||
) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
|
||||
SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
|
||||
@ -1312,7 +1312,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 func 1 Using where
|
||||
2 DEPENDENT SUBQUERY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int, b int, index a (a,b));
|
||||
create table t2 (a int, index a (a));
|
||||
@ -1351,7 +1351,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 Using where; Using index
|
||||
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a)) limit 1))
|
||||
Note 1003 select high_priority test.t2.a AS `a` from test.t2 where <in_optimizer>(test.t2.a,<exists>(select 1 AS `Not_used` from test.t1 join test.t3 where ((test.t1.b = test.t3.a) and (<cache>(test.t2.a) = test.t1.a))))
|
||||
insert into t1 values (3,31);
|
||||
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
|
||||
a
|
||||
@ -1491,7 +1491,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
|
||||
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
|
||||
Warnings:
|
||||
Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2 limit 1)))
|
||||
Note 1003 select high_priority test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
|
||||
insert into t2 values (2,2), (2,1), (3,3), (3,1);
|
||||
select * from t3 where a > all (select max(b) from t2 group by a);
|
||||
a
|
||||
@ -1674,7 +1674,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 7 Using where; Using index
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'tt.id' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select high_priority test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null) limit 1))
|
||||
Note 1003 select high_priority test.tt.id AS `id`,test.tt.text AS `text` from test.t1 tt where not(exists(select test.t1.id AS `id` from test.t1 where ((test.t1.id < 8) and ((test.t1.id = test.tt.id) or isnull(test.t1.id))) having (test.t1.id is not null)))
|
||||
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
|
||||
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
|
||||
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
|
||||
@ -1715,3 +1715,15 @@ create table t3(flag int);
|
||||
select (select * from t3 where id not null) from t1, t2;
|
||||
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 'null) from t1, t2' at line 1
|
||||
drop table t1,t2,t3;
|
||||
CREATE TABLE t1 (id INT);
|
||||
CREATE TABLE t2 (id INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
id c
|
||||
1 1
|
||||
2 0
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
|
||||
id c
|
||||
1 1
|
||||
2 0
|
||||
|
@ -924,3 +924,29 @@ a
|
||||
1
|
||||
2
|
||||
2
|
||||
set sql_select_limit=1;
|
||||
select 1 union select 2;
|
||||
1
|
||||
1
|
||||
(select 1) union (select 2);
|
||||
1
|
||||
1
|
||||
(select 1) union (select 2) union (select 3) limit 2;
|
||||
1
|
||||
1
|
||||
2
|
||||
set sql_select_limit=default;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (100), (1);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (100);
|
||||
select a from t1 union select a from t2 order by a;
|
||||
a
|
||||
1
|
||||
100
|
||||
SET SQL_SELECT_LIMIT=1;
|
||||
select a from t1 union select a from t2 order by a;
|
||||
a
|
||||
1
|
||||
drop table t1, t2;
|
||||
set sql_select_limit=default;
|
||||
|
@ -1 +1 @@
|
||||
select * from mysql.user as t1, mysql.user as t2, mysql.user as t3, mysql.user as t4, mysql.user as t5, mysql.user as t6, mysql.user as t7, mysql.user as t8;
|
||||
select * from mysql.user as t1, mysql.user as t2, mysql.user as t3;
|
||||
|
@ -74,8 +74,7 @@ CREATE TABLE t1 (
|
||||
AUFNR varchar(12) NOT NULL default '',
|
||||
PLNFL varchar(6) NOT NULL default '',
|
||||
VORNR varchar(4) NOT NULL default '',
|
||||
xstatus_vor smallint(5) unsigned NOT NULL default '0',
|
||||
|
||||
xstatus_vor smallint(5) unsigned NOT NULL default '0'
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
|
||||
|
@ -15,3 +15,26 @@ select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
|
||||
#
|
||||
# Test with impossible where
|
||||
#
|
||||
create table t1 (a int not null);
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t1 where 0=1 procedure analyse();
|
||||
insert into t1 values(1);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t2;
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
insert into t1 values(2);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t2;
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
@ -241,6 +241,18 @@ create database `db1 `;
|
||||
--error 1166;
|
||||
create table t1(`a ` int);
|
||||
|
||||
#
|
||||
# Test for Bug #3481
|
||||
# "Parser permits multiple commas without syntax error"
|
||||
#
|
||||
|
||||
--error 1064
|
||||
create table t1 (a int,);
|
||||
--error 1064
|
||||
create table t1 (a int,,b int);
|
||||
--error 1064
|
||||
create table t1 (,b int);
|
||||
|
||||
#
|
||||
# Test create with foreign keys
|
||||
#
|
||||
|
@ -61,3 +61,15 @@ select @ujis2 = CONVERT(@utf82 USING ujis);
|
||||
select @ujis3 = CONVERT(@utf83 USING ujis);
|
||||
select @ujis4 = CONVERT(@utf84 USING ujis);
|
||||
|
||||
#
|
||||
# Testing with '%' and index (Bug #3438)
|
||||
#
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(8)) default character set 'ujis';
|
||||
insert into t1 values (0xA4A2),(0xA2A2),(0xA4A2);
|
||||
select c1 as 'no index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
|
||||
create index idx_c1 on t1(c1);
|
||||
select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
|
||||
select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
|
||||
drop table t1;
|
||||
|
@ -146,7 +146,7 @@ drop table t1;
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`N` int(11) unsigned NOT NULL default '0',
|
||||
`M` tinyint(1) default '0',
|
||||
`M` tinyint(1) default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
|
@ -134,6 +134,45 @@ select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1=
|
||||
select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test of group function and NULL values
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #1972: test for bit_and(), bit_or() and negative values
|
||||
#
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #3376: avg() and an empty table
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
select avg(2) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Tests to check MIN/MAX query optimization
|
||||
#
|
||||
@ -327,27 +366,6 @@ explain
|
||||
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Test of group function and NULL values
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
drop table t1;
|
||||
--disable_warnings
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
--enable_warnings
|
||||
@ -369,11 +387,12 @@ insert into t1 values (1);
|
||||
select max(a) as b from t1 having b=1;
|
||||
select a from t1 having a=1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #1972: test for bit_and(), bit_or() and negative values
|
||||
#
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
# Bug #3435: variance(const), stddev(const) and an empty table
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
select variance(2) from t1;
|
||||
select stddev(2) from t1;
|
||||
drop table t1;
|
||||
|
@ -39,7 +39,7 @@ SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),r
|
||||
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
|
||||
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
|
||||
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
|
||||
select soundex(''),soundex('he'),soundex('hello all folks');
|
||||
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||
select 'mood' sounds like 'mud';
|
||||
select 'Glazgo' sounds like 'Liverpool';
|
||||
select null sounds like 'null';
|
||||
@ -146,7 +146,7 @@ CREATE TABLE t1 (
|
||||
wid int(10) unsigned NOT NULL auto_increment,
|
||||
data_podp date default NULL,
|
||||
status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy',
|
||||
PRIMARY KEY(wid),
|
||||
PRIMARY KEY(wid)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (8,NULL,'real');
|
||||
@ -358,21 +358,19 @@ select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd
|
||||
explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'mood' sounds like 'mud', aes_decrypt(aes_encrypt('abc','1'),'1'),concat('*',space(5),'*'), reverse('abc'), rpad('a',4,'1'), lpad('a',4,'1'), concat_ws(',','',NULL,'a'),make_set(255,_latin2'a',_latin2'b',_latin2'c'),elt(2,1),locate("a","b",2),format(130,10),char(0),conv(130,16,10),hex(130),binary 'HE', export_set(255,_latin2'y',_latin2'n',_latin2' '),FIELD('b' COLLATE latin1_bin,'A','B'),FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'),collation(conv(130,16,10)), coercibility(conv(130,16,10)),length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),bit_length('\n\t\r\b\0\_\%\\'),concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h'),quote(1/0),crc32("123"),replace('aaaa','a','b'),insert('txs',2,1,'hi'),left(_latin2'a',1),right(_latin2'a',1),lcase(_latin2'a'),ucase(_latin2'a'),SUBSTR('abcdefg',3,2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),trim(_latin2' a '),ltrim(_latin2' a '),rtrim(_latin2' a '), decode(encode(repeat("a",100000),"monty"),"monty");
|
||||
|
||||
#
|
||||
# Bug #2182
|
||||
# lpad returns incorrect result (Bug #2182)
|
||||
#
|
||||
|
||||
SELECT lpad(12345, 5, "#");
|
||||
|
||||
#
|
||||
# Bug #2972
|
||||
# Problem the the CONV() function (Bug #2972)
|
||||
#
|
||||
|
||||
SELECT conv(71, 10, 36), conv('1Z', 36, 10);
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug #3089
|
||||
# Bug in SUBSTRING when mixed with CONCAT and ORDER BY (Bug #3089)
|
||||
#
|
||||
|
||||
create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
|
||||
@ -382,3 +380,14 @@ insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
|
||||
select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
|
||||
where t2.id=t1.id order by name;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Test case for conversion of long string value to integer (Bug #3472)
|
||||
#
|
||||
|
||||
create table t1 (c1 INT, c2 INT UNSIGNED);
|
||||
insert into t1 values ('21474836461','21474836461');
|
||||
insert into t1 values ('-21474836461','-21474836461');
|
||||
show warnings;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -139,10 +139,27 @@ select extract(MINUTE_SECOND FROM "10:11:12");
|
||||
select extract(SECOND FROM "1999-01-02 10:11:12");
|
||||
select extract(MONTH FROM "2001-02-00");
|
||||
|
||||
#
|
||||
# Test big intervals (Bug #3498)
|
||||
#
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
|
||||
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
|
||||
SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
|
||||
|
||||
#
|
||||
# Bug #614 (multiple extracts in where)
|
||||
#
|
||||
|
||||
create table t1 (ctime varchar(20));
|
||||
insert into t1 values ('2001-01-12 12:23:40');
|
||||
select ctime, hour(ctime) from t1;
|
||||
# test bug 614 (multiple extracts in where)
|
||||
select ctime from t1 where extract(MONTH FROM ctime) = 1 AND extract(YEAR FROM ctime) = 2001;
|
||||
drop table t1;
|
||||
|
||||
|
@ -103,3 +103,16 @@ check table t1;
|
||||
analyze table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# The following crashed gis
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
g GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(g)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
|
||||
#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
|
||||
drop table t1;
|
||||
|
@ -53,6 +53,8 @@ delete from mysql.db where user='mysqltest_1';
|
||||
delete from mysql.tables_priv where user='mysqltest_1';
|
||||
delete from mysql.columns_priv where user='mysqltest_1';
|
||||
flush privileges;
|
||||
--error 1141
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
#
|
||||
# Test what happens when you have same table and colum level grants
|
||||
|
@ -1,5 +1,3 @@
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
# category: topic: keyword:
|
||||
#
|
||||
# impossible_category_1
|
||||
@ -65,10 +63,12 @@ help 'impossible_function_1';
|
||||
help 'impossible_category_1';
|
||||
##############
|
||||
|
||||
--disable_warnings
|
||||
alter table mysql.help_relation engine=innodb;
|
||||
alter table mysql.help_keyword engine=innodb;
|
||||
alter table mysql.help_topic engine=innodb;
|
||||
alter table mysql.help_category engine=innodb;
|
||||
--enable_warnings
|
||||
|
||||
##############
|
||||
help 'function_of_my_dream';
|
||||
|
43
mysql-test/t/innodb-lock.test
Normal file
43
mysql-test/t/innodb-lock.test
Normal file
@ -0,0 +1,43 @@
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Testing of explicit table locks
|
||||
#
|
||||
|
||||
connection con1;
|
||||
create table t1 (id integer, x integer) engine=INNODB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
|
||||
connection con2;
|
||||
set autocommit=0;
|
||||
|
||||
# The following statement should hang because con1 is locking the page
|
||||
--send
|
||||
lock table t1 write;
|
||||
--sleep 2;
|
||||
|
||||
connection con1;
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
connection con2;
|
||||
reap;
|
||||
update t1 set x=2 where id = 0;
|
||||
commit;
|
||||
unlock tables;
|
||||
|
||||
connection con1;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
drop table t1;
|
@ -204,3 +204,27 @@ select i from t1 where a=repeat(_utf8 0xD0B1,200);
|
||||
select i from t1 where b=repeat(_utf8 'b',310);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of key read with primary key (Bug #3497)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam;
|
||||
insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g');
|
||||
explain select 1 from t1 where id =2;
|
||||
explain select 1 from t1 where id =2 or id=3;
|
||||
explain select name from t1 where id =2;
|
||||
ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id);
|
||||
explain select 1 from t1 where id =2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of problem with key read (Bug #3666)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
|
||||
INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
|
||||
SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
FLUSH TABLES;
|
||||
SELECT numeropost FROM t1 WHERE numreponse='1';
|
||||
drop table t1;
|
||||
|
@ -66,6 +66,14 @@ set global keycache1.key_buffer_size=1024*1024;
|
||||
create table t1 (p int primary key, a char(10)) delay_key_write=1;
|
||||
create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
|
||||
|
||||
show status like 'key_blocks_used';
|
||||
|
||||
# Following results differs on 64 and 32 bit systems because of different
|
||||
# pointer sizes, which takes up different amount of space in key cache
|
||||
|
||||
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
|
||||
show status like 'key_blocks_unused';
|
||||
|
||||
insert into t1 values (1, 'qqqq'), (11, 'yyyy');
|
||||
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
|
||||
(3, 1, 'yyyy'), (4, 3, 'zzzz');
|
||||
@ -75,6 +83,10 @@ select * from t2;
|
||||
update t1 set p=2 where p=1;
|
||||
update t2 set i=2 where i=1;
|
||||
|
||||
show status like 'key_blocks_used';
|
||||
--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED
|
||||
show status like 'key_blocks_unused';
|
||||
|
||||
cache index t1 key (`primary`) in keycache1;
|
||||
|
||||
explain select p from t1;
|
||||
@ -133,6 +145,10 @@ cache index t3 in keycache2;
|
||||
cache index t1,t2 in default;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
show status like 'key_blocks_used';
|
||||
--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED
|
||||
show status like 'key_blocks_unused';
|
||||
|
||||
# Cleanup
|
||||
# We don't reset keycache2 as we want to ensure that mysqld will reset it
|
||||
set global keycache2.key_buffer_size=0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Test of --lower-case-table-names=2
|
||||
# (User has case insensitive file system and want's to preserve case of
|
||||
# (User has case insensitive file system and wants to preserve case of
|
||||
# table names)
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Test of force of lower-case-table-names=0
|
||||
# (User has case insensitive file system and want's to preserve case of
|
||||
# (User has case insensitive file system and wants to preserve case of
|
||||
# table names)
|
||||
#
|
||||
|
||||
|
@ -26,4 +26,4 @@ select * from MySQL.db;
|
||||
enable_result_log;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
|
||||
set GLOBAL query_cache_size=0;
|
||||
set GLOBAL query_cache_size=0;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3;
|
||||
drop database if exists mysqltest;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(id1 int not null auto_increment primary key, t char(12));
|
||||
@ -259,6 +260,10 @@ update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t2.a=t1
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
# test for non-updating table which is also used in sub-select
|
||||
|
||||
update t1,t2 set t1.b=t2.b, t1.a=t2.a where t1.a=t2.a and not exists (select * from t2 where t2.a > 10);
|
||||
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM;
|
||||
INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL);
|
||||
@ -354,7 +359,7 @@ CREATE TABLE t2 ( a int );
|
||||
DELETE t1 FROM t1, t2 AS t3;
|
||||
DELETE t4 FROM t1, t1 AS t4;
|
||||
DELETE t3 FROM t1 AS t3, t1 AS t4;
|
||||
--error 1066
|
||||
--error 1109
|
||||
DELETE t1 FROM t1 AS t3, t2 AS t4;
|
||||
INSERT INTO t1 values (1),(2);
|
||||
INSERT INTO t2 values (1),(2);
|
||||
@ -369,7 +374,6 @@ DROP TABLE t1,t2;
|
||||
#
|
||||
# Test update with const tables
|
||||
#
|
||||
|
||||
create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
|
||||
create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
|
||||
insert into t1 values (0,'A01-Comp',1);
|
||||
@ -380,6 +384,39 @@ select * from t1;
|
||||
select * from t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# prevelege chexk for multiupdate with other tables
|
||||
#
|
||||
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
|
||||
connection root;
|
||||
--disable_warnings
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
create table mysqltest.t1 (a int, b int, primary key (a));
|
||||
create table mysqltest.t2 (a int, b int, primary key (a));
|
||||
create table mysqltest.t3 (a int, b int, primary key (a));
|
||||
grant select on mysqltest.* to mysqltest_1@localhost;
|
||||
grant update on mysqltest.t1 to mysqltest_1@localhost;
|
||||
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
|
||||
connection user1;
|
||||
update t1, t2 set t1.b=1 where t1.a=t2.a;
|
||||
update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
|
||||
connection root;
|
||||
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
drop database mysqltest;
|
||||
|
||||
#
|
||||
# multi delete wrong table check
|
||||
#
|
||||
create table t1 (a int, primary key (a));
|
||||
create table t2 (a int, primary key (a));
|
||||
create table t3 (a int, primary key (a));
|
||||
-- error 1109
|
||||
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
|
||||
drop table t1, t2, t3;
|
||||
|
||||
#
|
||||
# Test for bug #1980.
|
||||
#
|
||||
|
@ -479,3 +479,26 @@ checksum table t1, t2, t3;
|
||||
checksum table t1, t2, t3 extended;
|
||||
#show table status;
|
||||
drop table t1,t2;
|
||||
|
||||
create table t1 (a int, key (a));
|
||||
show keys from t1;
|
||||
alter table t1 disable keys;
|
||||
show keys from t1;
|
||||
create table t2 (a int);
|
||||
let $i=1000;
|
||||
--disable_query_log
|
||||
while ($i)
|
||||
{
|
||||
dec $i;
|
||||
eval insert t2 values (rand()*100000);
|
||||
}
|
||||
--enable_query_log
|
||||
insert t1 select * from t2;
|
||||
show keys from t1;
|
||||
alter table t1 enable keys;
|
||||
show keys from t1;
|
||||
alter table t1 engine=heap;
|
||||
alter table t1 disable keys;
|
||||
show keys from t1;
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -6,7 +6,7 @@ DROP TABLE IF EXISTS t1, `"t"1`;
|
||||
|
||||
CREATE TABLE t1(a int);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
|
||||
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -16,7 +16,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (a decimal(240, 20));
|
||||
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
|
||||
("0987654321098765432109876543210987654321");
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --compact test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -28,12 +28,38 @@ INSERT INTO t1 VALUES (-9e999999);
|
||||
# The following replaces is here because some systems replaces the above
|
||||
# double with '-inf' and others with MAX_DOUBLE
|
||||
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --compact test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #3361 mysqldump quotes DECIMAL values inconsistently
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
||||
|
||||
# check at first how mysql work with quoted decimal
|
||||
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
--error 1054
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
# check how mysqldump make quoting
|
||||
--exec $MYSQL_DUMP --compact test t1
|
||||
--exec $MYSQL_DUMP --compact --skip-create test t1
|
||||
--exec $MYSQL_DUMP --skip-create --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||
--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
|
||||
--exec $MYSQL_DUMP --skip-create --compact -X test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -42,7 +68,7 @@ DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (`a"b"` char(2));
|
||||
INSERT INTO t1 VALUES ("1\""), ("\"2");
|
||||
--exec $MYSQL_DUMP --skip-all --skip-comments -X test t1
|
||||
--exec $MYSQL_DUMP --compact --skip-create -X test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -51,7 +77,7 @@ DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
|
||||
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
@ -65,11 +91,11 @@ INSERT INTO t1 VALUES (1), (2);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #2592 'mysqldum doesn't quote "tricky" names correctly'
|
||||
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
|
||||
#
|
||||
|
||||
create table ```a` (i int);
|
||||
--exec $MYSQL_DUMP --skip-comments test
|
||||
--exec $MYSQL_DUMP --compact test
|
||||
drop table ```a`;
|
||||
|
||||
#
|
||||
|
98
mysql-test/t/ndb_basic.test
Normal file
98
mysql-test/t/ndb_basic.test
Normal file
@ -0,0 +1,98 @@
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Basic test to show that the NDB
|
||||
# table handler is working
|
||||
#
|
||||
|
||||
#
|
||||
# Create a normal table with primary key
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
|
||||
SELECT pk1 FROM t1;
|
||||
SELECT * FROM t1;
|
||||
SELECT t1.* FROM t1;
|
||||
|
||||
UPDATE t1 SET attr1=1 WHERE pk1=9410;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Can't UPDATE PK! Test that correct error is returned
|
||||
-- error 1112
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=1;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Delete the record
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Delete the record by specifying pk
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Insert three records and delete the
|
||||
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Insert three records with attr1=4 and two with attr1=5
|
||||
# Delete all with attr1=4
|
||||
INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
|
||||
DELETE FROM t1 WHERE attr1=4;
|
||||
SELECT * FROM t1 order by pk1;
|
||||
DELETE FROM t1;
|
||||
|
||||
# Insert two records and delete one
|
||||
INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
|
||||
DELETE FROM t1 WHERE pk1 = 9410;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Create table without primary key
|
||||
# a hidden primary key column is created by handler
|
||||
#
|
||||
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
|
||||
INSERT INTO t1 values(3456, 7890);
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET id=2 WHERE id2=12;
|
||||
SELECT * FROM t1;
|
||||
UPDATE t1 SET id=1234 WHERE id2=7890;
|
||||
SELECT * FROM t1;
|
||||
DELETE FROM t1;
|
||||
|
||||
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
|
||||
SELECT * FROM t1;
|
||||
DELETE FROM t1 WHERE id = 3456;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# test create with the keyword "engine=NDBCLUSTER"
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDBCLUSTER;
|
||||
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# test create with the keyword "engine=NDB"
|
||||
CREATE TABLE t1 (
|
||||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=NDB;
|
||||
|
||||
INSERT INTO t1 values(1, 9999);
|
||||
|
||||
DROP TABLE t1;
|
31
mysql-test/t/ndb_cache.test
Normal file
31
mysql-test/t/ndb_cache.test
Normal file
@ -0,0 +1,31 @@
|
||||
-- source include/have_query_cache.inc
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
set GLOBAL query_cache_size=1355776;
|
||||
reset query cache;
|
||||
flush status;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int) ENGINE=ndbcluster;
|
||||
CREATE TABLE t2 (a int);
|
||||
|
||||
select * from t1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
select * from t2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
SET GLOBAL query_cache_size=0;
|
@ -21,6 +21,18 @@ create table test_$1.r1 (i int) raid_type=1;
|
||||
create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
|
||||
drop database test_$1;
|
||||
|
||||
#
|
||||
# Bug #3182: Test using more than 257 raid chunks
|
||||
#
|
||||
create database test_$1;
|
||||
create table test_$1.r2 (i int) raid_type=1 raid_chunks=257;
|
||||
show create table test_$1.r2;
|
||||
drop database test_$1;
|
||||
|
||||
#
|
||||
# Test that data is spread over different raid directories
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id int unsigned not null auto_increment primary key,
|
||||
c char(255) not null
|
||||
|
@ -27,8 +27,9 @@ drop table t1;
|
||||
# non-existent table
|
||||
repair table t1 use_frm;
|
||||
|
||||
#
|
||||
# Create test table for repair2
|
||||
# The following must be last in this file
|
||||
|
||||
create table t1 engine=myisam SELECT 1,"table 1";
|
||||
flush tables;
|
||||
system echo 1 > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI ;
|
||||
repair table t1;
|
||||
repair table t1 use_frm;
|
||||
drop table t1;
|
@ -1 +0,0 @@
|
||||
echo "1" > $MYSQL_TEST_DIR/var/master-data/test/t1.MYI
|
@ -1,7 +0,0 @@
|
||||
#
|
||||
# This test starts with a crashed t1.MYI file left over from repair.test
|
||||
#
|
||||
|
||||
repair table t1;
|
||||
repair table t1 use_frm;
|
||||
drop table t1;
|
@ -40,7 +40,7 @@ insert into t3 values(connection_id());
|
||||
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
|
||||
|
||||
connection master1;
|
||||
sleep 2;
|
||||
real_sleep 2;
|
||||
select (@id := id) - id from t3;
|
||||
kill @id;
|
||||
drop table t2,t3;
|
||||
|
1
mysql-test/t/rpl_multi_delete2-slave.opt
Normal file
1
mysql-test/t/rpl_multi_delete2-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--replicate-wild-ignore-table=test.%
|
23
mysql-test/t/rpl_multi_delete2.test
Normal file
23
mysql-test/t/rpl_multi_delete2.test
Normal file
@ -0,0 +1,23 @@
|
||||
source include/master-slave.inc;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1);
|
||||
|
||||
delete t1.* from t1, t2 where t1.a = t2.a;
|
||||
|
||||
save_master_pos;
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
|
||||
connection slave;
|
||||
# BUG#3461 would cause sync to fail
|
||||
sync_with_master;
|
||||
error 1146;
|
||||
select * from t1;
|
||||
error 1146;
|
||||
select * from t2;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
@ -2,7 +2,7 @@ source include/master-slave.inc;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
b int unsigned
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
|
22
mysql-test/t/rpl_server_id1.test
Normal file
22
mysql-test/t/rpl_server_id1.test
Normal file
@ -0,0 +1,22 @@
|
||||
# This test checks that a slave does not execute queries originating
|
||||
# from itself, by default.
|
||||
|
||||
source include/master-slave.inc;
|
||||
connection slave;
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
# replicate ourselves
|
||||
stop slave;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval change master to master_port=$SLAVE_MYPORT;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
--replace_column 18 #
|
||||
show slave status;
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
# can't MASTER_POS_WAIT(), it does not work in this weird setup
|
||||
# (when slave is its own master without --replicate-same-server-id)
|
||||
sleep 2; # enough time for the event to be replicated (it should not)
|
||||
show status like "slave_running";
|
||||
select * from t1;
|
||||
drop table t1;
|
1
mysql-test/t/rpl_server_id2-slave.opt
Normal file
1
mysql-test/t/rpl_server_id2-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--disable-log-slave-updates --replicate-same-server-id
|
25
mysql-test/t/rpl_server_id2.test
Normal file
25
mysql-test/t/rpl_server_id2.test
Normal file
@ -0,0 +1,25 @@
|
||||
# This test checks that a slave DOES execute queries originating
|
||||
# from itself, if running with --replicate-same-server-id.
|
||||
|
||||
source include/master-slave.inc;
|
||||
connection slave;
|
||||
drop table if exists t1;
|
||||
create table t1 (n int);
|
||||
reset master;
|
||||
# replicate ourselves
|
||||
stop slave;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
eval change master to master_port=$SLAVE_MYPORT;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
--replace_column 18 #
|
||||
show slave status;
|
||||
start slave;
|
||||
insert into t1 values (1);
|
||||
save_master_pos;
|
||||
sync_with_master;
|
||||
select * from t1; # check that indeed 2 were inserted
|
||||
# We stop the slave before cleaning up otherwise we'll get
|
||||
# 'drop table t1' executed twice, so an error in the slave.err
|
||||
# (not critical).
|
||||
stop slave;
|
||||
drop table t1;
|
@ -55,7 +55,7 @@ create table t1 (
|
||||
name char(20) default 'O''Brien' comment 'O''Brien as default',
|
||||
c int not null comment 'int column',
|
||||
`c-b` int comment 'name with a minus',
|
||||
`space 2` int comment 'name with a space',
|
||||
`space 2` int comment 'name with a space'
|
||||
) comment = 'it\'s a table' ;
|
||||
show create table t1;
|
||||
set sql_quote_show_create=0;
|
||||
|
@ -678,7 +678,7 @@ CREATE TABLE `t1` (
|
||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`pseudo` varchar(35) character set latin1 NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`)
|
||||
) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 (pseudo) VALUES ('test');
|
||||
SELECT 0 IN (SELECT 1 FROM t1 a);
|
||||
@ -781,7 +781,7 @@ CREATE TABLE `t1` (
|
||||
`email` varchar(60) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email` (`email`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`),
|
||||
UNIQUE KEY `pseudo` (`pseudo`)
|
||||
) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
|
||||
SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
|
||||
@ -1120,3 +1120,14 @@ create table t3(flag int);
|
||||
-- error 1064
|
||||
select (select * from t3 where id not null) from t1, t2;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
#
|
||||
# aggregate functions (Bug #3505)
|
||||
#
|
||||
CREATE TABLE t1 (id INT);
|
||||
CREATE TABLE t2 (id INT);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
|
||||
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
|
||||
DROP TABLE t1,t2
|
||||
|
@ -469,12 +469,13 @@ show status like 'Slow_queries';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# bug #2508
|
||||
# Column 'name' cannot be null (error with union and left join) (bug #2508)
|
||||
#
|
||||
create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
|
||||
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
|
||||
select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2809 (UNION fails on MyIsam tables when index on second column from
|
||||
# same table)
|
||||
@ -487,10 +488,8 @@ select col1 n from t1 union select col2 n from t1 order by n;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #1428, incorrect handling of UNION ALL
|
||||
# NOTE: The current result is wrong, needs to be fixed!
|
||||
# Incorrect handling of UNION ALL (Bug #1428)
|
||||
#
|
||||
|
||||
create table t1 (i int);
|
||||
insert into t1 values (1);
|
||||
select * from t1 UNION select * from t1;
|
||||
@ -498,4 +497,21 @@ select * from t1 UNION ALL select * from t1;
|
||||
select * from t1 UNION select * from t1 UNION ALL select * from t1;
|
||||
drop table t1;
|
||||
select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
|
||||
set sql_select_limit=1;
|
||||
select 1 union select 2;
|
||||
(select 1) union (select 2);
|
||||
(select 1) union (select 2) union (select 3) limit 2;
|
||||
set sql_select_limit=default;
|
||||
|
||||
#
|
||||
# ORDER with LIMIT
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values (100), (1);
|
||||
create table t2 (a int);
|
||||
insert into t2 values (100);
|
||||
select a from t1 union select a from t2 order by a;
|
||||
SET SQL_SELECT_LIMIT=1;
|
||||
select a from t1 union select a from t2 order by a;
|
||||
drop table t1, t2;
|
||||
set sql_select_limit=default;
|
||||
|
Reference in New Issue
Block a user