~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysql-test/r/type_timestamp.result

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
527
527
5       0
528
528
DROP TABLE t1;
529
529
End of 5.0 tests
 
530
#
 
531
# Bug #55779: select does not work properly in mysql server
 
532
#             Version "5.1.42 SUSE MySQL RPM"
 
533
#
 
534
CREATE TABLE t1 (a TIMESTAMP, KEY (a));
 
535
INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
 
536
('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
 
537
SELECT a FROM t1 WHERE a >=  20000101000000;
 
538
a
 
539
2000-01-01 00:00:00
 
540
2000-01-01 00:00:00
 
541
2000-01-01 00:00:01
 
542
2000-01-01 00:00:01
 
543
SELECT a FROM t1 WHERE a >= '20000101000000';
 
544
a
 
545
2000-01-01 00:00:00
 
546
2000-01-01 00:00:00
 
547
2000-01-01 00:00:01
 
548
2000-01-01 00:00:01
 
549
DROP TABLE t1;
 
550
#
 
551
# Bug#50774: failed to get the correct resultset when timestamp values 
 
552
# are appended with .0
 
553
#
 
554
CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) );
 
555
INSERT INTO t1 VALUES( '2010-02-01 09:31:01' );
 
556
INSERT INTO t1 VALUES( '2010-02-01 09:31:02' );
 
557
INSERT INTO t1 VALUES( '2010-02-01 09:31:03' );
 
558
INSERT INTO t1 VALUES( '2010-02-01 09:31:04' );
 
559
SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
 
560
a
 
561
2010-02-01 09:31:02
 
562
2010-02-01 09:31:03
 
563
2010-02-01 09:31:04
 
564
SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a;
 
565
a
 
566
2010-02-01 09:31:02
 
567
2010-02-01 09:31:03
 
568
2010-02-01 09:31:04
 
569
SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0';
 
570
a
 
571
2010-02-01 09:31:01
 
572
2010-02-01 09:31:02
 
573
SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a;
 
574
a
 
575
2010-02-01 09:31:01
 
576
2010-02-01 09:31:02
 
577
EXPLAIN
 
578
SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
 
579
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
580
x       x       x       range   x       x       x       x       x       x
 
581
SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
 
582
a
 
583
2010-02-01 09:31:02
 
584
2010-02-01 09:31:03
 
585
2010-02-01 09:31:04
 
586
CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) );
 
587
INSERT INTO t2 VALUES( '2010-02-01 09:31:01' );
 
588
INSERT INTO t2 VALUES( '2010-02-01 09:31:02' );
 
589
INSERT INTO t2 VALUES( '2010-02-01 09:31:03' );
 
590
INSERT INTO t2 VALUES( '2010-02-01 09:31:04' );
 
591
INSERT INTO t2 VALUES( '2010-02-01 09:31:05' );
 
592
INSERT INTO t2 VALUES( '2010-02-01 09:31:06' );
 
593
INSERT INTO t2 VALUES( '2010-02-01 09:31:07' );
 
594
INSERT INTO t2 VALUES( '2010-02-01 09:31:08' );
 
595
INSERT INTO t2 VALUES( '2010-02-01 09:31:09' );
 
596
INSERT INTO t2 VALUES( '2010-02-01 09:31:10' );
 
597
INSERT INTO t2 VALUES( '2010-02-01 09:31:11' );
 
598
# The bug would cause the range optimizer's comparison to use an open
 
599
# interval here. This reveals itself only in the number of reads 
 
600
# performed.
 
601
FLUSH STATUS;
 
602
EXPLAIN
 
603
SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
 
604
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
605
x       x       x       range   x       x       x       x       x       x
 
606
SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
 
607
a
 
608
2010-02-01 09:31:01
 
609
SHOW STATUS LIKE 'Handler_read_next';
 
610
Variable_name   Value
 
611
Handler_read_next       1
 
612
DROP TABLE t1, t2;
 
613
End of 5.1 tests