~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to tests/r/create.result

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
Merge from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
create temporary table t1 (ordid int not null auto_increment, ord  varchar(50) not null, primary key (ord,ordid)) engine=MEMORY;
37
37
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
38
38
create table not_existing_database.test (a int);
39
 
ERROR 42000: Unknown database 'not_existing_database'
 
39
ERROR HY000: Can't create table 'not_existing_database.test' (errno: 2)
40
40
create table `a/a` (a int);
41
41
show create table `a/a`;
42
42
Table   Create Table
107
107
create table t1(x varchar(50) );
108
108
create table t2 select x from t1 where 1=2;
109
109
describe t1;
110
 
Field   Type    Null    Key     Default Extra
111
 
x       varchar(50)     YES             NULL    
 
110
Field   Type    Null    Default Default_is_NULL On_Update
 
111
x       VARCHAR TRUE            TRUE    
112
112
describe t2;
113
 
Field   Type    Null    Key     Default Extra
114
 
x       varchar(50)     YES             NULL    
 
113
Field   Type    Null    Default Default_is_NULL On_Update
 
114
x       VARCHAR TRUE            TRUE    
115
115
drop table t2;
116
116
create table t2 select now() as a , curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
117
117
describe t2;
118
 
Field   Type    Null    Key     Default Extra
119
 
a       datetime        YES             NULL    
120
 
c       date    NO              NULL    
121
 
d       int     NO              NULL    
122
 
e       decimal(3,1)    NO              NULL    
123
 
f       bigint  NO              NULL    
 
118
Field   Type    Null    Default Default_is_NULL On_Update
 
119
a       DATETIME        TRUE            TRUE    
 
120
c       DATE    FALSE           FALSE   
 
121
d       INTEGER FALSE           FALSE   
 
122
e       DECIMAL FALSE           FALSE   
 
123
f       BIGINT  FALSE           FALSE   
124
124
drop table t2;
125
125
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("2001-12-29  20:45:11" AS DATETIME) as dt;
126
126
describe t2;
127
 
Field   Type    Null    Key     Default Extra
128
 
d       date    YES             NULL    
129
 
dt      datetime        YES             NULL    
 
127
Field   Type    Null    Default Default_is_NULL On_Update
 
128
d       DATE    TRUE            TRUE    
 
129
dt      DATETIME        TRUE            TRUE    
130
130
drop table t1,t2;
131
131
create table t1 (a int);
132
132
create table t2 (a int) select * from t1;
133
133
describe t1;
134
 
Field   Type    Null    Key     Default Extra
135
 
a       int     YES             NULL    
 
134
Field   Type    Null    Default Default_is_NULL On_Update
 
135
a       INTEGER TRUE            TRUE    
136
136
describe t2;
137
 
Field   Type    Null    Key     Default Extra
138
 
a       int     YES             NULL    
 
137
Field   Type    Null    Default Default_is_NULL On_Update
 
138
a       INTEGER TRUE            TRUE    
139
139
drop table if exists t2;
140
140
create table t2 (a int, a float) select * from t1;
141
141
ERROR 42S21: Duplicate column name 'a'
272
272
Error   1062    Duplicate entry '3' for key 'PRIMARY'
273
273
show status like "Opened_tables";
274
274
Variable_name   Value
275
 
Opened_tables   2
 
275
Opened_tables   #
276
276
select * from t1;
277
277
a       b
278
278
1       1
353
353
select * from t2;
354
354
id      name
355
355
create table t3 like t1;
 
356
ERROR 42S01: Table 't3' already exists
356
357
create table t3 like mysqltest.t3;
357
358
ERROR 42S01: Table 't3' already exists
358
359
create table non_existing_database.t1 like t1;
359
 
ERROR 42000: Unknown database 'non_existing_database'
 
360
ERROR HY000: Can't create table 'non_existing_database.t1' (errno: 2)
360
361
create table t3 like non_existing_table;
361
362
ERROR 42S02: Table 'test.non_existing_table' doesn't exist
362
363
create temporary table t3 like t1;
363
364
ERROR 42S01: Table 't3' already exists
364
365
drop table t1, t2, t3;
365
 
drop table t3;
366
366
drop database mysqltest;
367
367
SET SESSION storage_engine="MEMORY";
368
368
SELECT @@storage_engine;
418
418
ifnull(h,cast('yet another binary data' as binary))   as h
419
419
from t1;
420
420
explain t2;
421
 
Field   Type    Null    Key     Default Extra
422
 
a       int     YES             NULL    
423
 
b       bigint  NO              NULL    
424
 
c       bigint  NO              NULL    
425
 
d       date    YES             NULL    
426
 
e       varchar(1)      YES             NULL    
427
 
f       datetime        YES             NULL    
428
 
h       blob    YES             NULL    
 
421
Field   Type    Null    Default Default_is_NULL On_Update
 
422
a       INTEGER TRUE            TRUE    
 
423
b       BIGINT  FALSE           FALSE   
 
424
c       BIGINT  FALSE           FALSE   
 
425
d       DATE    TRUE            TRUE    
 
426
e       VARCHAR TRUE            TRUE    
 
427
f       DATETIME        TRUE            TRUE    
 
428
h       BLOB    TRUE            TRUE    
429
429
select * from t2;
430
430
a       b       c       d       e       f       h
431
431
1       -7      7       2000-01-01      b       2000-01-01 00:00:00     yet another binary data
453
453
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
454
454
insert into t1 values ('','',0,0.0);
455
455
describe t1;
456
 
Field   Type    Null    Key     Default Extra
457
 
str     varchar(10)     YES             def     
458
 
strnull varchar(10)     YES             NULL    
459
 
intg    int     YES             10      
460
 
rel     double  YES             3.14    
 
456
Field   Type    Null    Default Default_is_NULL On_Update
 
457
str     VARCHAR TRUE    def     FALSE   
 
458
strnull VARCHAR TRUE    def     TRUE    
 
459
intg    INTEGER TRUE    10      FALSE   
 
460
rel     DOUBLE  TRUE    3.14    FALSE   
461
461
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
462
462
describe t2;
463
 
Field   Type    Null    Key     Default Extra
464
 
str     varchar(10)     YES             NULL    
465
 
strnull varchar(10)     YES             NULL    
466
 
intg    int     YES             NULL    
467
 
rel     double  YES             NULL    
 
463
Field   Type    Null    Default Default_is_NULL On_Update
 
464
str     VARCHAR TRUE            TRUE    
 
465
strnull VARCHAR TRUE            TRUE    
 
466
intg    INTEGER TRUE            TRUE    
 
467
rel     DOUBLE  TRUE            TRUE    
468
468
drop table t1, t2;
469
469
create table t1(name varchar(10), age int default -1);
470
470
describe t1;
471
 
Field   Type    Null    Key     Default Extra
472
 
name    varchar(10)     YES             NULL    
473
 
age     int     YES             -1      
 
471
Field   Type    Null    Default Default_is_NULL On_Update
 
472
name    VARCHAR TRUE            TRUE    
 
473
age     INTEGER TRUE    -1      FALSE   
474
474
create table t2(name varchar(10), age int default - 1);
475
475
describe t2;
476
 
Field   Type    Null    Key     Default Extra
477
 
name    varchar(10)     YES             NULL    
478
 
age     int     YES             -1      
 
476
Field   Type    Null    Default Default_is_NULL On_Update
 
477
name    VARCHAR TRUE            TRUE    
 
478
age     INTEGER TRUE    -1      FALSE   
479
479
drop table t1, t2;
480
480
create table t1(cenum enum('a'));
481
481
create table t2(cenum enum('a','a'));
522
522
CREATE TABLE t1 (f1 VARCHAR(255));
523
523
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
524
524
DESC t2;
525
 
Field   Type    Null    Key     Default Extra
526
 
f2      varchar(171)    YES             NULL    
 
525
Field   Type    Null    Default Default_is_NULL On_Update
 
526
f2      VARCHAR TRUE            TRUE    
527
527
DROP TABLE t1,t2;
528
528
CREATE TABLE t12913 (f1 ENUM ('a','b')) AS SELECT 'a' AS f1;
529
529
SELECT * FROM t12913;
539
539
create database mysqltest;
540
540
create database if not exists mysqltest;
541
541
Warnings:
542
 
Note    1007    Can't create database './mysqltest'; database exists
 
542
Note    1007    Can't create database 'mysqltest'; database exists
543
543
show create database mysqltest;
544
544
Database        Create Database
545
 
mysqltest       CREATE DATABASE `mysqltest`
 
545
mysqltest       CREATE DATABASE `mysqltest` COLLATE = utf8_general_ci
546
546
drop database mysqltest;
547
547
use test;
548
548
create table t1 (a int);
1355
1355
Handler_read_next       0
1356
1356
Handler_read_prev       0
1357
1357
Handler_read_rnd        0
1358
 
Handler_read_rnd_next   7
 
1358
Handler_read_rnd_next   13
1359
1359
drop table t1,t2;
1360
1360
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
1361
1361
DROP TABLE t1;
1362
1362
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
1363
1363
DROP TABLE t1;
1364
1364
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
1365
 
SHOW INDEX FROM t1;
1366
 
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
1367
 
t1      1       c1      1       c1      NULL    0       NULL    NULL    YES     HASH            
1368
1365
DROP TABLE t1;
1369
1366
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
1370
 
SHOW INDEX FROM t1;
1371
 
Table   Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality     Sub_part        Packed  Null    Index_type      Comment Index_Comment
1372
 
t1      1       c1      1       c1      A       NULL    NULL    NULL    YES     BTREE           
1373
1367
DROP TABLE t1;
1374
1368
End of 5.0 tests
1375
1369
CREATE TABLE t1 (a int, b int);
1425
1419
table_schema='test';
1426
1420
TABLE_NAME
1427
1421
имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
1428
 
select COLUMN_NAME from information_schema.old_columns where
 
1422
select COLUMN_NAME from data_dictionary.columns where
1429
1423
table_schema='test';
1430
1424
COLUMN_NAME
1431
1425
имя_поля_в_кодировке_утф8_длиной_больше_чем_45