1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-13 14:22:43 +03:00

Add missing operators of the form interval-plus-datetime, as required for

better SQL compliance in this area, per recent discussion.  Mark related
operators as commutators where possible.  (The system doesn't actually care
about commutator marking for operators not returning boolean, at the moment,
but this seems forward-thinking and besides it made it easier to verify
that we hadn't missed any.)
Also, remove interval-minus-time and interval-minus-timetz operators.
I'm not sure how these got in, but they are nonstandard and had very
obviously broken behavior.  (minus is not commutative in anyone's book.)
I doubt anyone had ever used 'em, because we'd surely have gotten a bug
report about it if so.
This commit is contained in:
Tom Lane
2004-07-02 22:50:23 +00:00
parent 0b89d261c7
commit e34082ee3b
8 changed files with 48 additions and 93 deletions

View File

@@ -805,12 +805,6 @@ SELECT time '03:30' + interval '1 month 04:01' AS "07:31:00";
07:31:00
(1 row)
SELECT interval '04:30' - time '01:02' AS "20:32:00";
20:32:00
----------
20:32:00
(1 row)
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
ERROR: cannot cast type time with time zone to interval
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
@@ -846,12 +840,6 @@ SELECT CAST(cast(date 'today' + time with time zone '03:30'
07:31:00
(1 row)
SELECT interval '04:30' - time with time zone '01:02-05' AS "20:32:00-05";
20:32:00-05
-------------
20:32:00-05
(1 row)
SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
AND i.f1 BETWEEN '00:00' AND '23:00';

View File

@@ -133,7 +133,6 @@ SELECT time '01:30' + interval '02:01' AS "03:31:00";
SELECT time '01:30' - interval '02:01' AS "23:29:00";
SELECT time '02:30' + interval '36:01' AS "14:31:00";
SELECT time '03:30' + interval '1 month 04:01' AS "07:31:00";
SELECT interval '04:30' - time '01:02' AS "20:32:00";
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
@@ -151,8 +150,6 @@ SELECT CAST(CAST(date 'today' + time with time zone '01:30'
SELECT CAST(cast(date 'today' + time with time zone '03:30'
+ interval '1 month 04:01' as timestamp without time zone) AS time) AS "07:31:00";
SELECT interval '04:30' - time with time zone '01:02-05' AS "20:32:00-05";
SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
AND i.f1 BETWEEN '00:00' AND '23:00';