postgresql/src/test/regress/expected/reltime.out
Neil Conway f5ab0a14ea Add a "USING" clause to DELETE, which is equivalent to the FROM clause
in UPDATE. We also now issue a NOTICE if a query has _any_ implicit
range table entries -- in the past, we would only warn about implicit
RTEs in SELECTs with at least one explicit RTE.

As a result of the warning change, 25 of the regression tests had to
be updated. I also took the opportunity to remove some bogus whitespace
differences between some of the float4 and float8 variants. I believe
I have correctly updated all the platform-specific variants, but let
me know if that's not the case.

Original patch for DELETE ... USING from Euler Taveira de Oliveira,
reworked by Neil Conway.
2005-04-07 01:51:41 +00:00

106 lines
2.7 KiB
Plaintext

--
-- RELTIME
--
CREATE TABLE RELTIME_TBL (f1 reltime);
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 1 minute');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 5 hour');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 10 day');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 34 year');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months');
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago');
-- badly formatted reltimes
INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime');
ERROR: invalid input syntax for type reltime: "badly formatted reltime"
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
ERROR: invalid input syntax for type reltime: "@ 30 eons ago"
-- test reltime operators
SELECT '' AS six, * FROM RELTIME_TBL;
six | f1
-----+---------------
| @ 1 min
| @ 5 hours
| @ 10 days
| @ 34 years
| @ 3 mons
| @ 14 secs ago
(6 rows)
SELECT '' AS five, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 <> reltime '@ 10 days';
five | f1
------+---------------
| @ 1 min
| @ 5 hours
| @ 34 years
| @ 3 mons
| @ 14 secs ago
(5 rows)
SELECT '' AS three, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 <= reltime '@ 5 hours';
three | f1
-------+---------------
| @ 1 min
| @ 5 hours
| @ 14 secs ago
(3 rows)
SELECT '' AS three, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 < reltime '@ 1 day';
three | f1
-------+---------------
| @ 1 min
| @ 5 hours
| @ 14 secs ago
(3 rows)
SELECT '' AS one, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 = reltime '@ 34 years';
one | f1
-----+------------
| @ 34 years
(1 row)
SELECT '' AS two, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 >= reltime '@ 1 month';
two | f1
-----+------------
| @ 34 years
| @ 3 mons
(2 rows)
SELECT '' AS five, * FROM RELTIME_TBL
WHERE RELTIME_TBL.f1 > reltime '@ 3 seconds ago';
five | f1
------+------------
| @ 1 min
| @ 5 hours
| @ 10 days
| @ 34 years
| @ 3 mons
(5 rows)
SELECT '' AS fifteen, r1.*, r2.*
FROM RELTIME_TBL r1, RELTIME_TBL r2
WHERE r1.f1 > r2.f1
ORDER BY r1.f1, r2.f1;
fifteen | f1 | f1
---------+------------+---------------
| @ 1 min | @ 14 secs ago
| @ 5 hours | @ 14 secs ago
| @ 5 hours | @ 1 min
| @ 10 days | @ 14 secs ago
| @ 10 days | @ 1 min
| @ 10 days | @ 5 hours
| @ 3 mons | @ 14 secs ago
| @ 3 mons | @ 1 min
| @ 3 mons | @ 5 hours
| @ 3 mons | @ 10 days
| @ 34 years | @ 14 secs ago
| @ 34 years | @ 1 min
| @ 34 years | @ 5 hours
| @ 34 years | @ 10 days
| @ 34 years | @ 3 mons
(15 rows)