Commit 04d975f0 authored by Tom Lane's avatar Tom Lane

Make regress tests safe for variable-resolution timestamps.

parent 64dff0be
...@@ -7,6 +7,8 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone); ...@@ -7,6 +7,8 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone);
-- Shorthand values -- Shorthand values
-- Not directly usable for regression testing since these are not constants. -- Not directly usable for regression testing since these are not constants.
-- So, just try to test parser and hope for the best - thomas 97/04/26 -- So, just try to test parser and hope for the best - thomas 97/04/26
-- NB: could get a failure if local midnight passes during the next few
-- statements.
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('current'); INSERT INTO TIMESTAMP_TBL VALUES ('current');
INSERT INTO TIMESTAMP_TBL VALUES ('today'); INSERT INTO TIMESTAMP_TBL VALUES ('today');
...@@ -43,7 +45,7 @@ DELETE FROM TIMESTAMP_TBL; ...@@ -43,7 +45,7 @@ DELETE FROM TIMESTAMP_TBL;
BEGIN; BEGIN;
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'now'; SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp(2) without time zone 'now';
two two
----- -----
2 2
......
...@@ -40,7 +40,7 @@ DELETE FROM TIMESTAMPTZ_TBL; ...@@ -40,7 +40,7 @@ DELETE FROM TIMESTAMPTZ_TBL;
BEGIN; BEGIN;
INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('now');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('now');
SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'now'; SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp(2) with time zone 'now';
two two
----- -----
2 2
......
...@@ -9,6 +9,8 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone); ...@@ -9,6 +9,8 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone);
-- Shorthand values -- Shorthand values
-- Not directly usable for regression testing since these are not constants. -- Not directly usable for regression testing since these are not constants.
-- So, just try to test parser and hope for the best - thomas 97/04/26 -- So, just try to test parser and hope for the best - thomas 97/04/26
-- NB: could get a failure if local midnight passes during the next few
-- statements.
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('current'); INSERT INTO TIMESTAMP_TBL VALUES ('current');
...@@ -29,7 +31,7 @@ DELETE FROM TIMESTAMP_TBL; ...@@ -29,7 +31,7 @@ DELETE FROM TIMESTAMP_TBL;
BEGIN; BEGIN;
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
INSERT INTO TIMESTAMP_TBL VALUES ('now'); INSERT INTO TIMESTAMP_TBL VALUES ('now');
SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp without time zone 'now'; SELECT count(*) AS two FROM TIMESTAMP_TBL WHERE d1 = timestamp(2) without time zone 'now';
END; END;
DELETE FROM TIMESTAMP_TBL; DELETE FROM TIMESTAMP_TBL;
......
...@@ -25,7 +25,7 @@ DELETE FROM TIMESTAMPTZ_TBL; ...@@ -25,7 +25,7 @@ DELETE FROM TIMESTAMPTZ_TBL;
BEGIN; BEGIN;
INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('now');
INSERT INTO TIMESTAMPTZ_TBL VALUES ('now'); INSERT INTO TIMESTAMPTZ_TBL VALUES ('now');
SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp with time zone 'now'; SELECT count(*) AS two FROM TIMESTAMPTZ_TBL WHERE d1 = timestamp(2) with time zone 'now';
END; END;
DELETE FROM TIMESTAMPTZ_TBL; DELETE FROM TIMESTAMPTZ_TBL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment