]> granicus.if.org Git - postgresql/blob - src/test/regress/sql/reltime.sql
RESET SESSION, plus related new DDL commands. Patch from Marko Kreen,
[postgresql] / src / test / regress / sql / reltime.sql
1 --
2 -- RELTIME
3 --
4
5 CREATE TABLE RELTIME_TBL (f1 reltime);
6
7 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute');
8
9 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour');
10
11 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day');
12
13 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year');
14
15 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months');
16
17 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago');
18
19
20 -- badly formatted reltimes
21 INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime');
22
23 INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
24
25 -- test reltime operators
26
27 SELECT '' AS six, * FROM RELTIME_TBL;
28
29 SELECT '' AS five, * FROM RELTIME_TBL
30    WHERE RELTIME_TBL.f1 <> reltime '@ 10 days';
31
32 SELECT '' AS three, * FROM RELTIME_TBL
33    WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours';
34
35 SELECT '' AS three, * FROM RELTIME_TBL
36    WHERE RELTIME_TBL.f1 < reltime '@ 1 day';
37
38 SELECT '' AS one, * FROM RELTIME_TBL
39    WHERE RELTIME_TBL.f1 = reltime '@ 34 years';
40
41 SELECT '' AS two, * FROM RELTIME_TBL
42    WHERE RELTIME_TBL.f1 >= reltime '@ 1 month';
43
44 SELECT '' AS five, * FROM RELTIME_TBL
45    WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago';
46
47 SELECT '' AS fifteen, r1.*, r2.*
48    FROM RELTIME_TBL r1, RELTIME_TBL r2
49    WHERE r1.f1 > r2.f1
50    ORDER BY r1.f1, r2.f1;