]> granicus.if.org Git - postgresql/blob - src/test/regress/expected/time.out
Teach the system how to use hashing for UNION. (INTERSECT/EXCEPT will follow,
[postgresql] / src / test / regress / expected / time.out
1 --
2 -- TIME
3 --
4 CREATE TABLE TIME_TBL (f1 time(2));
5 INSERT INTO TIME_TBL VALUES ('00:00');
6 INSERT INTO TIME_TBL VALUES ('01:00');
7 -- as of 7.4, timezone spec should be accepted and ignored
8 INSERT INTO TIME_TBL VALUES ('02:03 PST');
9 INSERT INTO TIME_TBL VALUES ('11:59 EDT');
10 INSERT INTO TIME_TBL VALUES ('12:00');
11 INSERT INTO TIME_TBL VALUES ('12:01');
12 INSERT INTO TIME_TBL VALUES ('23:59');
13 INSERT INTO TIME_TBL VALUES ('11:59:59.99 PM');
14 INSERT INTO TIME_TBL VALUES ('2003-03-07 15:36:39 America/New_York');
15 INSERT INTO TIME_TBL VALUES ('2003-07-07 15:36:39 America/New_York');
16 -- this should fail (the timezone offset is not known)
17 INSERT INTO TIME_TBL VALUES ('15:36:39 America/New_York');
18 ERROR:  invalid input syntax for type time: "15:36:39 America/New_York"
19 SELECT f1 AS "Time" FROM TIME_TBL;
20     Time     
21 -------------
22  00:00:00
23  01:00:00
24  02:03:00
25  11:59:00
26  12:00:00
27  12:01:00
28  23:59:00
29  23:59:59.99
30  15:36:39
31  15:36:39
32 (10 rows)
33
34 SELECT f1 AS "Three" FROM TIME_TBL WHERE f1 < '05:06:07';
35   Three   
36 ----------
37  00:00:00
38  01:00:00
39  02:03:00
40 (3 rows)
41
42 SELECT f1 AS "Five" FROM TIME_TBL WHERE f1 > '05:06:07';
43     Five     
44 -------------
45  11:59:00
46  12:00:00
47  12:01:00
48  23:59:00
49  23:59:59.99
50  15:36:39
51  15:36:39
52 (7 rows)
53
54 SELECT f1 AS "None" FROM TIME_TBL WHERE f1 < '00:00';
55  None 
56 ------
57 (0 rows)
58
59 SELECT f1 AS "Eight" FROM TIME_TBL WHERE f1 >= '00:00';
60     Eight    
61 -------------
62  00:00:00
63  01:00:00
64  02:03:00
65  11:59:00
66  12:00:00
67  12:01:00
68  23:59:00
69  23:59:59.99
70  15:36:39
71  15:36:39
72 (10 rows)
73
74 --
75 -- TIME simple math
76 --
77 -- We now make a distinction between time and intervals,
78 -- and adding two times together makes no sense at all.
79 -- Leave in one query to show that it is rejected,
80 -- and do the rest of the testing in horology.sql
81 -- where we do mixed-type arithmetic. - thomas 2000-12-02
82 SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
83 ERROR:  operator is not unique: time without time zone + time without time zone
84 LINE 1: SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
85                   ^
86 HINT:  Could not choose a best candidate operator. You might need to add explicit type casts.