@ -3,18 +3,20 @@
--
--
-- needed so tests pass even in Australia
-- needed so tests pass even in Australia
SET australian_timezones = 'off';
SET australian_timezones = 'off';
CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone);
CREATE TABLE TIMESTAMP_TBL (d1 timestamp(2) without time zone);
-- Shorthand values
-- Test shorthand input values
-- Not directly usable for regression testing since these are not constants.
-- We can't just "select" the results since they aren't constants; test for
-- So, just try to test parser and hope for the best - thomas 97/04/26
-- equality instead. We can do that by running the test inside a transaction
-- NB: could get a failure if local midnight passes during the next few
-- block, within which the value of 'now' shouldn't change.
-- statements.
-- NOTE: it is possible for this part of the test to fail if the transaction
-- block is entered exactly at local midnight; then 'now' and 'today' have
-- the same values and the counts will come out different.
BEGIN;
INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('current');
ERROR: date/time value "current" is no longer supported
INSERT INTO TIMESTAMP_TBL VALUES ('today');
INSERT INTO TIMESTAMP_TBL VALUES ('today');
INSERT INTO TIMESTAMP_TBL VALUES ('yesterday');
INSERT INTO TIMESTAMP_TBL VALUES ('yesterday');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow');
-- time zone should be ignored by this data type
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow EST');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow EST');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow zulu');
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow zulu');
SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'today';
SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'today';
@ -23,10 +25,10 @@ SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone
1
1
(1 row)
(1 row)
SELECT count(*) AS On e FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'tomorrow';
SELECT count(*) AS Thre e FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'tomorrow';
on e
thre e
-----
-------
3
3
(1 row)
(1 row)
SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'yesterday';
SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'yesterday';
@ -35,12 +37,13 @@ SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone
1
1
(1 row)
(1 row)
SELECT count(*) AS None FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'now';
SELECT count(*) AS One FROM TIMESTAMP_TBL WHERE d1 = timestamp(2) without time zone 'now';
n one
one
------
-----
0
1
(1 row)
(1 row)
COMMIT;
DELETE FROM TIMESTAMP_TBL;
DELETE FROM TIMESTAMP_TBL;
-- verify uniform transaction time within transaction block
-- verify uniform transaction time within transaction block
BEGIN;
BEGIN;
@ -52,7 +55,7 @@ SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp(2) without time z
2
2
(1 row)
(1 row)
END ;
COMMIT ;
DELETE FROM TIMESTAMP_TBL;
DELETE FROM TIMESTAMP_TBL;
-- Special values
-- Special values
INSERT INTO TIMESTAMP_TBL VALUES ('-infinity');
INSERT INTO TIMESTAMP_TBL VALUES ('-infinity');
@ -61,6 +64,8 @@ INSERT INTO TIMESTAMP_TBL VALUES ('epoch');
-- Obsolete special values
-- Obsolete special values
INSERT INTO TIMESTAMP_TBL VALUES ('invalid');
INSERT INTO TIMESTAMP_TBL VALUES ('invalid');
ERROR: date/time value "invalid" is no longer supported
ERROR: date/time value "invalid" is no longer supported
INSERT INTO TIMESTAMP_TBL VALUES ('current');
ERROR: date/time value "current" is no longer supported
-- Postgres v6.0 standard output format
-- Postgres v6.0 standard output format
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
INSERT INTO TIMESTAMP_TBL VALUES ('Invalid Abstime');
INSERT INTO TIMESTAMP_TBL VALUES ('Invalid Abstime');