mirror of
https://github.com/postgres/postgres.git
synced 2025-12-07 12:02:30 +03:00
Accept an INTERVAL argument for SET TIME ZONE per SQL99.
Modified the parser and the SET handlers to use full Node structures rather than simply a character string argument. Implement INTERVAL() YEAR TO MONTH (etc) syntax per SQL99. Does not yet accept the goofy string format that goes along with, but this should be fairly straight forward to fix now as a bug or later as a feature. Implement precision for the INTERVAL() type. Use the typmod mechanism for both of INTERVAL features. Fix the INTERVAL syntax in the parser: opt_interval was in the wrong place. INTERVAL is now a reserved word, otherwise we get reduce/reduce errors. Implement an explicit date_part() function for TIMETZ. Should fix coersion problem with INTERVAL reported by Peter E. Fix up some error messages for date/time types. Use all caps for type names within message. Fix recently introduced side-effect bug disabling 'epoch' as a recognized field for date_part() etc. Reported by Peter E. (??) Bump catalog version number. Rename "microseconds" current transaction time field from ...Msec to ...Usec. Duh! date/time regression tests updated for reference platform, but a few changes will be necessary for others.
This commit is contained in:
@@ -1310,9 +1310,9 @@ SELECT '' AS "16", f1 AS "timestamp"
|
||||
| Sat Sep 22 18:19:20 2001 PDT
|
||||
(16 rows)
|
||||
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS interval, d.f1 + t.f1 AS plus
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 + t.f1 AS plus
|
||||
FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
|
||||
ORDER BY plus, "timestamp", interval;
|
||||
ORDER BY plus, "timestamp", "interval";
|
||||
160 | timestamp | interval | plus
|
||||
-----+------------------------------+-------------------------------+------------------------------
|
||||
| Thu Jan 01 00:00:00 1970 PST | @ 14 secs ago | Wed Dec 31 23:59:46 1969 PST
|
||||
@@ -1477,10 +1477,10 @@ SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS interval, d.f1 + t.f1 AS plus
|
||||
| Sat Sep 22 18:19:20 2001 PDT | @ 34 years | Sat Sep 22 18:19:20 2035 PDT
|
||||
(160 rows)
|
||||
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS interval, d.f1 - t.f1 AS minus
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 - t.f1 AS minus
|
||||
FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
|
||||
WHERE isfinite(d.f1)
|
||||
ORDER BY minus, "timestamp", interval;
|
||||
ORDER BY minus, "timestamp", "interval";
|
||||
160 | timestamp | interval | minus
|
||||
-----+------------------------------+-------------------------------+------------------------------
|
||||
| Thu Jan 01 00:00:00 1970 PST | @ 34 years | Wed Jan 01 00:00:00 1936 PST
|
||||
@@ -2084,7 +2084,7 @@ SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime
|
||||
| @ 5 mons 12 hours | @ 5 mons 12 hours
|
||||
(10 rows)
|
||||
|
||||
SELECT '' AS six, f1 as reltime, interval(f1) AS interval
|
||||
SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval
|
||||
FROM RELTIME_TBL;
|
||||
six | reltime | interval
|
||||
-----+---------------+---------------
|
||||
|
||||
@@ -59,7 +59,7 @@ INSERT INTO TIMESTAMP_TBL VALUES ('infinity');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('epoch');
|
||||
-- Obsolete special values
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('invalid');
|
||||
ERROR: Timestamp 'invalid' no longer supported
|
||||
ERROR: TIMESTAMP 'invalid' no longer supported
|
||||
-- Postgres v6.0 standard output format
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Invalid Abstime');
|
||||
@@ -137,7 +137,7 @@ INSERT INTO TIMESTAMP_TBL VALUES ('Jan 01 17:32:01 2001');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 -0097');
|
||||
ERROR: Bad timestamp external representation 'Feb 16 17:32:01 -0097'
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC');
|
||||
ERROR: Timestamp out of range 'Feb 16 17:32:01 5097 BC'
|
||||
ERROR: TIMESTAMP out of range 'Feb 16 17:32:01 5097 BC'
|
||||
SELECT '' AS "64", d1 FROM TIMESTAMP_TBL;
|
||||
64 | d1
|
||||
----+-----------------------------
|
||||
|
||||
@@ -54,7 +54,7 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('infinity');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('epoch');
|
||||
-- Obsolete special values
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('invalid');
|
||||
ERROR: Timestamp with time zone 'invalid' no longer supported
|
||||
ERROR: TIMESTAMP WITH TIME ZONE 'invalid' no longer supported
|
||||
-- Postgres v6.0 standard output format
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Invalid Abstime');
|
||||
@@ -132,7 +132,7 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('Jan 01 17:32:01 2001');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 -0097');
|
||||
ERROR: Bad timestamp external representation 'Feb 16 17:32:01 -0097'
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Feb 16 17:32:01 5097 BC');
|
||||
ERROR: Timestamp out of range 'Feb 16 17:32:01 5097 BC'
|
||||
ERROR: TIMESTAMP WITH TIME ZONE out of range 'Feb 16 17:32:01 5097 BC'
|
||||
SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL;
|
||||
64 | d1
|
||||
----+---------------------------------
|
||||
|
||||
@@ -177,14 +177,14 @@ SELECT '' AS "16", f1 AS "timestamp"
|
||||
FROM TEMP_TIMESTAMP
|
||||
ORDER BY "timestamp";
|
||||
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS interval, d.f1 + t.f1 AS plus
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 + t.f1 AS plus
|
||||
FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
|
||||
ORDER BY plus, "timestamp", interval;
|
||||
ORDER BY plus, "timestamp", "interval";
|
||||
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS interval, d.f1 - t.f1 AS minus
|
||||
SELECT '' AS "160", d.f1 AS "timestamp", t.f1 AS "interval", d.f1 - t.f1 AS minus
|
||||
FROM TEMP_TIMESTAMP d, INTERVAL_TBL t
|
||||
WHERE isfinite(d.f1)
|
||||
ORDER BY minus, "timestamp", interval;
|
||||
ORDER BY minus, "timestamp", "interval";
|
||||
|
||||
SELECT '' AS "16", d.f1 AS "timestamp", timestamp '1980-01-06 00:00 GMT' AS gpstime_zero,
|
||||
d.f1 - timestamp '1980-01-06 00:00 GMT' AS difference
|
||||
@@ -250,7 +250,7 @@ SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp"
|
||||
SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime
|
||||
FROM INTERVAL_TBL;
|
||||
|
||||
SELECT '' AS six, f1 as reltime, interval(f1) AS interval
|
||||
SELECT '' AS six, f1 as reltime, CAST(f1 AS interval) AS interval
|
||||
FROM RELTIME_TBL;
|
||||
|
||||
DROP TABLE TEMP_TIMESTAMP;
|
||||
|
||||
Reference in New Issue
Block a user