~ubuntu-branches/ubuntu/hardy/postgresql-8.4/hardy-backports

« back to all changes in this revision

Viewing changes to src/test/regress/expected/reltime.out

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--
 
2
-- RELTIME
 
3
--
 
4
CREATE TABLE RELTIME_TBL (f1 reltime);
 
5
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute');
 
6
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour');
 
7
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day');
 
8
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year');
 
9
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months');
 
10
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago');
 
11
-- badly formatted reltimes
 
12
INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime');
 
13
ERROR:  invalid input syntax for type reltime: "badly formatted reltime"
 
14
LINE 1: INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltim...
 
15
                                             ^
 
16
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
 
17
ERROR:  invalid input syntax for type reltime: "@ 30 eons ago"
 
18
LINE 1: INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
 
19
                                             ^
 
20
-- test reltime operators
 
21
SELECT '' AS six, * FROM RELTIME_TBL;
 
22
 six |      f1       
 
23
-----+---------------
 
24
     | @ 1 min
 
25
     | @ 5 hours
 
26
     | @ 10 days
 
27
     | @ 34 years
 
28
     | @ 3 mons
 
29
     | @ 14 secs ago
 
30
(6 rows)
 
31
 
 
32
SELECT '' AS five, * FROM RELTIME_TBL
 
33
   WHERE RELTIME_TBL.f1 <> reltime '@ 10 days';
 
34
 five |      f1       
 
35
------+---------------
 
36
      | @ 1 min
 
37
      | @ 5 hours
 
38
      | @ 34 years
 
39
      | @ 3 mons
 
40
      | @ 14 secs ago
 
41
(5 rows)
 
42
 
 
43
SELECT '' AS three, * FROM RELTIME_TBL
 
44
   WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours';
 
45
 three |      f1       
 
46
-------+---------------
 
47
       | @ 1 min
 
48
       | @ 5 hours
 
49
       | @ 14 secs ago
 
50
(3 rows)
 
51
 
 
52
SELECT '' AS three, * FROM RELTIME_TBL
 
53
   WHERE RELTIME_TBL.f1 < reltime '@ 1 day';
 
54
 three |      f1       
 
55
-------+---------------
 
56
       | @ 1 min
 
57
       | @ 5 hours
 
58
       | @ 14 secs ago
 
59
(3 rows)
 
60
 
 
61
SELECT '' AS one, * FROM RELTIME_TBL
 
62
   WHERE RELTIME_TBL.f1 = reltime '@ 34 years';
 
63
 one |     f1     
 
64
-----+------------
 
65
     | @ 34 years
 
66
(1 row)
 
67
 
 
68
SELECT '' AS two, * FROM RELTIME_TBL
 
69
   WHERE RELTIME_TBL.f1 >= reltime '@ 1 month';
 
70
 two |     f1     
 
71
-----+------------
 
72
     | @ 34 years
 
73
     | @ 3 mons
 
74
(2 rows)
 
75
 
 
76
SELECT '' AS five, * FROM RELTIME_TBL
 
77
   WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago';
 
78
 five |     f1     
 
79
------+------------
 
80
      | @ 1 min
 
81
      | @ 5 hours
 
82
      | @ 10 days
 
83
      | @ 34 years
 
84
      | @ 3 mons
 
85
(5 rows)
 
86
 
 
87
SELECT '' AS fifteen, r1.*, r2.*
 
88
   FROM RELTIME_TBL r1, RELTIME_TBL r2
 
89
   WHERE r1.f1 > r2.f1
 
90
   ORDER BY r1.f1, r2.f1;
 
91
 fifteen |     f1     |      f1       
 
92
---------+------------+---------------
 
93
         | @ 1 min    | @ 14 secs ago
 
94
         | @ 5 hours  | @ 14 secs ago
 
95
         | @ 5 hours  | @ 1 min
 
96
         | @ 10 days  | @ 14 secs ago
 
97
         | @ 10 days  | @ 1 min
 
98
         | @ 10 days  | @ 5 hours
 
99
         | @ 3 mons   | @ 14 secs ago
 
100
         | @ 3 mons   | @ 1 min
 
101
         | @ 3 mons   | @ 5 hours
 
102
         | @ 3 mons   | @ 10 days
 
103
         | @ 34 years | @ 14 secs ago
 
104
         | @ 34 years | @ 1 min
 
105
         | @ 34 years | @ 5 hours
 
106
         | @ 34 years | @ 10 days
 
107
         | @ 34 years | @ 3 mons
 
108
(15 rows)
 
109