Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e0976e

Browse files
author
Thomas G. Lockhart
committed
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.
1 parent644b37c commit2e0976e

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

‎src/test/regress/expected/datetime.out

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1+
QUERY: SELECT ('today'::datetime = ('yesterday'::datetime + '1 day'::timespan)) as "True";
2+
True
3+
----
4+
t
5+
(1 row)
6+
7+
QUERY: SELECT ('today'::datetime = ('tomorrow'::datetime - '1 day'::timespan)) as "True";
8+
True
9+
----
10+
t
11+
(1 row)
12+
13+
QUERY: SELECT ('tomorrow'::datetime = ('yesterday'::datetime + '2 days'::timespan)) as "True";
14+
True
15+
----
16+
t
17+
(1 row)
18+
19+
QUERY: SELECT ('current'::datetime = 'now'::datetime) as "True";
20+
True
21+
----
22+
t
23+
(1 row)
24+
25+
QUERY: SELECT ('now'::datetime - 'current'::datetime) AS "ZeroSecs";
26+
ZeroSecs
27+
--------
28+
@ 0
29+
(1 row)
30+
131
QUERY: CREATE TABLE DATETIME_TBL( d1 datetime);
232
QUERY: INSERT INTO DATETIME_TBL VALUES ('current');
3-
QUERY: INSERT INTO DATETIME_TBL VALUES ('now');
433
QUERY: INSERT INTO DATETIME_TBL VALUES ('today');
534
QUERY: INSERT INTO DATETIME_TBL VALUES ('yesterday');
635
QUERY: INSERT INTO DATETIME_TBL VALUES ('tomorrow');
@@ -36,12 +65,6 @@ one
3665
1
3766
(1 row)
3867

39-
QUERY: SELECT 'now'::datetime - 'current'::datetime AS ZeroSecs;
40-
zerosecs
41-
--------
42-
@ 0
43-
(1 row)
44-
4568
QUERY: SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'now'::datetime;
4669
one
4770
---

‎src/test/regress/sql/datetime.sql

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
-- *** testing new built-in time types: datetime, timespan ***
22

3-
CREATETABLEDATETIME_TBL( d1 datetime);
4-
53
-- Shorthand values
6-
-- Not directlytestablesince these are notconstant for regression testing.
4+
-- Not directlyusable for regression testingsince these are notconstants.
75
-- So, just try to test parser and hope for the best - tgl 97/04/26
6+
7+
SELECT ('today'::datetime= ('yesterday'::datetime+'1 day'::timespan))as"True";
8+
SELECT ('today'::datetime= ('tomorrow'::datetime-'1 day'::timespan))as"True";
9+
SELECT ('tomorrow'::datetime= ('yesterday'::datetime+'2 days'::timespan))as"True";
10+
SELECT ('current'::datetime='now'::datetime)as"True";
11+
SELECT ('now'::datetime-'current'::datetime)AS"ZeroSecs";
12+
13+
CREATETABLEDATETIME_TBL( d1 datetime);
14+
815
INSERT INTO DATETIME_TBLVALUES ('current');
9-
INSERT INTO DATETIME_TBLVALUES ('now');
1016
INSERT INTO DATETIME_TBLVALUES ('today');
1117
INSERT INTO DATETIME_TBLVALUES ('yesterday');
1218
INSERT INTO DATETIME_TBLVALUES ('tomorrow');
@@ -19,8 +25,8 @@ SELECT count(*) AS one FROM DATETIME_TBL WHERE d1 = 'yesterday'::datetime;
1925
SELECTcount(*)AS oneFROM DATETIME_TBLWHERE d1='today'::datetime+'1 day'::timespan;
2026
SELECTcount(*)AS oneFROM DATETIME_TBLWHERE d1='today'::datetime-'1 day'::timespan;
2127

22-
SELECT'now'::datetime-'current'::datetimeAS ZeroSecs;
2328
SELECTcount(*)AS oneFROM DATETIME_TBLWHERE d1='now'::datetime;
29+
2430
DELETEFROM DATETIME_TBL;
2531

2632
-- verify uniform transaction time within transaction block

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp