Commit ba4d1543 authored by Joerg Bruehe's avatar Joerg Bruehe

Merge the main 5.0 tree into 5.0-build.

parents 889a669f 69a1c78e
......@@ -154,7 +154,7 @@ test-bt:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1
@PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --reorder --suite=funcs_1
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
-if [ -d mysql-test/suite/nist ] ; then \
......@@ -179,7 +179,7 @@ test-force-full-pl: test-force-full
test-ext-funcs:
cd mysql-test ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_1 ; \
@PERL@ ./mysql-test-run.pl --force --reorder --suite=funcs_1 ; \
@PERL@ ./mysql-test-run.pl --force --suite=funcs_2
test-ext: test-ext-funcs
......
......@@ -1779,7 +1779,7 @@ static int read_and_execute(bool interactive)
the very beginning of a text file when
you save the file using "Unicode UTF-8" format.
*/
if (!line_number &&
if (line && !line_number &&
(uchar) line[0] == 0xEF &&
(uchar) line[1] == 0xBB &&
(uchar) line[2] == 0xBF)
......@@ -2081,37 +2081,6 @@ static bool add_line(String &buffer,char *line,char *in_string,
continue;
}
}
else if (!*ml_comment && !*in_string &&
(end_of_line - pos) >= 10 &&
!my_strnncoll(charset_info, (uchar*) pos, 10,
(const uchar*) "delimiter ", 10))
{
// Flush previously accepted characters
if (out != line)
{
buffer.append(line, (uint32) (out - line));
out= line;
}
// Flush possible comments in the buffer
if (!buffer.is_empty())
{
if (com_go(&buffer, 0) > 0) // < 0 is not fatal
DBUG_RETURN(1);
buffer.length(0);
}
/*
Delimiter wants the get rest of the given line as argument to
allow one to change ';' to ';;' and back
*/
buffer.append(pos);
if (com_delimiter(&buffer, pos) > 0)
DBUG_RETURN(1);
buffer.length(0);
break;
}
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
{
// Found a statement. Continue parsing after the delimiter
......@@ -2156,7 +2125,14 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
else if (!*ml_comment && (!*in_string && (inchar == '#' ||
inchar == '-' && pos[1] == '-' &&
my_isspace(charset_info,pos[2]))))
/*
The third byte is either whitespace or is the
end of the line -- which would occur only
because of the user sending newline -- which is
itself whitespace and should also match.
*/
(my_isspace(charset_info,pos[2]) ||
!pos[2]))))
{
// Flush previously accepted characters
if (out != line)
......
......@@ -67,7 +67,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(distdir)/std_data/ndb_backup50_data_be
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(distdir)/std_data/ndb_backup50_data_le
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(distdir)/std_data/funcs_1
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
-rm -rf `find $(distdir)/suite -type d -name SCCS`
......@@ -106,7 +106,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_be
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50_data_le
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/*.txt $(DESTDIR)$(testdir)/std_data/funcs_1
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
for f in `(cd $(srcdir); find suite -type f | grep -v SCCS)`; \
do \
......
# include/wait_condition.inc
#
# SUMMARY
#
# Waits until the passed statement returns true, or the operation
# times out.
#
# USAGE
#
# let $wait_condition=
# SELECT c = 3 FROM t;
# --source include/wait_condition.inc
#
# OR
#
# let $wait_timeout= 60; # Override default 30 seconds with 60.
# let $wait_condition=
# SELECT c = 3 FROM t;
# --source include/wait_condition.inc
# --echo Executed the test condition $wait_condition_reps times
#
# EXAMPLE
# events_bugs.test, events_time_zone.test
#
--disable_query_log
let $wait_counter= 300;
if ($wait_timeout)
{
let $wait_counter= `SELECT $wait_timeout * 10`;
}
# Reset $wait_timeout so that its value won't be used on subsequent
# calls, and default will be used instead.
let $wait_timeout= 0;
# Keep track of how many times the wait condition is tested
# This is used by some tests (e.g., main.status)
let $wait_condition_reps= 0;
while ($wait_counter)
{
let $success= `$wait_condition`;
inc $wait_condition_reps;
if ($success)
{
let $wait_counter= 0;
}
if (!$success)
{
real_sleep 0.1;
dec $wait_counter;
}
}
if (!$success)
{
echo Timeout in wait_condition.inc for $wait_condition;
}
--enable_query_log
......@@ -99,41 +99,99 @@ t1 CREATE TABLE `t1` (
`length(uuid())` int(10) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
insert into t1 set a = now();
select sleep(3);
sleep(3)
0
update t1 set b = now();
select timediff(b, a) >= '00:00:03' from t1;
timediff(b, a) >= '00:00:03'
1
drop table t1;
set global query_cache_size=1355776;
create table t1 (a int);
insert into t1 values (1),(1),(1);
create table t2 (a datetime default null, b datetime default null);
insert into t2 set a = now();
select a from t1 where sleep(1);
a
update t2 set b = now() where b is null;
insert into t2 set a = now();
select a from t1 where sleep(a);
a
update t2 set b = now() where b is null;
insert into t2 set a = now();
select a from t1 where sleep(1);
a
update t2 set b = now() where b is null;
select timediff(b, a) >= '00:00:03' from t2;
timediff(b, a) >= '00:00:03'
#------------------------------------------------------------------------
# Tests for Bug#6760 and Bug#12689
SET @row_count = 4;
SET @sleep_time_per_result_row = 1;
SET @max_acceptable_delay = 2;
SET @@global.query_cache_size = 1024 * 64;
DROP TEMPORARY TABLE IF EXISTS t_history;
DROP TABLE IF EXISTS t1;
CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
start_ts DATETIME, end_ts DATETIME,
start_cached INTEGER, end_cached INTEGER);
CREATE TABLE t1 (f1 BIGINT);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t_history
SET attempt = 4 - 4 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 4 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 4 + 1;
INSERT INTO t_history
SET attempt = 4 - 3 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 3 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 3 + 1;
INSERT INTO t_history
SET attempt = 4 - 2 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 2 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 2 + 1;
INSERT INTO t_history
SET attempt = 4 - 1 + 1, start_ts = NOW(),
start_cached = 0;
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
f1 SLEEP(@sleep_time_per_result_row)
1 0
1 0
1 0
1 0
UPDATE t_history SET end_ts = NOW()
WHERE attempt = 4 - 1 + 1;
UPDATE t_history SET end_cached = 0
WHERE attempt = 4 - 1 + 1;
# Test 1: Does the query with SLEEP need a reasonable time?
SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
BETWEEN 0 AND @max_acceptable_delay;
SELECT @aux1 AS "Expect 1";
Expect 1
1
# Test 2: Does the query with SLEEP need a reasonable time even in case
# of the non first execution?
SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
BETWEEN 0 AND @max_acceptable_delay
AND attempt > 1;
SELECT @aux2 AS "Expect 1";
Expect 1
1
# Test 3: The query with SLEEP must be not cached.
SELECT COUNT(*) = 4 INTO @aux3 FROM t_history
WHERE end_cached = start_cached;
SELECT @aux3 AS "Expect 1";
Expect 1
1
drop table t2;
drop table t1;
set global query_cache_size=default;
DROP TABLE t1;
DROP TEMPORARY TABLE t_history;
SET @@global.query_cache_size = default;
create table t1 select INET_ATON('255.255.0.1') as `a`;
show create table t1;
Table Create Table
......
......@@ -38,6 +38,8 @@ t2
t3
Tables_in_test
t1
delimiter
1
_
Test delimiter : from command line
a
......
......@@ -84,4 +84,3 @@ SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
FROM information_schema.columns
$my_where
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# suite/funcs_1/datadict/tables.inc
#
# Auxiliary script to be sourced by
# is_tables_<engine>.test
#
# The variable $engine_type has to be assigned before sourcing ths script.
#
# Author:
# 2008-06-04 mleich Create this script based on older scripts and new code.
#
# Just have some tables within different databases.
--disable_warnings
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
--enable_warnings
CREATE DATABASE test1;
CREATE DATABASE test2;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test1.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test1.t2 (f1 VARCHAR(20)) ENGINE = $engine_type;
--replace_result $engine_type <engine_to_be_used>
eval CREATE TABLE test2.t1 (f1 VARCHAR(20)) ENGINE = $engine_type;
--source suite/funcs_1/datadict/tables2.inc
SHOW TABLES FROM test1;
SHOW TABLES FROM test2;
# Create a low privileged user.
# Note: The database db_datadict is just a "home" for the low privileged user
# and not in the focus of testing.
--error 0,ER_CANNOT_USER
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
--echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc
SHOW TABLES FROM test1;
# The lowprivileged user testuser1 will get here an error.
--disable_abort_on_error
SHOW TABLES FROM test2;
--enable_abort_on_error
--echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
......@@ -2,8 +2,8 @@
#
# Auxiliary script to be sourced by
# is_tables_mysql.test
# is_tables_mysql_embedded.test
# is_tables_is.test
# is_tables_<engine>.test
#
# Author:
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of
......@@ -12,28 +12,27 @@
#
--disable_warnings
DROP DATABASE IF EXISTS db_datadict;
DROP DATABASE IF EXISTS test1;
--enable_warnings
CREATE DATABASE db_datadict;
CREATE DATABASE test1;
--source suite/funcs_1/datadict/tables2.inc
# Create a low privileged user.
# Note: The database db_datadict is just a "home" for the low privileged user
# Note: The database test1 is just a "home" for the low privileged user
# and not in the focus of testing.
--error 0,ER_CANNOT_USER
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON db_datadict.* TO testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
--echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,db_datadict);
connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc
--echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
DROP DATABASE test1;
......@@ -29,6 +29,8 @@
let $innodb_pattern = 'InnoDB free';
let $ndb_pattern = 'number_of_replicas';
--vertical_results
# We do not unify the engine name here, because the rowformat is
# specific to the engine.
--replace_column 8 "#TBLR#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT#" 16 "#UT#" 17 "#CT#" 20 "#CO#" 21 "#TC#"
eval
SELECT *,
......@@ -44,4 +46,3 @@ FROM information_schema.tables
$my_where
ORDER BY table_schema,table_name;
--horizontal_results
# Skip tests which suffer from
# Bug#28309 First insert violates unique constraint
# - was "memory" table empty?
# if the folowing conditions are fulfilled:
# - MySQL Version is 5.0 (Bug is fixed in 5.1 and up)
# - use of embedded server
# - run on a case insensitive filesystem
#
let $value= query_get_value(SHOW VARIABLES LIKE 'lower_case_file_system', Value, 1);
if (`SELECT '$value' = 'ON' AND VERSION() LIKE '5.0%embedded%'`)
{
skip # Test requires backport of fix for Bug#28309 First insert violates unique constraint - was "memory" table empty ?;
}
......@@ -7,7 +7,7 @@ create table tb1 (
f1 char(0),
f2 char(0) binary,
f3 char(0) ascii,
f4 tinytext unicode,
f4 tinytext,
f5 text,
f6 mediumtext,
f7 longtext,
......
......@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f124 longtext,
f125 tinyblob,
f126 blob,
f127 mediumblob,
......
......@@ -55,13 +55,13 @@ f223 year(3),
f224 year(4),
f225 enum("1enum","2enum"),
f226 set("1set","2set"),
f235 char(0) unicode,
f235 char(0),
f236 char(90),
f237 char(255) ascii,
f238 varchar(0),
f239 varchar(20000) binary,
f240 varchar(2000) unicode,
f241 char(100) unicode
f240 varchar(2000),
f241 char(100)
) engine = innodb;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
......
......@@ -55,12 +55,12 @@ f223 year(3),
f224 year(4),
f225 enum("1enum","2enum"),
f226 set("1set","2set"),
f236 char(95) unicode,
f241 char(255) unicode,
f236 char(95),
f241 char(255),
f237 char(130) binary,
f238 varchar(25000) binary,
f239 varbinary(0),
f240 varchar(1200) unicode
f240 varchar(1200)
) engine = memory;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
......
......@@ -7,7 +7,7 @@ create table tb1 (
f1 char,
f2 char binary,
f3 char ascii,
f4 tinytext unicode,
f4 tinytext,
f5 text,
f6 mediumtext,
f7 longtext,
......
......@@ -10,7 +10,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f124 longtext,
f125 tinyblob,
f126 blob,
f127 mediumblob,
......
......@@ -63,13 +63,13 @@ f231 VARBINARY(192),
f232 VARBINARY(27),
f233 VARBINARY(64),
f234 VARBINARY(192),
f235 char(255) unicode,
f235 char(255),
f236 char(60) ascii,
f237 char(255) binary,
f238 varchar(0) binary,
f239 varbinary(1000),
f240 varchar(120) unicode,
f241 char(100) unicode,
f240 varchar(120),
f241 char(100),
f242 bit(30)
) engine = myisam;
......
##### suite/funcs_1/include/tb3.inc
#
# This auxiliary script is used in several Trigger tests.
#
# If the table need data than the file std_data_ln/funcs_1/memory_tb3.txt
# could be used.
#
--disable_warnings
drop table if exists tb3;
--enable_warnings
--replace_result $engine_type <engine_to_be_used>
eval create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
f132 tinyint zerofill not null DEFAULT 99,
f133 tinyint unsigned zerofill not null DEFAULT 99,
f134 smallint not null DEFAULT 999,
f135 smallint unsigned not null DEFAULT 999,
f136 smallint zerofill not null DEFAULT 999,
f137 smallint unsigned zerofill not null DEFAULT 999,
f138 mediumint not null DEFAULT 9999,
f139 mediumint unsigned not null DEFAULT 9999,
f140 mediumint zerofill not null DEFAULT 9999,
f141 mediumint unsigned zerofill not null DEFAULT 9999,
f142 int not null DEFAULT 99999,
f143 int unsigned not null DEFAULT 99999,
f144 int zerofill not null DEFAULT 99999,
f145 int unsigned zerofill not null DEFAULT 99999,
f146 bigint not null DEFAULT 999999,
f147 bigint unsigned not null DEFAULT 999999,
f148 bigint zerofill not null DEFAULT 999999,
f149 bigint unsigned zerofill not null DEFAULT 999999,
f150 decimal not null DEFAULT 999.999,
f151 decimal unsigned not null DEFAULT 999.17,
f152 decimal zerofill not null DEFAULT 999.999,
f153 decimal unsigned zerofill,
f154 decimal (0),
f155 decimal (64),
f156 decimal (0) unsigned,
f157 decimal (64) unsigned,
f158 decimal (0) zerofill,
f159 decimal (64) zerofill,
f160 decimal (0) unsigned zerofill,
f161 decimal (64) unsigned zerofill,
f162 decimal (0,0),
f163 decimal (63,30),
f164 decimal (0,0) unsigned,
f165 decimal (63,30) unsigned,
f166 decimal (0,0) zerofill,
f167 decimal (63,30) zerofill,
f168 decimal (0,0) unsigned zerofill,
f169 decimal (63,30) unsigned zerofill,
f170 numeric,
f171 numeric unsigned,
f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = $engine_type;
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,13 +53,11 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
into table tb3;
Testcase: 3.5.1.1:
------------------
......@@ -194,7 +186,7 @@ Testcase 3.5.1.7: - need to fix
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (f1 int, f2 char(25),f3 int) engine=innodb;
create table t1 (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>;
CREATE TRIGGER trg5_1 BEFORE INSERT on test.t1
for each row set new.f3 = '14';
CREATE TRIGGER trg_abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
......@@ -233,7 +225,7 @@ ERROR HY000: Trigger in wrong schema
drop database if exists trig_db;
create database trig_db;
use trig_db;
create table t1 (f1 integer) engine = innodb;
create table t1 (f1 integer) engine = <engine_to_be_used>;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
......@@ -261,8 +253,8 @@ Testcase 3.5.1.?:
-----------------
drop table if exists t1;
drop table if exists t2;
create table t1 (f1 char(50), f2 integer) engine = innodb;
create table t2 (f1 char(50), f2 integer) engine = innodb;
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create trigger trig before insert on t1
for each row set new.f1 ='trig t1';
create trigger trig before update on t2
......@@ -294,15 +286,15 @@ create database trig_db1;
create database trig_db2;
create database trig_db3;
use trig_db1;
create table t1 (f1 char(50), f2 integer) engine = innodb;
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create trigger trig before insert on t1
for each row set new.f1 ='trig1', @test_var1='trig1';
use trig_db2;
create table t2 (f1 char(50), f2 integer) engine = innodb;
create table t2 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create trigger trig before insert on t2
for each row set new.f1 ='trig2', @test_var2='trig2';
use trig_db3;
create table t1 (f1 char(50), f2 integer) engine = innodb;
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create trigger trig before insert on t1
for each row set new.f1 ='trig3', @test_var3='trig3';
set @test_var1= '', @test_var2= '', @test_var3= '';
......@@ -340,8 +332,8 @@ drop database if exists trig_db2;
create database trig_db1;
create database trig_db2;
use trig_db1;
create table t1 (f1 char(50), f2 integer) engine = innodb;
create table trig_db2.t1 (f1 char(50), f2 integer) engine = innodb;
create table t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create table trig_db2.t1 (f1 char(50), f2 integer) engine = <engine_to_be_used>;
create trigger trig1_b before insert on t1
for each row set @test_var1='trig1_b';
create trigger trig_db1.trig1_a after insert on t1
......
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,20 +53,18 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
into table tb3;
Testcase 3.5.3:
---------------
drop database if exists priv_db;
create database priv_db;
use priv_db;
create table t1 (f1 char(20)) engine= innodb;
create table t1 (f1 char(20)) engine= <engine_to_be_used>;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
create User test_yesprivs@localhost;
......@@ -609,8 +601,8 @@ Testcase: 3.5.3.x:
use priv_db;
drop table if exists t1;
drop table if exists t2;
create table t1 (f1 int) engine= innodb;
create table t2 (f2 int) engine= innodb;
create table t1 (f1 int) engine= <engine_to_be_used>;
create table t2 (f2 int) engine= <engine_to_be_used>;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
grant SUPER on *.* to test_yesprivs@localhost;
grant SELECT, UPDATE on priv_db.t1 to test_yesprivs@localhost;
......@@ -699,4 +691,5 @@ drop database if exists priv_db;
drop user test_yesprivs@localhost;
drop user test_noprivs@localhost;
drop user test_noprivs;
DROP TABLE test.tb3;
use test;
drop table tb3;
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,13 +53,11 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
into table tb3;
Testcase: 3.5:
--------------
......@@ -86,7 +78,7 @@ Testcase 3.5.4.1:
-----------------
create database db_drop;
Use db_drop;
create table t1 (f1 char(30)) engine=innodb;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop.t1 to test_general;
Use db_drop;
Create trigger trg1 BEFORE INSERT on t1
......@@ -114,7 +106,7 @@ Testcase 3.5.4.2:
create database db_drop2;
Use db_drop2;
drop table if exists t1_432 ;
create table t1_432 (f1 char (30)) engine=innodb;
create table t1_432 (f1 char (30)) engine = <engine_to_be_used>;
Drop trigger tr_does_not_exit;
ERROR HY000: Trigger does not exist
drop table if exists t1_432 ;
......@@ -126,8 +118,8 @@ create database db_drop3;
Use db_drop3;
drop table if exists t1_433 ;
drop table if exists t1_433a ;
create table t1_433 (f1 char (30)) engine=innodb;
create table t1_433a (f1a char (5)) engine=innodb;
create table t1_433 (f1 char (30)) engine = <engine_to_be_used>;
create table t1_433a (f1a char (5)) engine = <engine_to_be_used>;
CREATE TRIGGER trg3 BEFORE INSERT on t1_433 for each row
set new.f1 = 'Trigger 3.5.4.3';
Drop trigger t1.433.trg3;
......@@ -147,7 +139,7 @@ Testcase 3.5.4.4:
-----------------
create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine=innodb;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
Create trigger trg4 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.4';
......@@ -168,7 +160,7 @@ where information_schema.triggers.trigger_name='trg4';
trigger_schema trigger_name event_object_table
create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine=innodb;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
Insert into t1 values ('2nd Insert 3.5.4.4');
Select * from t1;
......@@ -183,7 +175,7 @@ Testcase 3.5.4.5:
-----------------
create database db_drop5;
Use db_drop5;
create table t1 (f1 char(50)) engine=innodb;
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
Create trigger trg5 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.5';
......@@ -199,7 +191,7 @@ select trigger_schema, trigger_name, event_object_table
from information_schema.triggers
where information_schema.triggers.trigger_name='trg5';
trigger_schema trigger_name event_object_table
create table t1 (f1 char(50)) engine=innodb;
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
Insert into t1 values ('2nd Insert 3.5.4.5');
Select * from t1;
......@@ -240,7 +232,7 @@ Testcase 3.5.5.4:
create database dbtest_one;
create database dbtest_two;
use dbtest_two;
create table t2 (f1 char(15)) engine=innodb;
create table t2 (f1 char(15)) engine = <engine_to_be_used>;
use dbtest_one;
create trigger trg4 before INSERT
on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4';
......
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,13 +53,11 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
into table tb3;
Testcase: 3.5:
--------------
......@@ -94,17 +86,17 @@ create table t1_i (
i120 char ascii not null DEFAULT b'101',
i136 smallint zerofill not null DEFAULT 999,
i144 int zerofill not null DEFAULT 99999,
i163 decimal (63,30)) engine=innodb;
i163 decimal (63,30)) engine=<engine_to_be_used>;
create table t1_u (
u120 char ascii not null DEFAULT b'101',
u136 smallint zerofill not null DEFAULT 999,
u144 int zerofill not null DEFAULT 99999,
u163 decimal (63,30)) engine=innodb;
u163 decimal (63,30)) engine=<engine_to_be_used>;
create table t1_d (
d120 char ascii not null DEFAULT b'101',
d136 smallint zerofill not null DEFAULT 999,
d144 int zerofill not null DEFAULT 99999,
d163 decimal (63,30)) engine=innodb;
d163 decimal (63,30)) engine=<engine_to_be_used>;
Insert into t1_u values ('a',111,99999,999.99);
Insert into t1_u values ('b',222,99999,999.99);
Insert into t1_u values ('c',333,99999,999.99);
......
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,12 +53,12 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt'
into table tb3;
Testcase 3.5.9.1/2:
......@@ -74,9 +68,9 @@ set new.f142 = 94087, @counter=@counter+1;
TotalRows
10
Affected
8
9
NotAffected
2
1
NewValuew
0
set @counter=0;
......@@ -84,7 +78,7 @@ Update tb3 Set f142='1' where f130<100;
select count(*) as ExpectedChanged, @counter as TrigCounter
from tb3 where f142=94087;
ExpectedChanged TrigCounter
8 8
9 9
select count(*) as ExpectedNotChange from tb3
where f130<100 and f142<>94087;
ExpectedNotChange
......
USE test;
drop table if exists tb3 ;
drop table if exists tb3;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f121 char(50),
f122 char(50),
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
......@@ -59,12 +53,12 @@ f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
) engine = <engine_to_be_used>;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb3.txt'
into table tb3;
Testcase 3.5.10.1/2/3:
......@@ -135,7 +129,7 @@ delete from tb3 where f122 like 'Test 3.5.10.1/2/3%';
Testcase 3.5.10.4:
------------------
create table tb_load (f1 int, f2 char(25),f3 int) engine=innodb;
create table tb_load (f1 int, f2 char(25),f3 int) engine = <engine_to_be_used>;
Create trigger trg4 before insert on tb_load
for each row set new.f3=-(new.f1 div 5), @counter= @counter+1;
set @counter= 0;
......@@ -169,7 +163,7 @@ Testcase 3.5.10.6: (implemented in trig_frkey.test)
Testcase 3.5.10.extra:
----------------------
create table t1_sp (var136 tinyint, var151 decimal) engine=innodb;
create table t1_sp (var136 tinyint, var151 decimal) engine = <engine_to_be_used>;
create trigger trg before insert on t1_sp
for each row set @counter=@counter+1;
create procedure trig_sp()
......@@ -218,12 +212,12 @@ drop table if exists t2_2;
drop table if exists t2_3;
drop table if exists t2_4;
drop table if exists t3;
create table t1 (f1 integer) engine=innodb;
create table t2_1 (f1 integer) engine=innodb;
create table t2_2 (f1 integer) engine=innodb;
create table t2_3 (f1 integer) engine=innodb;
create table t2_4 (f1 integer) engine=innodb;
create table t3 (f1 integer) engine=innodb;
create table t1 (f1 integer) engine = <engine_to_be_used>;
create table t2_1 (f1 integer) engine = <engine_to_be_used>;
create table t2_2 (f1 integer) engine = <engine_to_be_used>;
create table t2_3 (f1 integer) engine = <engine_to_be_used>;
create table t2_4 (f1 integer) engine = <engine_to_be_used>;
create table t3 (f1 integer) engine = <engine_to_be_used>;
insert into t1 values (1);
create trigger tr1 after insert on t1 for each row
BEGIN
......@@ -261,10 +255,10 @@ drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
create table t1 (f1 integer) engine = innodb;
create table t2 (f2 integer) engine = innodb;
create table t3 (f3 integer) engine = innodb;
create table t4 (f4 integer) engine = innodb;
create table t1 (f1 integer) engine = <engine_to_be_used>;
create table t2 (f2 integer) engine = <engine_to_be_used>;
create table t3 (f3 integer) engine = <engine_to_be_used>;
create table t4 (f4 integer) engine = <engine_to_be_used>;
insert into t1 values (0);
create trigger tr1 after insert on t1
for each row insert into t2 (f2) values (new.f1+1);
......@@ -300,7 +294,7 @@ set @sql_mode='traditional';
create table t1_sp (
count integer,
var136 tinyint,
var151 decimal) engine=innodb;
var151 decimal) engine = <engine_to_be_used>;
create procedure trig_sp()
begin
declare done int default 0;
......@@ -354,7 +348,7 @@ drop procedure trig_sp;
drop trigger trg;
drop table t1_sp;
Testcase y.y.y.5: Roleback of nested trigger references
Testcase y.y.y.5: Rollback of nested trigger references
-------------------------------------------------------
set @@sql_mode='traditional';
use test;
......@@ -362,10 +356,10 @@ drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
create table t1 (f1 integer) engine = innodb;
create table t2 (f2 integer) engine = innodb;
create table t3 (f3 integer) engine = innodb;
create table t4 (f4 tinyint) engine = innodb;
create table t1 (f1 integer) engine = <engine_to_be_used>;
create table t2 (f2 integer) engine = <engine_to_be_used>;
create table t3 (f3 integer) engine = <engine_to_be_used>;
create table t4 (f4 tinyint) engine = <engine_to_be_used>;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
USE test;
drop table if exists tb3 ;
create table tb3 (
f118 char not null DEFAULT 'a',
f119 char binary not null DEFAULT b'101',
f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f125 tinyblob,
f126 blob,
f127 mediumblob,
f128 longblob,
f129 binary not null DEFAULT b'101',
f130 tinyint not null DEFAULT 99,
f131 tinyint unsigned not null DEFAULT 99,
f132 tinyint zerofill not null DEFAULT 99,
f133 tinyint unsigned zerofill not null DEFAULT 99,
f134 smallint not null DEFAULT 999,
f135 smallint unsigned not null DEFAULT 999,
f136 smallint zerofill not null DEFAULT 999,
f137 smallint unsigned zerofill not null DEFAULT 999,
f138 mediumint not null DEFAULT 9999,
f139 mediumint unsigned not null DEFAULT 9999,
f140 mediumint zerofill not null DEFAULT 9999,
f141 mediumint unsigned zerofill not null DEFAULT 9999,
f142 int not null DEFAULT 99999,
f143 int unsigned not null DEFAULT 99999,
f144 int zerofill not null DEFAULT 99999,
f145 int unsigned zerofill not null DEFAULT 99999,
f146 bigint not null DEFAULT 999999,
f147 bigint unsigned not null DEFAULT 999999,
f148 bigint zerofill not null DEFAULT 999999,
f149 bigint unsigned zerofill not null DEFAULT 999999,
f150 decimal not null DEFAULT 999.999,
f151 decimal unsigned not null DEFAULT 999.17,
f152 decimal zerofill not null DEFAULT 999.999,
f153 decimal unsigned zerofill,
f154 decimal (0),
f155 decimal (64),
f156 decimal (0) unsigned,
f157 decimal (64) unsigned,
f158 decimal (0) zerofill,
f159 decimal (64) zerofill,
f160 decimal (0) unsigned zerofill,
f161 decimal (64) unsigned zerofill,
f162 decimal (0,0),
f163 decimal (63,30),
f164 decimal (0,0) unsigned,
f165 decimal (63,30) unsigned,
f166 decimal (0,0) zerofill,
f167 decimal (63,30) zerofill,
f168 decimal (0,0) unsigned zerofill,
f169 decimal (63,30) unsigned zerofill,
f170 numeric,
f171 numeric unsigned,
f172 numeric zerofill,
f173 numeric unsigned zerofill,
f174 numeric (0),
f175 numeric (64)
) engine = innodb;
Warnings:
Note 1265 Data truncated for column 'f150' at row 1
Note 1265 Data truncated for column 'f151' at row 1
Note 1265 Data truncated for column 'f152' at row 1
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb3.txt'
into table tb3;
Testcase x.x.x.1:
-----------------
DROP TABLE IF EXISTS t0, t1, t2;
CREATE TABLE t0 (col1 char(50)) ENGINE=innodb;
CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
PRIMARY KEY (id)) ENGINE=innodb;
CREATE TABLE t0 (col1 CHAR(50))
ENGINE = <engine_to_be_tested>;
CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id))
ENGINE = <engine_to_be_tested>;
CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
ON DELETE SET NULL) ENGINE=innodb;
insert into t1 values (1,'Department A');
insert into t1 values (2,'Department B');
insert into t1 values (3,'Department C');
insert into t2 values (1,2,'Emp 1');
insert into t2 values (2,2,'Emp 2');
insert into t2 values (3,2,'Emp 3');
create trigger trig after insert on t0 for each row
delete from t1 where col1=new.col1;
select * from t2;
INDEX par_ind (f_id), col1 CHAR(50),
FOREIGN KEY (f_id) REFERENCES t1(id) ON DELETE SET NULL)
ENGINE = <engine_to_be_tested>;
INSERT INTO t1 VALUES (1,'Department A');
INSERT INTO t1 VALUES (2,'Department B');
INSERT INTO t1 VALUES (3,'Department C');
INSERT INTO t2 VALUES (1,2,'Emp 1');
INSERT INTO t2 VALUES (2,2,'Emp 2');
INSERT INTO t2 VALUES (3,2,'Emp 3');
CREATE TRIGGER trig AFTER INSERT ON t0 FOR EACH ROW
DELETE FROM t1 WHERE col1 = new.col1;
SELECT * FROM t2;
id f_id col1
1 2 Emp 1
2 2 Emp 2
3 2 Emp 3
lock tables t0 write, t1 write;
insert into t0 values ('Department B');
unlock tables;
select * from t2;
LOCK TABLES t0 WRITE, t1 WRITE;
INSERT INTO t0 VALUES ('Department B');
UNLOCK TABLES;
SELECT * FROM t2;
id f_id col1
1 NULL Emp 1
2 NULL Emp 2
3 NULL Emp 3
drop trigger trig;
drop table t2, t1;
DROP TRIGGER trig;
DROP TABLE t2, t1;
Testcase x.x.x.2:
-----------------
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (id INT NOT NULL, col1 char(50),
PRIMARY KEY (id)) ENGINE=innodb;
CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id))
ENGINE = <engine_to_be_tested>;
CREATE TABLE t2 (id INT PRIMARY KEY, f_id INT,
INDEX par_ind (f_id), col1 char(50),
FOREIGN KEY (f_id) REFERENCES t1(id)
ON UPDATE CASCADE) ENGINE=innodb;
insert into t1 values (1,'Department A');
insert into t1 values (2,'Department B');
insert into t1 values (3,'Department C');
insert into t2 values (1,2,'Emp 1');
insert into t2 values (2,3,'Emp 2');
insert into t2 values (3,4,'Emp 3');
INDEX par_ind (f_id), col1 CHAR(50),
FOREIGN KEY (f_id) REFERENCES t1(id) ON UPDATE CASCADE)
ENGINE = <engine_to_be_tested>;
INSERT INTO t1 VALUES (1,'Department A');
INSERT INTO t1 VALUES (2,'Department B');
INSERT INTO t1 VALUES (3,'Department C');
INSERT INTO t2 VALUES (1,2,'Emp 1');
INSERT INTO t2 VALUES (2,3,'Emp 2');
insert into t2 VALUES (3,4,'Emp 3');
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f_id`) REFERENCES `t1` (`id`) ON UPDATE CASCADE)
create trigger tr_t2 before insert on t2 for each row
insert into t1 values(new.f_id, concat('New Department ', new.f_id));
lock tables t1 write, t2 write;
insert into t2 values (3,4,'Emp 3');
unlock tables;
select * from t1;
CREATE TRIGGER tr_t2 BEFORE INSERT ON t2 FOR EACH ROW
INSERT INTO t1 VALUES(new.f_id, CONCAT('New Department ', new.f_id));
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t2 VALUES (3,4,'Emp 3');
UNLOCK TABLES;
SELECT * FROM t1;
id col1
1 Department A
2 Department B
3 Department C
4 New Department 4
select * from t2;
SELECT * FROM t2;
id f_id col1
1 2 Emp 1
2 3 Emp 2
3 4 Emp 3
drop trigger tr_t2;
drop table t2, t1, t0;
DROP TRIGGER tr_t2;
DROP TABLE t2, t1, t0;
Foreign Key tests disabled (bug 11472 - stored in trig_frkey2.test)
-------------------------------------------------------------------
DROP TABLE test.tb3;
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
f1 CHAR UNICODE,
f2 CHAR(0) UNICODE,
f3 CHAR(10) UNICODE,
f5 VARCHAR(0) UNICODE,
f6 VARCHAR(255) UNICODE,
f7 VARCHAR(260) UNICODE,
f8 TEXT UNICODE,
f9 TINYTEXT UNICODE,
f10 MEDIUMTEXT UNICODE,
f11 LONGTEXT UNICODE
) ENGINE = InnoDB;
SELECT * FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references
NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references
NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references
NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references
NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references
NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references
NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references
NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 longtext ucs2 ucs2_general_ci
2.0000 mediumtext ucs2 ucs2_general_ci
2.0000 text ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
2.0079 tinytext ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL char ucs2 ucs2_general_ci
NULL varchar ucs2 ucs2_general_ci
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH,
CHARACTER_SET_NAME,
COLLATION_NAME,
COLUMN_TYPE
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1)
NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0)
2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10)
NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0)
2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255)
2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260)
2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text
2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext
2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext
2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
DROP TABLE t1;
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
f1 CHAR UNICODE,
f2 CHAR(0) UNICODE,
f3 CHAR(10) UNICODE,
f5 VARCHAR(0) UNICODE,
f6 VARCHAR(255) UNICODE,
f7 VARCHAR(260) UNICODE
) ENGINE = MEMORY;
SELECT * FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references
NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references
NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references
NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references
NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL char ucs2 ucs2_general_ci
NULL varchar ucs2 ucs2_general_ci
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH,
CHARACTER_SET_NAME,
COLLATION_NAME,
COLUMN_TYPE
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1)
NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0)
2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10)
NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0)
2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255)
2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260)
DROP TABLE t1;
SET @@session.sql_mode = 'NO_ENGINE_SUBSTITUTION';
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
f1 CHAR UNICODE,
f2 CHAR(0) UNICODE,
f3 CHAR(10) UNICODE,
f5 VARCHAR(0) UNICODE,
f6 VARCHAR(255) UNICODE,
f7 VARCHAR(260) UNICODE,
f8 TEXT UNICODE,
f9 TINYTEXT UNICODE,
f10 MEDIUMTEXT UNICODE,
f11 LONGTEXT UNICODE
) ENGINE = MyISAM;
SELECT * FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references
NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references
NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references
NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references
NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references
NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references
NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references
NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 longtext ucs2 ucs2_general_ci
2.0000 mediumtext ucs2 ucs2_general_ci
2.0000 text ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
2.0079 tinytext ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL char ucs2 ucs2_general_ci
NULL varchar ucs2 ucs2_general_ci
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH,
CHARACTER_SET_NAME,
COLLATION_NAME,
COLUMN_TYPE
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1)
NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0)
2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10)
NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0)
2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255)
2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260)
2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text
2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext
2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext
2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
DROP TABLE t1;
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
f1 CHAR UNICODE,
f2 CHAR(0) UNICODE,
f3 CHAR(10) UNICODE,
f5 VARCHAR(0) UNICODE,
f6 VARCHAR(255) UNICODE,
f7 VARCHAR(260) UNICODE,
f8 TEXT UNICODE,
f9 TINYTEXT UNICODE,
f10 MEDIUMTEXT UNICODE,
f11 LONGTEXT UNICODE
) ENGINE = NDB;
SELECT * FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
NULL test t1 f1 1 NULL YES char 1 2 NULL NULL ucs2 ucs2_general_ci char(1) select,insert,update,references
NULL test t1 f10 9 NULL YES mediumtext 8388607 16777215 NULL NULL ucs2 ucs2_general_ci mediumtext select,insert,update,references
NULL test t1 f11 10 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
NULL test t1 f2 2 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
NULL test t1 f3 3 NULL YES char 10 20 NULL NULL ucs2 ucs2_general_ci char(10) select,insert,update,references
NULL test t1 f5 4 NULL YES varchar 0 0 NULL NULL ucs2 ucs2_general_ci varchar(0) select,insert,update,references
NULL test t1 f6 5 NULL YES varchar 255 510 NULL NULL ucs2 ucs2_general_ci varchar(255) select,insert,update,references
NULL test t1 f7 6 NULL YES varchar 260 520 NULL NULL ucs2 ucs2_general_ci varchar(260) select,insert,update,references
NULL test t1 f8 7 NULL YES text 32767 65535 NULL NULL ucs2 ucs2_general_ci text select,insert,update,references
NULL test t1 f9 8 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
##########################################################################
# Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH
##########################################################################
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 longtext ucs2 ucs2_general_ci
2.0000 mediumtext ucs2 ucs2_general_ci
2.0000 text ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
2.0079 tinytext ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
CHARACTER_SET_NAME,
COLLATION_NAME
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
NULL char ucs2 ucs2_general_ci
NULL varchar ucs2 ucs2_general_ci
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
TABLE_SCHEMA,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH,
CHARACTER_SET_NAME,
COLLATION_NAME,
COLUMN_TYPE
FROM information_schema.columns
WHERE table_schema LIKE 'test%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
2.0000 test t1 f1 char 1 2 ucs2 ucs2_general_ci char(1)
NULL test t1 f2 char 0 0 ucs2 ucs2_general_ci char(0)
2.0000 test t1 f3 char 10 20 ucs2 ucs2_general_ci char(10)
NULL test t1 f5 varchar 0 0 ucs2 ucs2_general_ci varchar(0)
2.0000 test t1 f6 varchar 255 510 ucs2 ucs2_general_ci varchar(255)
2.0000 test t1 f7 varchar 260 520 ucs2 ucs2_general_ci varchar(260)
2.0000 test t1 f8 text 32767 65535 ucs2 ucs2_general_ci text
2.0079 test t1 f9 tinytext 127 255 ucs2 ucs2_general_ci tinytext
2.0000 test t1 f10 mediumtext 8388607 16777215 ucs2 ucs2_general_ci mediumtext
2.0000 test t1 f11 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
DROP TABLE t1;
......@@ -6,7 +6,7 @@ create table tb1 (
f1 char(0),
f2 char(0) binary,
f3 char(0) ascii,
f4 tinytext unicode,
f4 tinytext,
f5 text,
f6 mediumtext,
f7 longtext,
......@@ -142,7 +142,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f124 longtext,
f125 tinyblob,
f126 blob,
f127 mediumblob,
......@@ -254,13 +254,13 @@ f223 year(3),
f224 year(4),
f225 enum("1enum","2enum"),
f226 set("1set","2set"),
f235 char(0) unicode,
f235 char(0),
f236 char(90),
f237 char(255) ascii,
f238 varchar(0),
f239 varchar(20000) binary,
f240 varchar(2000) unicode,
f241 char(100) unicode
f240 varchar(2000),
f241 char(100)
) engine = innodb;
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/innodb_tb4.txt'
into table tb4;
......@@ -460,7 +460,7 @@ NULL test tb1 f36 36 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0
NULL test tb1 f37 37 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb1 f38 38 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) select,insert,update,references
NULL test tb1 f39 39 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb1 f4 4 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
NULL test tb1 f4 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references
NULL test tb1 f40 40 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned select,insert,update,references
NULL test tb1 f41 41 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
NULL test tb1 f42 42 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill select,insert,update,references
......@@ -542,7 +542,7 @@ NULL test tb3 f120 3  NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1)
NULL test tb3 f121 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references
NULL test tb3 f122 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text select,insert,update,references
NULL test tb3 f123 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext select,insert,update,references
NULL test tb3 f124 7 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
NULL test tb3 f124 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext select,insert,update,references
NULL test tb3 f125 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob select,insert,update,references
NULL test tb3 f126 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references
NULL test tb3 f127 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob select,insert,update,references
......@@ -645,13 +645,13 @@ NULL test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL year(4) sele
NULL test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references
NULL test tb4 f225 50 NULL YES enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') select,insert,update,references
NULL test tb4 f226 51 NULL YES set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') select,insert,update,references
NULL test tb4 f235 52 NULL YES char 0 0 NULL NULL ucs2 ucs2_general_ci char(0) select,insert,update,references
NULL test tb4 f235 52 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references
NULL test tb4 f236 53 NULL YES char 90 90 NULL NULL latin1 latin1_swedish_ci char(90) select,insert,update,references
NULL test tb4 f237 54 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references
NULL test tb4 f238 55 NULL YES varchar 0 0 NULL NULL latin1 latin1_swedish_ci varchar(0) select,insert,update,references
NULL test tb4 f239 56 NULL YES varchar 20000 20000 NULL NULL latin1 latin1_bin varchar(20000) select,insert,update,references
NULL test tb4 f240 57 NULL YES varchar 2000 4000 NULL NULL ucs2 ucs2_general_ci varchar(2000) select,insert,update,references
NULL test tb4 f241 58 NULL YES char 100 200 NULL NULL ucs2 ucs2_general_ci char(100) select,insert,update,references
NULL test tb4 f240 57 NULL YES varchar 2000 2000 NULL NULL latin1 latin1_swedish_ci varchar(2000) select,insert,update,references
NULL test tb4 f241 58 NULL YES char 100 100 NULL NULL latin1 latin1_swedish_ci char(100) select,insert,update,references
NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references
NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references
NULL test1 tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time select,insert,update,references
......@@ -736,6 +736,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 set latin1 latin1_swedish_ci
1.0000 text latin1 latin1_swedish_ci
1.0000 tinytext latin1 latin1_swedish_ci
1.0000 varchar latin1 latin1_swedish_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -746,10 +747,6 @@ WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 longtext ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
2.0079 tinytext ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -780,7 +777,6 @@ NULL year NULL NULL
NULL char latin1 latin1_bin
NULL char latin1 latin1_swedish_ci
NULL varchar latin1 latin1_swedish_ci
NULL char ucs2 ucs2_general_ci
--> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values
--> are 0, which is intended behavior, and the result of 0 / 0 IS NULL
SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
......@@ -844,7 +840,7 @@ NULL test t9 f3 int NULL NULL NULL NULL int(11)
NULL test tb1 f1 char 0 0 latin1 latin1_swedish_ci char(0)
NULL test tb1 f2 char 0 0 latin1 latin1_bin char(0)
NULL test tb1 f3 char 0 0 latin1 latin1_swedish_ci char(0)
2.0079 test tb1 f4 tinytext 127 255 ucs2 ucs2_general_ci tinytext
1.0000 test tb1 f4 tinytext 255 255 latin1 latin1_swedish_ci tinytext
1.0000 test tb1 f5 text 65535 65535 latin1 latin1_swedish_ci text
1.0000 test tb1 f6 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext
1.0000 test tb1 f7 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext
......@@ -956,7 +952,7 @@ NULL test tb2 f107 year NULL NULL NULL NULL year(4)
1.0000 test tb3 f121 tinytext 255 255 latin1 latin1_swedish_ci tinytext
1.0000 test tb3 f122 text 65535 65535 latin1 latin1_swedish_ci text
1.0000 test tb3 f123 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext
2.0000 test tb3 f124 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
1.0000 test tb3 f124 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext
1.0000 test tb3 f125 tinyblob 255 255 NULL NULL tinyblob
1.0000 test tb3 f126 blob 65535 65535 NULL NULL blob
1.0000 test tb3 f127 mediumblob 16777215 16777215 NULL NULL mediumblob
......@@ -1059,13 +1055,13 @@ NULL test tb4 f223 year NULL NULL NULL NULL year(4)
NULL test tb4 f224 year NULL NULL NULL NULL year(4)
1.0000 test tb4 f225 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum')
1.0000 test tb4 f226 set 9 9 latin1 latin1_swedish_ci set('1set','2set')
NULL test tb4 f235 char 0 0 ucs2 ucs2_general_ci char(0)
NULL test tb4 f235 char 0 0 latin1 latin1_swedish_ci char(0)
1.0000 test tb4 f236 char 90 90 latin1 latin1_swedish_ci char(90)
1.0000 test tb4 f237 char 255 255 latin1 latin1_swedish_ci char(255)
NULL test tb4 f238 varchar 0 0 latin1 latin1_swedish_ci varchar(0)
1.0000 test tb4 f239 varchar 20000 20000 latin1 latin1_bin varchar(20000)
2.0000 test tb4 f240 varchar 2000 4000 ucs2 ucs2_general_ci varchar(2000)
2.0000 test tb4 f241 char 100 200 ucs2 ucs2_general_ci char(100)
1.0000 test tb4 f240 varchar 2000 2000 latin1 latin1_swedish_ci varchar(2000)
1.0000 test tb4 f241 char 100 100 latin1 latin1_swedish_ci char(100)
NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned
NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned
NULL test1 tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill
......
This diff is collapsed.
......@@ -244,12 +244,12 @@ f223 year(3),
f224 year(4),
f225 enum("1enum","2enum"),
f226 set("1set","2set"),
f236 char(95) unicode,
f241 char(255) unicode,
f236 char(95),
f241 char(255),
f237 char(130) binary,
f238 varchar(25000) binary,
f239 varbinary(0),
f240 varchar(1200) unicode
f240 varchar(1200)
) engine = memory;
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/memory_tb4.txt'
into table tb4;
......@@ -620,12 +620,12 @@ NULL test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL year(4) sele
NULL test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references
NULL test tb4 f225 50 NULL YES enum 5 5 NULL NULL latin1 latin1_swedish_ci enum('1enum','2enum') select,insert,update,references
NULL test tb4 f226 51 NULL YES set 9 9 NULL NULL latin1 latin1_swedish_ci set('1set','2set') select,insert,update,references
NULL test tb4 f236 52 NULL YES char 95 190 NULL NULL ucs2 ucs2_general_ci char(95) select,insert,update,references
NULL test tb4 f236 52 NULL YES char 95 95 NULL NULL latin1 latin1_swedish_ci char(95) select,insert,update,references
NULL test tb4 f237 54 NULL YES char 130 130 NULL NULL latin1 latin1_bin char(130) select,insert,update,references
NULL test tb4 f238 55 NULL YES varchar 25000 25000 NULL NULL latin1 latin1_bin varchar(25000) select,insert,update,references
NULL test tb4 f239 56 NULL YES varbinary 0 0 NULL NULL NULL NULL varbinary(0) select,insert,update,references
NULL test tb4 f240 57 NULL YES varchar 1200 2400 NULL NULL ucs2 ucs2_general_ci varchar(1200) select,insert,update,references
NULL test tb4 f241 53 NULL YES char 255 510 NULL NULL ucs2 ucs2_general_ci char(255) select,insert,update,references
NULL test tb4 f240 57 NULL YES varchar 1200 1200 NULL NULL latin1 latin1_swedish_ci varchar(1200) select,insert,update,references
NULL test tb4 f241 53 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references
NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references
NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references
NULL test1 tb2 f102 44 00:00:20 NO time NULL NULL NULL NULL NULL NULL time select,insert,update,references
......@@ -702,6 +702,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 char latin1 latin1_swedish_ci
1.0000 enum latin1 latin1_swedish_ci
1.0000 set latin1 latin1_swedish_ci
1.0000 varchar latin1 latin1_swedish_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -712,8 +713,6 @@ WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -1006,12 +1005,12 @@ NULL test tb4 f223 year NULL NULL NULL NULL year(4)
NULL test tb4 f224 year NULL NULL NULL NULL year(4)
1.0000 test tb4 f225 enum 5 5 latin1 latin1_swedish_ci enum('1enum','2enum')
1.0000 test tb4 f226 set 9 9 latin1 latin1_swedish_ci set('1set','2set')
2.0000 test tb4 f236 char 95 190 ucs2 ucs2_general_ci char(95)
2.0000 test tb4 f241 char 255 510 ucs2 ucs2_general_ci char(255)
1.0000 test tb4 f236 char 95 95 latin1 latin1_swedish_ci char(95)
1.0000 test tb4 f241 char 255 255 latin1 latin1_swedish_ci char(255)
1.0000 test tb4 f237 char 130 130 latin1 latin1_bin char(130)
1.0000 test tb4 f238 varchar 25000 25000 latin1 latin1_bin varchar(25000)
NULL test tb4 f239 varbinary 0 0 NULL NULL varbinary(0)
2.0000 test tb4 f240 varchar 1200 2400 ucs2 ucs2_general_ci varchar(1200)
1.0000 test tb4 f240 varchar 1200 1200 latin1 latin1_swedish_ci varchar(1200)
NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned
NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned
NULL test1 tb2 f61 decimal NULL NULL NULL NULL decimal(10,0) unsigned zerofill
......
......@@ -7,7 +7,7 @@ create table tb1 (
f1 char,
f2 char binary,
f3 char ascii,
f4 tinytext unicode,
f4 tinytext,
f5 text,
f6 mediumtext,
f7 longtext,
......@@ -154,7 +154,7 @@ f120 char ascii not null DEFAULT b'101',
f121 tinytext,
f122 text,
f123 mediumtext,
f124 longtext unicode,
f124 longtext,
f125 tinyblob,
f126 blob,
f127 mediumblob,
......@@ -274,13 +274,13 @@ f231 VARBINARY(192),
f232 VARBINARY(27),
f233 VARBINARY(64),
f234 VARBINARY(192),
f235 char(255) unicode,
f235 char(255),
f236 char(60) ascii,
f237 char(255) binary,
f238 varchar(0) binary,
f239 varbinary(1000),
f240 varchar(120) unicode,
f241 char(100) unicode,
f240 varchar(120),
f241 char(100),
f242 bit(30)
) engine = myisam;
load data infile '<MYSQLTEST_VARDIR>/std_data_ln/funcs_1/myisam_tb4.txt'
......@@ -489,7 +489,7 @@ NULL test tb1 f36 36 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0
NULL test tb1 f37 37 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb1 f38 38 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) select,insert,update,references
NULL test tb1 f39 39 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb1 f4 4 NULL YES tinytext 127 255 NULL NULL ucs2 ucs2_general_ci tinytext select,insert,update,references
NULL test tb1 f4 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references
NULL test tb1 f40 40 10 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned select,insert,update,references
NULL test tb1 f41 41 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
NULL test tb1 f42 42 0000000000000000000000000000000000000000000000000000000000000010 NO decimal NULL NULL 64 0 NULL NULL decimal(64,0) unsigned zerofill select,insert,update,references
......@@ -579,7 +579,7 @@ NULL test tb3 f120 3  NO char 1 1 NULL NULL latin1 latin1_swedish_ci char(1)
NULL test tb3 f121 4 NULL YES tinytext 255 255 NULL NULL latin1 latin1_swedish_ci tinytext select,insert,update,references
NULL test tb3 f122 5 NULL YES text 65535 65535 NULL NULL latin1 latin1_swedish_ci text select,insert,update,references
NULL test tb3 f123 6 NULL YES mediumtext 16777215 16777215 NULL NULL latin1 latin1_swedish_ci mediumtext select,insert,update,references
NULL test tb3 f124 7 NULL YES longtext 2147483647 4294967295 NULL NULL ucs2 ucs2_general_ci longtext select,insert,update,references
NULL test tb3 f124 7 NULL YES longtext 4294967295 4294967295 NULL NULL latin1 latin1_swedish_ci longtext select,insert,update,references
NULL test tb3 f125 8 NULL YES tinyblob 255 255 NULL NULL NULL NULL tinyblob select,insert,update,references
NULL test tb3 f126 9 NULL YES blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references
NULL test tb3 f127 10 NULL YES mediumblob 16777215 16777215 NULL NULL NULL NULL mediumblob select,insert,update,references
......@@ -690,13 +690,13 @@ NULL test tb4 f231 56 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(1
NULL test tb4 f232 57 NULL YES varbinary 27 27 NULL NULL NULL NULL varbinary(27) select,insert,update,references
NULL test tb4 f233 58 NULL YES varbinary 64 64 NULL NULL NULL NULL varbinary(64) select,insert,update,references
NULL test tb4 f234 59 NULL YES varbinary 192 192 NULL NULL NULL NULL varbinary(192) select,insert,update,references
NULL test tb4 f235 60 NULL YES char 255 510 NULL NULL ucs2 ucs2_general_ci char(255) select,insert,update,references
NULL test tb4 f235 60 NULL YES char 255 255 NULL NULL latin1 latin1_swedish_ci char(255) select,insert,update,references
NULL test tb4 f236 61 NULL YES char 60 60 NULL NULL latin1 latin1_swedish_ci char(60) select,insert,update,references
NULL test tb4 f237 62 NULL YES char 255 255 NULL NULL latin1 latin1_bin char(255) select,insert,update,references
NULL test tb4 f238 63 NULL YES varchar 0 0 NULL NULL latin1 latin1_bin varchar(0) select,insert,update,references
NULL test tb4 f239 64 NULL YES varbinary 1000 1000 NULL NULL NULL NULL varbinary(1000) select,insert,update,references
NULL test tb4 f240 65 NULL YES varchar 120 240 NULL NULL ucs2 ucs2_general_ci varchar(120) select,insert,update,references
NULL test tb4 f241 66 NULL YES char 100 200 NULL NULL ucs2 ucs2_general_ci char(100) select,insert,update,references
NULL test tb4 f240 65 NULL YES varchar 120 120 NULL NULL latin1 latin1_swedish_ci varchar(120) select,insert,update,references
NULL test tb4 f241 66 NULL YES char 100 100 NULL NULL latin1 latin1_swedish_ci char(100) select,insert,update,references
NULL test tb4 f242 67 NULL YES bit NULL NULL 30 NULL NULL NULL bit(30) select,insert,update,references
NULL test1 tb2 f100 42 00000000000000000008.8 NO double unsigned zerofill NULL NULL 22 NULL NULL NULL double unsigned zerofill select,insert,update,references
NULL test1 tb2 f101 43 2000-01-01 NO date NULL NULL NULL NULL NULL NULL date select,insert,update,references
......@@ -790,6 +790,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
1.0000 set latin1 latin1_swedish_ci
1.0000 text latin1 latin1_swedish_ci
1.0000 tinytext latin1 latin1_swedish_ci
1.0000 varchar latin1 latin1_swedish_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -800,10 +801,6 @@ WHERE table_schema LIKE 'test%'
AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1
ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML;
COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME
2.0000 char ucs2 ucs2_general_ci
2.0000 longtext ucs2 ucs2_general_ci
2.0000 varchar ucs2 ucs2_general_ci
2.0079 tinytext ucs2 ucs2_general_ci
SELECT DISTINCT
CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML,
DATA_TYPE,
......@@ -896,7 +893,7 @@ NULL test t9 f3 int NULL NULL NULL NULL int(11)
1.0000 test tb1 f1 char 1 1 latin1 latin1_swedish_ci char(1)
1.0000 test tb1 f2 char 1 1 latin1 latin1_bin char(1)
1.0000 test tb1 f3 char 1 1 latin1 latin1_swedish_ci char(1)
2.0079 test tb1 f4 tinytext 127 255 ucs2 ucs2_general_ci tinytext
1.0000 test tb1 f4 tinytext 255 255 latin1 latin1_swedish_ci tinytext
1.0000 test tb1 f5 text 65535 65535 latin1 latin1_swedish_ci text
1.0000 test tb1 f6 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext
1.0000 test tb1 f7 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext
......@@ -1016,7 +1013,7 @@ NULL test tb2 f107 year NULL NULL NULL NULL year(4)
1.0000 test tb3 f121 tinytext 255 255 latin1 latin1_swedish_ci tinytext
1.0000 test tb3 f122 text 65535 65535 latin1 latin1_swedish_ci text
1.0000 test tb3 f123 mediumtext 16777215 16777215 latin1 latin1_swedish_ci mediumtext
2.0000 test tb3 f124 longtext 2147483647 4294967295 ucs2 ucs2_general_ci longtext
1.0000 test tb3 f124 longtext 4294967295 4294967295 latin1 latin1_swedish_ci longtext
1.0000 test tb3 f125 tinyblob 255 255 NULL NULL tinyblob
1.0000 test tb3 f126 blob 65535 65535 NULL NULL blob
1.0000 test tb3 f127 mediumblob 16777215 16777215 NULL NULL mediumblob
......@@ -1127,13 +1124,13 @@ NULL test tb4 f224 year NULL NULL NULL NULL year(4)
1.0000 test tb4 f232 varbinary 27 27 NULL NULL varbinary(27)
1.0000 test tb4 f233 varbinary 64 64 NULL NULL varbinary(64)
1.0000 test tb4 f234 varbinary 192 192 NULL NULL varbinary(192)
2.0000 test tb4 f235 char 255 510 ucs2 ucs2_general_ci char(255)
1.0000 test tb4 f235 char 255 255 latin1 latin1_swedish_ci char(255)
1.0000 test tb4 f236 char 60 60 latin1 latin1_swedish_ci char(60)
1.0000 test tb4 f237 char 255 255 latin1 latin1_bin char(255)
NULL test tb4 f238 varchar 0 0 latin1 latin1_bin varchar(0)
1.0000 test tb4 f239 varbinary 1000 1000 NULL NULL varbinary(1000)
2.0000 test tb4 f240 varchar 120 240 ucs2 ucs2_general_ci varchar(120)
2.0000 test tb4 f241 char 100 200 ucs2 ucs2_general_ci char(100)
1.0000 test tb4 f240 varchar 120 120 latin1 latin1_swedish_ci varchar(120)
1.0000 test tb4 f241 char 100 100 latin1 latin1_swedish_ci char(100)
NULL test tb4 f242 bit NULL NULL NULL NULL bit(30)
NULL test1 tb2 f59 decimal NULL NULL NULL NULL decimal(10,0) unsigned
NULL test1 tb2 f60 decimal NULL NULL NULL NULL decimal(64,0) unsigned
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
SHOW TABLES FROM information_schema LIKE 'SCHEMATA';
Tables_in_information_schema (SCHEMATA)
SCHEMATA
#######################################################################
# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
#######################################################################
DROP VIEW IF EXISTS test.v1;
DROP PROCEDURE IF EXISTS test.p1;
DROP FUNCTION IF EXISTS test.f1;
CREATE VIEW test.v1 AS SELECT * FROM information_schema.SCHEMATA;
CREATE PROCEDURE test.p1() SELECT * FROM information_schema.SCHEMATA;
CREATE FUNCTION test.f1() returns BIGINT
BEGIN
DECLARE counter BIGINT DEFAULT NULL;
SELECT COUNT(*) INTO counter FROM information_schema.SCHEMATA;
RETURN counter;
END//
# Attention: The printing of the next result sets is disabled.
SELECT * FROM information_schema.SCHEMATA;
SELECT * FROM test.v1;
CALL test.p1;
SELECT test.f1();
DROP VIEW test.v1;
DROP PROCEDURE test.p1;
DROP FUNCTION test.f1;
#########################################################################
# Testcase 3.2.9.1: INFORMATION_SCHEMA.SCHEMATA layout;
#########################################################################
DESCRIBE information_schema.SCHEMATA;
Field Type Null Key Default Extra
CATALOG_NAME varchar(512) YES NULL
SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(64) NO
DEFAULT_COLLATION_NAME varchar(64) NO
SQL_PATH varchar(512) YES NULL
SHOW CREATE TABLE information_schema.SCHEMATA;
Table Create Table
SCHEMATA CREATE TEMPORARY TABLE `SCHEMATA` (
`CATALOG_NAME` varchar(512) default NULL,
`SCHEMA_NAME` varchar(64) NOT NULL default '',
`DEFAULT_CHARACTER_SET_NAME` varchar(64) NOT NULL default '',
`DEFAULT_COLLATION_NAME` varchar(64) NOT NULL default '',
`SQL_PATH` varchar(512) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.SCHEMATA;
Field Type Null Key Default Extra
CATALOG_NAME varchar(512) YES NULL
SCHEMA_NAME varchar(64) NO
DEFAULT_CHARACTER_SET_NAME varchar(64) NO
DEFAULT_COLLATION_NAME varchar(64) NO
SQL_PATH varchar(512) YES NULL
SELECT catalog_name, schema_name, sql_path
FROM information_schema.schemata
WHERE catalog_name IS NOT NULL or sql_path IS NOT NULL;
catalog_name schema_name sql_path
###############################################################################
# Testcases 3.2.9.2+3.2.9.3: INFORMATION_SCHEMA.SCHEMATA accessible information
###############################################################################
DROP DATABASE IF EXISTS db_datadict_1;
DROP DATABASE IF EXISTS db_datadict_2;
CREATE DATABASE db_datadict_1;
CREATE DATABASE db_datadict_2;
DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
CREATE USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
CREATE USER 'testuser3'@'localhost';
GRANT SELECT ON db_datadict_1.* to 'testuser1'@'localhost';
GRANT SELECT ON db_datadict_1.* to 'testuser2'@'localhost';
GRANT SELECT ON db_datadict_2.* to 'testuser2'@'localhost';
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
# Establish connection testuser1 (user=testuser1)
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
# Establish connection testuser2 (user=testuser2)
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
# Establish connection testuser3 (user=testuser3)
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL db_datadict_1 latin1 latin1_swedish_ci NULL
NULL db_datadict_2 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
# Switch to connection default and close connections testuser1,testuser2,testuser3
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
DROP DATABASE db_datadict_1;
DROP DATABASE db_datadict_2;
#################################################################################
# Testcases 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.SCHEMATA modifications
#################################################################################
DROP DATABASE IF EXISTS db_datadict;
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
SELECT * FROM information_schema.schemata WHERE schema_name = 'db_datadict';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL db_datadict latin1 latin1_swedish_ci NULL
SELECT schema_name, default_character_set_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name default_character_set_name
db_datadict latin1
ALTER SCHEMA db_datadict CHARACTER SET 'utf8';
SELECT schema_name, default_character_set_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name default_character_set_name
db_datadict utf8
ALTER SCHEMA db_datadict CHARACTER SET 'latin1';
SELECT schema_name, default_collation_name FROM information_schema.schemata
WHERE schema_name = 'db_datadict';
schema_name default_collation_name
db_datadict latin1_swedish_ci
ALTER SCHEMA db_datadict COLLATE 'latin1_general_cs';
SELECT schema_name, default_collation_name FROM information_schema.schemata
WHERE schema_name = 'db_datadict';
schema_name default_collation_name
db_datadict latin1_general_cs
SELECT schema_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name
db_datadict
DROP DATABASE db_datadict;
SELECT schema_name
FROM information_schema.schemata WHERE schema_name = 'db_datadict';
schema_name
########################################################################
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
# DDL on INFORMATION_SCHEMA tables are not supported
########################################################################
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';
INSERT INTO information_schema.schemata
(catalog_name, schema_name, default_character_set_name, sql_path)
VALUES (NULL, 'db1', 'latin1', NULL);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
INSERT INTO information_schema.schemata
SELECT * FROM information_schema.schemata;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
UPDATE information_schema.schemata
SET default_character_set_name = 'utf8'
WHERE schema_name = 'db_datadict';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
UPDATE information_schema.schemata SET catalog_name = 't_4711';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DELETE FROM information_schema.schemata WHERE schema_name = 'db_datadict';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
TRUNCATE information_schema.schemata;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE INDEX i1 ON information_schema.schemata(schema_name);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
ALTER TABLE information_schema.schemata ADD f1 INT;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE information_schema.schemata;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
ALTER TABLE information_schema.schemata RENAME db_datadict.schemata;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
ALTER TABLE information_schema.schemata RENAME information_schema.xschemata;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP DATABASE db_datadict;
This diff is collapsed.
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON db_datadict.* TO testuser1@localhost;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
NULL mysql PRIMARY mysql columns_priv PRIMARY KEY
NULL mysql PRIMARY mysql db PRIMARY KEY
NULL mysql PRIMARY mysql func PRIMARY KEY
NULL mysql name mysql help_category UNIQUE
NULL mysql PRIMARY mysql help_category PRIMARY KEY
NULL mysql name mysql help_keyword UNIQUE
NULL mysql PRIMARY mysql help_keyword PRIMARY KEY
NULL mysql PRIMARY mysql help_relation PRIMARY KEY
NULL mysql name mysql help_topic UNIQUE
NULL mysql PRIMARY mysql help_topic PRIMARY KEY
NULL mysql PRIMARY mysql host PRIMARY KEY
NULL mysql PRIMARY mysql proc PRIMARY KEY
NULL mysql PRIMARY mysql procs_priv PRIMARY KEY
NULL mysql PRIMARY mysql tables_priv PRIMARY KEY
NULL mysql PRIMARY mysql time_zone PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_name PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_transition PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
NULL mysql PRIMARY mysql user PRIMARY KEY
# Establish connection testuser1 (user=testuser1)
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
NULL mysql PRIMARY mysql columns_priv PRIMARY KEY
NULL mysql PRIMARY mysql db PRIMARY KEY
NULL mysql PRIMARY mysql func PRIMARY KEY
NULL mysql name mysql help_category UNIQUE
NULL mysql PRIMARY mysql help_category PRIMARY KEY
NULL mysql name mysql help_keyword UNIQUE
NULL mysql PRIMARY mysql help_keyword PRIMARY KEY
NULL mysql PRIMARY mysql help_relation PRIMARY KEY
NULL mysql name mysql help_topic UNIQUE
NULL mysql PRIMARY mysql help_topic PRIMARY KEY
NULL mysql PRIMARY mysql host PRIMARY KEY
NULL mysql PRIMARY mysql proc PRIMARY KEY
NULL mysql PRIMARY mysql procs_priv PRIMARY KEY
NULL mysql PRIMARY mysql tables_priv PRIMARY KEY
NULL mysql PRIMARY mysql time_zone PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_name PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_transition PRIMARY KEY
NULL mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
NULL mysql PRIMARY mysql user PRIMARY KEY
# Switch to connection default and close connection testuser1
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
This diff is collapsed.
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
DROP DATABASE IF EXISTS test1;
CREATE DATABASE test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0
......@@ -383,7 +383,7 @@ user_comment
Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON db_datadict.* TO testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
# Establish connection testuser1 (user=testuser1)
SELECT *,
LEFT( table_comment,
......@@ -768,4 +768,4 @@ user_comment
Separator -----------------------------------------------------
# Switch to connection default and close connection testuser1
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
DROP DATABASE test1;
This diff is collapsed.
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
DROP DATABASE IF EXISTS test1;
CREATE DATABASE test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0
......@@ -405,7 +405,7 @@ user_comment Users and global privileges
Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON db_datadict.* TO testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
# Establish connection testuser1 (user=testuser1)
SELECT *,
LEFT( table_comment,
......@@ -421,4 +421,4 @@ WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name;
# Switch to connection default and close connection testuser1
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
DROP DATABASE test1;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment