mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
2901c3b8fa
Use server character set if --default-character-set is not used Added convert_string() for more efficient alloc+character-set convert of strings BitKeeper/deleted/.del-convert.result~a3b56e1db6f498e9: Delete: mysql-test/r/convert.result BitKeeper/deleted/.del-convert.test~f4ceb743194dfe72: Delete: mysql-test/t/convert.test BitKeeper/deleted/.del-make_win_src_distribution.old~5c9ebdc4a852b43b: Delete: scripts/make_win_src_distribution.old client/mysql.cc: Use server character set if --default-character-set is not used client/mysqltest.c: Code cleanup (merge identical code) More debug messages heap/hp_create.c: After merge fix include/m_ctype.h: After merge fix include/my_global.h: Remove size_str (we already have size_s) include/mysql_com.h: After merge fix libmysql/libmysql.c: After merge fix libmysqld/Makefile.am: After merge fix mysql-test/r/auto_increment.result: After merge fix mysql-test/r/create.result: After merge fix mysql-test/r/ctype_latin1_de.result: After merge fix mysql-test/r/distinct.result: After merge fix mysql-test/r/drop.result: After merge fix mysql-test/r/fulltext.result: After merge fix mysql-test/r/func_gconcat.result: After merge fix mysql-test/r/func_str.result: After merge fix mysql-test/r/func_test.result: After merge fix mysql-test/r/grant.result: After merge fix mysql-test/r/group_by.result: After merge fix mysql-test/r/handler.result: After merge fix mysql-test/r/heap.result: After merge fix mysql-test/r/heap_btree.result: After merge fix mysql-test/r/heap_hash.result: After merge fix mysql-test/r/innodb.result: After merge fix mysql-test/r/insert.result: After merge fix mysql-test/r/insert_select.result: After merge fix mysql-test/r/join_outer.result: After merge fix mysql-test/r/key.result: After merge fix mysql-test/r/key_cache.result: After merge fix mysql-test/r/loaddata.result: After merge fix mysql-test/r/myisam.result: After merge fix mysql-test/r/null.result: After merge fix mysql-test/r/null_key.result: After merge fix mysql-test/r/order_by.result: After merge fix mysql-test/r/rpl_do_grant.result: After merge fix mysql-test/r/rpl_error_ignored_table.result: After merge fix mysql-test/r/rpl_ignore_grant.result: After merge fix mysql-test/r/rpl_loaddata.result: After merge fix mysql-test/r/rpl_log.result: After merge fix mysql-test/r/rpl_log_pos.result: After merge fix mysql-test/r/rpl_max_relay_size.result: After merge fix mysql-test/r/rpl_replicate_do.result: After merge fix mysql-test/r/rpl_reset_slave.result: After merge fix mysql-test/r/rpl_rotate_logs.result: After merge fix mysql-test/r/rpl_user_variables.result: After merge fix mysql-test/r/select.result: After merge fix mysql-test/r/select_safe.result: After merge fix mysql-test/r/subselect.result: After merge fix mysql-test/r/type_blob.result: After merge fix mysql-test/r/type_decimal.result: After merge fix mysql-test/r/type_float.result: After merge fix mysql-test/r/type_ranges.result: After merge fix mysql-test/r/type_time.result: After merge fix mysql-test/r/type_uint.result: After merge fix mysql-test/r/union.result: After merge fix mysql-test/r/warnings.result: After merge fix mysql-test/t/auto_increment.test: After merge fix mysql-test/t/case.test: After merge fix mysql-test/t/ctype_collate.test: After merge fix mysql-test/t/ctype_latin1_de.test: After merge fix mysql-test/t/drop.test: After merge fix mysql-test/t/func_in.test: After merge fix mysql-test/t/func_set.test: After merge fix mysql-test/t/func_str.test: After merge fix mysql-test/t/func_test.test: After merge fix mysql-test/t/grant.test: After merge fix mysql-test/t/group_by.test: After merge fix mysql-test/t/handler.test: After merge fix mysql-test/t/heap.test: After merge fix mysql-test/t/heap_btree.test: After merge fix mysql-test/t/heap_hash.test: After merge fix mysql-test/t/innodb.test: After merge fix mysql-test/t/insert_select.test: After merge fix mysql-test/t/key.test: After merge fix mysql-test/t/key_cache.test: After merge fix mysql-test/t/lock_tables_lost_commit-master.opt: After merge fix mysql-test/t/lock_tables_lost_commit.test: After merge fix mysql-test/t/myisam.test: After merge fix mysql-test/t/row.test: After merge fix mysql-test/t/subselect.test: After merge fix mysql-test/t/type_decimal.test: After merge fix mysql-test/t/type_ranges.test: After merge fix mysql-test/t/type_uint.test: After merge fix mysql-test/t/variables.test: After merge fix mysql-test/t/warnings.test: After merge fix scripts/make_win_src_distribution.sh: after merge fixes sql-common/client.c: After merge fix Change my_connect() to use poll() If character set is not given, use servers character set. sql/field.cc: After merge fix Don't give warnings when storing data in fields in optimizer. sql/ha_myisammrg.h: After merge fix sql/log.cc: After merge fix sql/log_event.cc: After merge fix sql/mysqld.cc: After merge fix sql/opt_range.cc: After merge fix sql/set_var.cc: Code cleanup Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps sql/set_var.h: Fixed wrong usage of base_names (like medium.key_buffer) that caused core dumps sql/slave.cc: After merge fix sql/sql_acl.cc: After merge fix Code cleanup sql/sql_class.cc: Added convert_string() for more efficient alloc+character-set convert of strings Add cached flags to avoid calling mysql_charset_same() during parsing. sql/sql_class.h: Added convert_string() for more efficient alloc+character-set convert of strings Add cached flags to avoid calling mysql_charset_same() during parsing. sql/sql_handler.cc: After merge fix sql/sql_lex.h: After merge fix sql/sql_parse.cc: Optimize and fix memory reference errors reported by valgrind sql/sql_repl.cc: After merge fix sql/sql_yacc.yy: After merge fix Avoid calling mysql_charset_same() when parsing identifiers strings/ctype-latin1.c: Port latin_de conversion code from 4.0
314 lines
9.4 KiB
Text
314 lines
9.4 KiB
Text
drop table if exists t1,t2,t3;
|
|
create table t1 (b char(0));
|
|
insert into t1 values (""),(null);
|
|
select * from t1;
|
|
b
|
|
|
|
NULL
|
|
drop table if exists t1;
|
|
create table t1 (b char(0) not null);
|
|
create table if not exists t1 (b char(0) not null);
|
|
insert into t1 values (""),(null);
|
|
Warnings:
|
|
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2
|
|
select * from t1;
|
|
b
|
|
|
|
|
|
drop table t1;
|
|
create table t2 type=heap select * from t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
|
create table t2 select auto+1 from t1;
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
|
drop table if exists t1,t2;
|
|
Warnings:
|
|
Note 1051 Unknown table 't1'
|
|
Note 1051 Unknown table 't2'
|
|
create table t1 (b char(0) not null, index(b));
|
|
ERROR 42000: The used storage engine can't index column 'b'
|
|
create table t1 (a int not null auto_increment,primary key (a)) type=heap;
|
|
create table t1 (a int not null,b text) type=heap;
|
|
ERROR 42000: The used table type doesn't support BLOB/TEXT columns
|
|
drop table if exists t1;
|
|
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
|
|
ERROR 42000: Incorrect table definition; There can only be one auto column and it must be defined as a key
|
|
create table not_existing_database.test (a int);
|
|
Got one of the listed errors
|
|
create table `a/a` (a int);
|
|
ERROR 42000: Incorrect table name 'a/a'
|
|
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
|
|
ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
|
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
|
|
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
|
|
create table 1ea10 (1a20 int,1e int);
|
|
insert into 1ea10 values(1,1);
|
|
select 1ea10.1a20,1e+ 1e+10 from 1ea10;
|
|
1a20 1e+ 1e+10
|
|
1 10000000001
|
|
drop table 1ea10;
|
|
create table t1 (t1.index int);
|
|
drop table t1;
|
|
drop database if exists test_$1;
|
|
Warnings:
|
|
Note 1008 Can't drop database 'test_$1'; database doesn't exist
|
|
create database test_$1;
|
|
create table test_$1.$test1 (a$1 int, $b int, c$ int);
|
|
insert into test_$1.$test1 values (1,2,3);
|
|
select a$1, $b, c$ from test_$1.$test1;
|
|
a$1 $b c$
|
|
1 2 3
|
|
create table test_$1.test2$ (a int);
|
|
drop table test_$1.test2$;
|
|
drop database test_$1;
|
|
create table `` (a int);
|
|
ERROR 42000: Incorrect table name ''
|
|
drop table if exists ``;
|
|
ERROR 42000: Incorrect table name ''
|
|
create table t1 (`` int);
|
|
ERROR 42000: Incorrect column name ''
|
|
drop table if exists t1;
|
|
Warnings:
|
|
Note 1051 Unknown table 't1'
|
|
create table t1 (a int auto_increment not null primary key, B CHAR(20));
|
|
insert into t1 (b) values ("hello"),("my"),("world");
|
|
create table t2 (key (b)) select * from t1;
|
|
explain select * from t2 where b="world";
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t2 ref B B 21 const 1 Using where
|
|
select * from t2 where b="world";
|
|
a B
|
|
3 world
|
|
drop table t1,t2;
|
|
create table t1(x varchar(50) );
|
|
create table t2 select x from t1 where 1=2;
|
|
describe t1;
|
|
Field Type Null Key Default Extra
|
|
x varchar(50) YES NULL
|
|
describe t2;
|
|
Field Type Null Key Default Extra
|
|
x char(50) YES NULL
|
|
drop table t2;
|
|
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
|
|
describe t2;
|
|
Field Type Null Key Default Extra
|
|
a datetime 0000-00-00 00:00:00
|
|
b time 00:00:00
|
|
c date 0000-00-00
|
|
d bigint(17) 0
|
|
e double(18,1) 0.0
|
|
f bigint(17) 0
|
|
drop table t2;
|
|
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
|
|
describe t2;
|
|
Field Type Null Key Default Extra
|
|
d date 0000-00-00
|
|
t time 00:00:00
|
|
dt datetime 0000-00-00 00:00:00
|
|
drop table t1,t2;
|
|
create table t1 (a tinyint);
|
|
create table t2 (a int) select * from t1;
|
|
describe t1;
|
|
Field Type Null Key Default Extra
|
|
a tinyint(4) YES NULL
|
|
describe t2;
|
|
Field Type Null Key Default Extra
|
|
a int(11) YES NULL
|
|
drop table if exists t2;
|
|
create table t2 (a int, a float) select * from t1;
|
|
ERROR 42S21: Duplicate column name 'a'
|
|
drop table if exists t2;
|
|
Warnings:
|
|
Note 1051 Unknown table 't2'
|
|
create table t2 (a int) select a as b, a+1 as b from t1;
|
|
ERROR 42S21: Duplicate column name 'b'
|
|
drop table if exists t2;
|
|
Warnings:
|
|
Note 1051 Unknown table 't2'
|
|
create table t2 (b int) select a as b, a+1 as b from t1;
|
|
ERROR 42S21: Duplicate column name 'b'
|
|
drop table if exists t1,t2;
|
|
Warnings:
|
|
Note 1051 Unknown table 't2'
|
|
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0',
|
|
`b` int(11) default NULL,
|
|
PRIMARY KEY (`a`),
|
|
KEY `b` (`b`),
|
|
KEY `b_2` (`b`),
|
|
KEY `b_3` (`b`),
|
|
KEY `b_4` (`b`),
|
|
KEY `b_5` (`b`),
|
|
KEY `b_6` (`b`),
|
|
KEY `b_7` (`b`),
|
|
KEY `b_8` (`b`),
|
|
KEY `b_9` (`b`),
|
|
KEY `b_10` (`b`),
|
|
KEY `b_11` (`b`),
|
|
KEY `b_12` (`b`),
|
|
KEY `b_13` (`b`),
|
|
KEY `b_14` (`b`),
|
|
KEY `b_15` (`b`),
|
|
KEY `b_16` (`b`),
|
|
KEY `b_17` (`b`),
|
|
KEY `b_18` (`b`),
|
|
KEY `b_19` (`b`),
|
|
KEY `b_20` (`b`),
|
|
KEY `b_21` (`b`),
|
|
KEY `b_22` (`b`),
|
|
KEY `b_23` (`b`),
|
|
KEY `b_24` (`b`),
|
|
KEY `b_25` (`b`),
|
|
KEY `b_26` (`b`),
|
|
KEY `b_27` (`b`),
|
|
KEY `b_28` (`b`),
|
|
KEY `b_29` (`b`),
|
|
KEY `b_30` (`b`),
|
|
KEY `b_31` (`b`)
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
drop table t1;
|
|
create table t1 select if(1,'1','0'), month("2002-08-02");
|
|
drop table t1;
|
|
create table t1 select if('2002'='2002','Y','N');
|
|
select * from t1;
|
|
if('2002'='2002','Y','N')
|
|
Y
|
|
drop table if exists t1;
|
|
SET SESSION table_type="heap";
|
|
SELECT @@table_type;
|
|
@@table_type
|
|
HEAP
|
|
CREATE TABLE t1 (a int not null);
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=HEAP CHARSET=latin1
|
|
drop table t1;
|
|
SET SESSION table_type="gemini";
|
|
SELECT @@table_type;
|
|
@@table_type
|
|
GEMINI
|
|
CREATE TABLE t1 (a int not null);
|
|
Warnings:
|
|
Warning 1265 Using storage engine MYISAM for table 't1'
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
SET SESSION table_type=default;
|
|
drop table t1;
|
|
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
|
|
insert into t1 values ("a", 1), ("b", 2);
|
|
insert into t1 values ("c", NULL);
|
|
ERROR 23000: Column 'k2' cannot be null
|
|
insert into t1 values (NULL, 3);
|
|
ERROR 23000: Column 'k1' cannot be null
|
|
insert into t1 values (NULL, NULL);
|
|
ERROR 23000: Column 'k1' cannot be null
|
|
drop table t1;
|
|
create table t1 (a int, key(a));
|
|
create table t2 (b int, foreign key(b) references t1(a), key(b));
|
|
drop table if exists t1,t2;
|
|
create table t1(id int not null, name char(20));
|
|
insert into t1 values(10,'mysql'),(20,'monty- the creator');
|
|
create table t2(id int not null);
|
|
insert into t2 values(10),(20);
|
|
create table t3 like t1;
|
|
show create table t3;
|
|
Table Create Table
|
|
t3 CREATE TABLE `t3` (
|
|
`id` int(11) NOT NULL default '0',
|
|
`name` char(20) default NULL
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
select * from t3;
|
|
id name
|
|
create table if not exists t3 like t1;
|
|
Warnings:
|
|
Warning 1050 Table 't3' already exists
|
|
select @@warning_count;
|
|
@@warning_count
|
|
1
|
|
create temporary table t3 like t2;
|
|
show create table t3;
|
|
Table Create Table
|
|
t3 CREATE TEMPORARY TABLE `t3` (
|
|
`id` int(11) NOT NULL default '0'
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
select * from t3;
|
|
id
|
|
drop table t3;
|
|
show create table t3;
|
|
Table Create Table
|
|
t3 CREATE TABLE `t3` (
|
|
`id` int(11) NOT NULL default '0',
|
|
`name` char(20) default NULL
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
select * from t3;
|
|
id name
|
|
drop table t2, t3;
|
|
drop database if exists test_$1;
|
|
Warnings:
|
|
Note 1008 Can't drop database 'test_$1'; database doesn't exist
|
|
create database test_$1;
|
|
create table test_$1.t3 like t1;
|
|
create temporary table t3 like test_$1.t3;
|
|
show create table t3;
|
|
Table Create Table
|
|
t3 CREATE TEMPORARY TABLE `t3` (
|
|
`id` int(11) NOT NULL default '0',
|
|
`name` char(20) default NULL
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
create table t2 like t3;
|
|
show create table t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`id` int(11) NOT NULL default '0',
|
|
`name` char(20) default NULL
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
select * from t2;
|
|
id name
|
|
create table t3 like t1;
|
|
create table t3 like test_$1.t3;
|
|
ERROR 42S01: Table 't3' already exists
|
|
create table non_existing_database.t1 like t1;
|
|
Got one of the listed errors
|
|
create table t3 like non_existing_table;
|
|
ERROR 42S02: Unknown table 'non_existing_table'
|
|
create temporary table t3 like t1;
|
|
ERROR 42S01: Table 't3' already exists
|
|
create table t3 like `a/a`;
|
|
ERROR 42000: Incorrect table name 'a/a'
|
|
drop table t1, t2, t3;
|
|
drop table t3;
|
|
drop database test_$1;
|
|
SET SESSION table_type="heap";
|
|
SELECT @@table_type;
|
|
@@table_type
|
|
HEAP
|
|
CREATE TABLE t1 (a int not null);
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=HEAP CHARSET=latin1
|
|
drop table t1;
|
|
SET SESSION table_type="gemini";
|
|
SELECT @@table_type;
|
|
@@table_type
|
|
GEMINI
|
|
CREATE TABLE t1 (a int not null);
|
|
Warnings:
|
|
Warning 1265 Using storage engine MYISAM for table 't1'
|
|
show create table t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL default '0'
|
|
) TYPE=MyISAM CHARSET=latin1
|
|
SET SESSION table_type=default;
|
|
drop table t1;
|
|
create table t1 select x'4132';
|
|
drop table t1;
|