~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/create.result

  • Committer: Brian Aker
  • Date: 2009-03-01 03:29:52 UTC
  • mfrom: (907.1.6 trunk-with-temporal)
  • Revision ID: brian@tangent.org-20090301032952-y210opnqxsfyhcla
Merge Jay's temporal

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
Field   Type    Null    Key     Default Extra
114
114
x       varchar(50)     YES             NULL    
115
115
drop table t2;
116
 
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;
 
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
118
Field   Type    Null    Key     Default Extra
119
119
a       datetime        YES             NULL    
120
 
b       time    YES             NULL    
121
120
c       date    NO              NULL    
122
121
d       int     NO              NULL    
123
122
e       decimal(3,1)    NO              NULL    
124
123
f       bigint  NO              NULL    
125
124
drop table t2;
126
 
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;
 
125
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("2001-12-29  20:45:11" AS DATETIME) as dt;
127
126
describe t2;
128
127
Field   Type    Null    Key     Default Extra
129
128
d       date    YES             NULL    
130
 
t       time    YES             NULL    
131
129
dt      datetime        YES             NULL    
132
130
drop table t1,t2;
133
131
create table t1 (a int);
248
246
drop table t1;
249
247
create table t1 select 1,2,3;
250
248
create table if not exists t1 select 1,2;
 
249
ERROR HY000: Field '1' doesn't have a default value
251
250
create table if not exists t1 select 1,2,3,4;
 
251
ERROR 21S01: Column count doesn't match value count at row 1
252
252
create table if not exists t1 select 1;
 
253
ERROR HY000: Field '1' doesn't have a default value
253
254
select * from t1;
254
255
1       2       3
255
256
1       2       3
387
388
) ENGINE=MEMORY
388
389
SET SESSION storage_engine=default;
389
390
drop table t1;
390
 
create table t1(a int,b int,c int,d date,e char,f datetime,g time,h blob);
 
391
create table t1(a int,b int,c int,d date,e char,f datetime,h blob);
391
392
insert into t1(a)values(1);
392
 
insert into t1(a,b,c,d,e,f,g,h)
393
 
values(2,-2,2,'1825-12-14','a','2003-01-01 03:02:01','4:3:2','binary data');
 
393
insert into t1(a,b,c,d,e,f,h)
 
394
values(2,-2,2,'1825-12-14','a','2003-01-01 03:02:01','binary data');
394
395
select * from t1;
395
 
a       b       c       d       e       f       g       h
396
 
1       NULL    NULL    NULL    NULL    NULL    NULL    NULL
397
 
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     04:03:02        binary data
 
396
a       b       c       d       e       f       h
 
397
1       NULL    NULL    NULL    NULL    NULL    NULL
 
398
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     binary data
398
399
select a, 
399
400
ifnull(b,-7) as b, 
400
401
ifnull(c,7) as c, 
401
402
ifnull(d,cast('2000-01-01' as date)) as d, 
402
403
ifnull(e,cast('b' as char)) as e,
403
404
ifnull(f,cast('2000-01-01' as datetime)) as f, 
404
 
ifnull(g,cast('5:4:3' as time)) as g,
405
 
ifnull(h,cast('yet another binary data' as binary)) as h,
406
 
addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd 
 
405
ifnull(h,cast('yet another binary data' as binary)) as h
407
406
from t1;
408
 
a       b       c       d       e       f       g       h       dd
409
 
1       -7      7       2000-01-01      b       2000-01-01 00:00:00     05:04:03        yet another binary data 02:00:00
410
 
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     04:03:02        binary data     02:00:00
 
407
a       b       c       d       e       f       h
 
408
1       -7      7       2000-01-01      b       2000-01-01 00:00:00     yet another binary data
 
409
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     binary data
411
410
create table t2
412
411
select
413
412
a, 
416
415
ifnull(d,cast('2000-01-01'              as date))     as d,
417
416
ifnull(e,cast('b'                       as char))     as e,
418
417
ifnull(f,cast('2000-01-01'              as datetime)) as f,
419
 
ifnull(g,cast('5:4:3'                   as time))     as g,
420
 
ifnull(h,cast('yet another binary data' as binary))   as h,
421
 
addtime(cast('1:0:0' as time),cast('1:0:0' as time))  as dd
 
418
ifnull(h,cast('yet another binary data' as binary))   as h
422
419
from t1;
423
420
explain t2;
424
421
Field   Type    Null    Key     Default Extra
428
425
d       date    YES             NULL    
429
426
e       varchar(1)      YES             NULL    
430
427
f       datetime        YES             NULL    
431
 
g       time    YES             NULL    
432
428
h       blob    YES             NULL    
433
 
dd      time    YES             NULL    
434
429
select * from t2;
435
 
a       b       c       d       e       f       g       h       dd
436
 
1       -7      7       2000-01-01      b       2000-01-01 00:00:00     05:04:03        yet another binary data 02:00:00
437
 
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     04:03:02        binary data     02:00:00
 
430
a       b       c       d       e       f       h
 
431
1       -7      7       2000-01-01      b       2000-01-01 00:00:00     yet another binary data
 
432
2       -2      2       1825-12-14      a       2003-01-01 03:02:01     binary data
438
433
drop table t1, t2;
439
434
create table t1 (a int, b int, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), j date, k timestamp, l datetime, m enum('a','b'), o char(10));
440
435
create table t2 select ifnull(a,a), ifnull(b,b), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(o,o) from t1;
449
444
  `ifnull(g,g)` double(4,3) DEFAULT NULL,
450
445
  `ifnull(h,h)` decimal(5,4) DEFAULT NULL,
451
446
  `ifnull(j,j)` date DEFAULT NULL,
452
 
  `ifnull(k,k)` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 
447
  `ifnull(k,k)` timestamp NULL DEFAULT NULL,
453
448
  `ifnull(l,l)` datetime DEFAULT NULL,
454
449
  `ifnull(m,m)` varchar(1) DEFAULT NULL,
455
450
  `ifnull(o,o)` varchar(10) DEFAULT NULL
511
506
drop table t1, t2, t3;
512
507
create table t1 (a int);
513
508
create table t1 select * from t1;
 
509
ERROR HY000: You can't specify target table 't1' for update in FROM clause
514
510
flush tables with read lock;
515
511
unlock tables;
516
512
drop table t1;
691
687
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
692
688
create table t1 (i int);
693
689
create table if not exists t1 select 1 as i;
 
690
Warnings:
 
691
Note    1050    Table 't1' already exists
694
692
select * from t1;
695
693
i
 
694
1
696
695
drop table t1;
697
696
create table t1 select coalesce('a' collate utf8_swedish_ci,'b' collate utf8_bin);
698
697
ERROR HY000: Illegal mix of collations (utf8_swedish_ci,EXPLICIT) and (utf8_bin,EXPLICIT) for operation 'coalesce'