Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f2a9e203
Commit
f2a9e203
authored
Sep 01, 1997
by
Thomas G. Lockhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for "current" time by comparing against "now".
parent
98462b73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
src/test/regress/expected/datetime.out
src/test/regress/expected/datetime.out
+16
-3
src/test/regress/sql/datetime.sql
src/test/regress/sql/datetime.sql
+7
-2
No files found.
src/test/regress/expected/datetime.out
View file @
f2a9e203
...
...
@@ -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');
...
...
src/test/regress/sql/datetime.sql
View file @
f2a9e203
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment