mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix testing problem when 'current' equal to 'now' for separate inserts
on fast machines with fast disks. Adjust a few other tests to be more complete.
This commit is contained in:
@ -1,6 +1,35 @@
|
|||||||
|
QUERY: SELECT ('today'::datetime = ('yesterday'::datetime + '1 day'::timespan)) as "True";
|
||||||
|
True
|
||||||
|
----
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
QUERY: SELECT ('today'::datetime = ('tomorrow'::datetime - '1 day'::timespan)) as "True";
|
||||||
|
True
|
||||||
|
----
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
QUERY: SELECT ('tomorrow'::datetime = ('yesterday'::datetime + '2 days'::timespan)) as "True";
|
||||||
|
True
|
||||||
|
----
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
QUERY: SELECT ('current'::datetime = 'now'::datetime) as "True";
|
||||||
|
True
|
||||||
|
----
|
||||||
|
t
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
QUERY: SELECT ('now'::datetime - 'current'::datetime) AS "ZeroSecs";
|
||||||
|
ZeroSecs
|
||||||
|
--------
|
||||||
|
@ 0
|
||||||
|
(1 row)
|
||||||
|
|
||||||
QUERY: CREATE TABLE DATETIME_TBL( d1 datetime);
|
QUERY: CREATE TABLE DATETIME_TBL( d1 datetime);
|
||||||
QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
|
QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
|
||||||
QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
|
|
||||||
QUERY: INSERT INTO DATETIME_TBL VALUES ('today');
|
QUERY: INSERT INTO DATETIME_TBL VALUES ('today');
|
||||||
QUERY: INSERT INTO DATETIME_TBL VALUES ('yesterday');
|
QUERY: INSERT INTO DATETIME_TBL VALUES ('yesterday');
|
||||||
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow');
|
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow');
|
||||||
@ -36,12 +65,6 @@ one
|
|||||||
1
|
1
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
QUERY: SELECT 'now'::datetime - 'current'::datetime AS ZeroSecs;
|
|
||||||
zerosecs
|
|
||||||
--------
|
|
||||||
@ 0
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
|
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
|
||||||
one
|
one
|
||||||
---
|
---
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
-- *** testing new built-in time types: datetime, timespan ***
|
-- *** testing new built-in time types: datetime, timespan ***
|
||||||
|
|
||||||
|
-- Shorthand values
|
||||||
|
-- Not directly usable for regression testing since these are not constants.
|
||||||
|
-- So, just try to test parser and hope for the best - tgl 97/04/26
|
||||||
|
|
||||||
|
SELECT ('today'::datetime = ('yesterday'::datetime + '1 day'::timespan)) as "True";
|
||||||
|
SELECT ('today'::datetime = ('tomorrow'::datetime - '1 day'::timespan)) as "True";
|
||||||
|
SELECT ('tomorrow'::datetime = ('yesterday'::datetime + '2 days'::timespan)) as "True";
|
||||||
|
SELECT ('current'::datetime = 'now'::datetime) as "True";
|
||||||
|
SELECT ('now'::datetime - 'current'::datetime) AS "ZeroSecs";
|
||||||
|
|
||||||
CREATE TABLE DATETIME_TBL( d1 datetime);
|
CREATE TABLE DATETIME_TBL( d1 datetime);
|
||||||
|
|
||||||
-- Shorthand values
|
|
||||||
-- 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 ('current');
|
||||||
INSERT INTO DATETIME_TBL VALUES ('now');
|
|
||||||
INSERT INTO DATETIME_TBL VALUES ('today');
|
INSERT INTO DATETIME_TBL VALUES ('today');
|
||||||
INSERT INTO DATETIME_TBL VALUES ('yesterday');
|
INSERT INTO DATETIME_TBL VALUES ('yesterday');
|
||||||
INSERT INTO DATETIME_TBL VALUES ('tomorrow');
|
INSERT INTO DATETIME_TBL VALUES ('tomorrow');
|
||||||
@ -19,8 +25,8 @@ 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 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;
|
SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
|
||||||
|
|
||||||
DELETE FROM DATETIME_TBL;
|
DELETE FROM DATETIME_TBL;
|
||||||
|
|
||||||
-- verify uniform transaction time within transaction block
|
-- verify uniform transaction time within transaction block
|
||||||
|
Reference in New Issue
Block a user