File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 36
36
1
37
37
(1 row)
38
38
39
- QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
40
- QUERY: BEGIN;
41
- QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
39
+ QUERY: SELECT 'now'::datetime - 'current'::datetime AS ZeroSecs;
40
+ zerosecs
41
+ --------
42
+ @ 0
43
+ (1 row)
44
+
42
45
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
43
46
one
44
47
---
45
48
1
46
49
(1 row)
47
50
51
+ QUERY: DELETE FROM DATETIME_TBL;
52
+ QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
53
+ QUERY: BEGIN;
54
+ QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
55
+ QUERY: SELECT count(*) AS two FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
56
+ two
57
+ ---
58
+ 2
59
+ (1 row)
60
+
48
61
QUERY: END;
49
62
QUERY: DELETE FROM DATETIME_TBL;
50
63
QUERY: INSERT INTO DATETIME_TBL VALUES ('invalid');
Original file line number Diff line number Diff line change 3
3
CREATE TABLE DATETIME_TBL ( d1 datetime);
4
4
5
5
-- Shorthand values
6
- -- Not testable since these are not constant for regression testing.
6
+ -- Not directly testable since these are not constant for regression testing.
7
7
-- So, just try to test parser and hope for the best - tgl 97/04/26
8
8
INSERT INTO DATETIME_TBL VALUES (' current' );
9
9
INSERT INTO DATETIME_TBL VALUES (' now' );
@@ -19,10 +19,15 @@ SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'yesterday'::datetime;
19
19
SELECT count (* ) AS one FROM DATETIME_TBL WHERE d1 = ' today' ::datetime + ' 1 day' ::timespan;
20
20
SELECT count (* ) AS one FROM DATETIME_TBL WHERE d1 = ' today' ::datetime - ' 1 day' ::timespan;
21
21
22
+ SELECT ' now' ::datetime - ' current' ::datetime AS ZeroSecs;
23
+ SELECT count (* ) AS one FROM DATETIME_TBL WHERE d1 = ' now' ::datetime;
24
+ DELETE FROM DATETIME_TBL;
25
+
26
+ -- verify uniform transaction time within transaction block
22
27
INSERT INTO DATETIME_TBL VALUES (' current' );
23
28
BEGIN ;
24
29
INSERT INTO DATETIME_TBL VALUES (' now' );
25
- SELECT count (* ) AS one FROM DATETIME_TBL WHERE d1 = ' now' ::datetime;
30
+ SELECT count (* ) AS two FROM DATETIME_TBL WHERE d1 = ' now' ::datetime;
26
31
END;
27
32
DELETE FROM DATETIME_TBL;
28
33
You can’t perform that action at this time.
0 commit comments