aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>1997-09-01 06:16:08 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>1997-09-01 06:16:08 +0000
commitf2a9e203e8f665e4c397274b8dba0d7dd59d4d16 (patch)
tree03a7992b2cd39db02cae233dea1429a3933f863f
parent98462b73f89e2620f77050745692796c5d0895e9 (diff)
downloadpostgresql-f2a9e203e8f665e4c397274b8dba0d7dd59d4d16.tar.gz
postgresql-f2a9e203e8f665e4c397274b8dba0d7dd59d4d16.zip
Test for "current" time by comparing against "now".
-rw-r--r--src/test/regress/expected/datetime.out19
-rw-r--r--src/test/regress/sql/datetime.sql9
2 files changed, 23 insertions, 5 deletions
diff --git a/src/test/regress/expected/datetime.out b/src/test/regress/expected/datetime.out
index 0e59608ab42..c27e05c1d7a 100644
--- a/src/test/regress/expected/datetime.out
+++ b/src/test/regress/expected/datetime.out
@@ -36,15 +36,28 @@ one
1
(1 row)
-QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
-QUERY: BEGIN;
-QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
+QUERY: SELECT 'now'::datetime - 'current'::datetime AS ZeroSecs;
+zerosecs
+--------
+@ 0
+(1 row)
+
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
one
---
1
(1 row)
+QUERY: DELETE FROM DATETIME_TBL;
+QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
+QUERY: BEGIN;
+QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
+QUERY: SELECT count(*) AS two FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
+two
+---
+ 2
+(1 row)
+
QUERY: END;
QUERY: DELETE FROM DATETIME_TBL;
QUERY: INSERT INTO DATETIME_TBL VALUES ('invalid');
diff --git a/src/test/regress/sql/datetime.sql b/src/test/regress/sql/datetime.sql
index 5848c24d8cd..51d35421ef0 100644
--- a/src/test/regress/sql/datetime.sql
+++ b/src/test/regress/sql/datetime.sql
@@ -3,7 +3,7 @@
CREATE TABLE DATETIME_TBL( d1 datetime);
-- Shorthand values
--- Not testable since these are not constant for regression testing.
+-- Not directly testable since these are not constant for regression testing.
-- So, just try to test parser and hope for the best - tgl 97/04/26
INSERT INTO DATETIME_TBL VALUES ('current');
INSERT INTO DATETIME_TBL VALUES ('now');
@@ -19,10 +19,15 @@ SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'yesterday'::datetime;
SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime + '1 day'::timespan;
SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'today'::datetime - '1 day'::timespan;
+SELECT 'now'::datetime - 'current'::datetime AS ZeroSecs;
+SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
+DELETE FROM DATETIME_TBL;
+
+-- verify uniform transaction time within transaction block
INSERT INTO DATETIME_TBL VALUES ('current');
BEGIN;
INSERT INTO DATETIME_TBL VALUES ('now');
-SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
+SELECT count(*) AS two FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
END;
DELETE FROM DATETIME_TBL;