Clean up the ancient decision to show only two fractional-seconds digits

in "postgres_verbose" intervalstyle, and the equally arbitrary decision to
show at least two fractional-seconds digits in most other datetime display
styles.  This results in some minor changes in the expected regression test
outputs.

Also, coalesce a lot of repetitive code in datetime.c into subroutines,
for clarity and ease of maintenance.  In particular this roughly halves
the number of #ifdef HAVE_INT64_TIMESTAMP segments.

Ron Mayer, with some additional kibitzing from Tom Lane
This commit is contained in:
Tom Lane 2008-11-12 01:36:20 +00:00
parent 466368b8d0
commit d1ab3eb712
6 changed files with 861 additions and 1083 deletions

File diff suppressed because it is too large Load Diff

View File

@ -423,9 +423,9 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Tue Feb 10 17:32:01 1998
| Tue Feb 10 17:32:01 1998
| Tue Feb 10 17:32:02 1998
| Tue Feb 10 17:32:01.40 1998
| Tue Feb 10 17:32:01.50 1998
| Tue Feb 10 17:32:01.60 1998
| Tue Feb 10 17:32:01.4 1998
| Tue Feb 10 17:32:01.5 1998
| Tue Feb 10 17:32:01.6 1998
| Fri Jan 02 00:00:00 1998
| Fri Jan 02 03:04:05 1998
| Tue Feb 10 17:32:01 1998
@ -493,9 +493,9 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMP_TBL;
| Sat Feb 10 17:32:01 1996
| Sat Feb 10 17:32:01 1996
| Sat Feb 10 17:32:02 1996
| Sat Feb 10 17:32:01.40 1996
| Sat Feb 10 17:32:01.50 1996
| Sat Feb 10 17:32:01.60 1996
| Sat Feb 10 17:32:01.4 1996
| Sat Feb 10 17:32:01.5 1996
| Sat Feb 10 17:32:01.6 1996
| Tue Jan 02 00:00:00 1996
| Tue Jan 02 03:04:05 1996
| Sat Feb 10 17:32:01 1996
@ -668,9 +668,9 @@ SELECT '' AS "64", d1 + interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Tue Feb 10 17:32:01 1998 PST
| Tue Feb 10 17:32:01 1998 PST
| Tue Feb 10 17:32:02 1998 PST
| Tue Feb 10 17:32:01.40 1998 PST
| Tue Feb 10 17:32:01.50 1998 PST
| Tue Feb 10 17:32:01.60 1998 PST
| Tue Feb 10 17:32:01.4 1998 PST
| Tue Feb 10 17:32:01.5 1998 PST
| Tue Feb 10 17:32:01.6 1998 PST
| Fri Jan 02 00:00:00 1998 PST
| Fri Jan 02 03:04:05 1998 PST
| Tue Feb 10 17:32:01 1998 PST
@ -739,9 +739,9 @@ SELECT '' AS "64", d1 - interval '1 year' AS one_year FROM TIMESTAMPTZ_TBL;
| Sat Feb 10 17:32:01 1996 PST
| Sat Feb 10 17:32:01 1996 PST
| Sat Feb 10 17:32:02 1996 PST
| Sat Feb 10 17:32:01.40 1996 PST
| Sat Feb 10 17:32:01.50 1996 PST
| Sat Feb 10 17:32:01.60 1996 PST
| Sat Feb 10 17:32:01.4 1996 PST
| Sat Feb 10 17:32:01.5 1996 PST
| Sat Feb 10 17:32:01.6 1996 PST
| Tue Jan 02 00:00:00 1996 PST
| Tue Jan 02 03:04:05 1996 PST
| Sat Feb 10 17:32:01 1996 PST
@ -884,112 +884,112 @@ SELECT t.d1 AS t, i.f1 AS i, t.d1 + i.f1 AS "add", t.d1 - i.f1 AS "subtract"
WHERE t.d1 BETWEEN '1990-01-01' AND '2001-01-01'
AND i.f1 BETWEEN '00:00' AND '23:00'
ORDER BY 1,2;
t | i | add | subtract
-----------------------------+-----------+-----------------------------+-----------------------------
Wed Feb 28 17:32:01 1996 | @ 1 min | Wed Feb 28 17:33:01 1996 | Wed Feb 28 17:31:01 1996
Wed Feb 28 17:32:01 1996 | @ 5 hours | Wed Feb 28 22:32:01 1996 | Wed Feb 28 12:32:01 1996
Thu Feb 29 17:32:01 1996 | @ 1 min | Thu Feb 29 17:33:01 1996 | Thu Feb 29 17:31:01 1996
Thu Feb 29 17:32:01 1996 | @ 5 hours | Thu Feb 29 22:32:01 1996 | Thu Feb 29 12:32:01 1996
Fri Mar 01 17:32:01 1996 | @ 1 min | Fri Mar 01 17:33:01 1996 | Fri Mar 01 17:31:01 1996
Fri Mar 01 17:32:01 1996 | @ 5 hours | Fri Mar 01 22:32:01 1996 | Fri Mar 01 12:32:01 1996
Mon Dec 30 17:32:01 1996 | @ 1 min | Mon Dec 30 17:33:01 1996 | Mon Dec 30 17:31:01 1996
Mon Dec 30 17:32:01 1996 | @ 5 hours | Mon Dec 30 22:32:01 1996 | Mon Dec 30 12:32:01 1996
Tue Dec 31 17:32:01 1996 | @ 1 min | Tue Dec 31 17:33:01 1996 | Tue Dec 31 17:31:01 1996
Tue Dec 31 17:32:01 1996 | @ 5 hours | Tue Dec 31 22:32:01 1996 | Tue Dec 31 12:32:01 1996
Wed Jan 01 17:32:01 1997 | @ 1 min | Wed Jan 01 17:33:01 1997 | Wed Jan 01 17:31:01 1997
Wed Jan 01 17:32:01 1997 | @ 5 hours | Wed Jan 01 22:32:01 1997 | Wed Jan 01 12:32:01 1997
Thu Jan 02 00:00:00 1997 | @ 1 min | Thu Jan 02 00:01:00 1997 | Wed Jan 01 23:59:00 1997
Thu Jan 02 00:00:00 1997 | @ 5 hours | Thu Jan 02 05:00:00 1997 | Wed Jan 01 19:00:00 1997
Thu Jan 02 03:04:05 1997 | @ 1 min | Thu Jan 02 03:05:05 1997 | Thu Jan 02 03:03:05 1997
Thu Jan 02 03:04:05 1997 | @ 5 hours | Thu Jan 02 08:04:05 1997 | Wed Jan 01 22:04:05 1997
Mon Feb 10 17:32:00 1997 | @ 1 min | Mon Feb 10 17:33:00 1997 | Mon Feb 10 17:31:00 1997
Mon Feb 10 17:32:00 1997 | @ 5 hours | Mon Feb 10 22:32:00 1997 | Mon Feb 10 12:32:00 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01.40 1997 | @ 1 min | Mon Feb 10 17:33:01.40 1997 | Mon Feb 10 17:31:01.40 1997
Mon Feb 10 17:32:01.40 1997 | @ 5 hours | Mon Feb 10 22:32:01.40 1997 | Mon Feb 10 12:32:01.40 1997
Mon Feb 10 17:32:01.50 1997 | @ 1 min | Mon Feb 10 17:33:01.50 1997 | Mon Feb 10 17:31:01.50 1997
Mon Feb 10 17:32:01.50 1997 | @ 5 hours | Mon Feb 10 22:32:01.50 1997 | Mon Feb 10 12:32:01.50 1997
Mon Feb 10 17:32:01.60 1997 | @ 1 min | Mon Feb 10 17:33:01.60 1997 | Mon Feb 10 17:31:01.60 1997
Mon Feb 10 17:32:01.60 1997 | @ 5 hours | Mon Feb 10 22:32:01.60 1997 | Mon Feb 10 12:32:01.60 1997
Mon Feb 10 17:32:02 1997 | @ 1 min | Mon Feb 10 17:33:02 1997 | Mon Feb 10 17:31:02 1997
Mon Feb 10 17:32:02 1997 | @ 5 hours | Mon Feb 10 22:32:02 1997 | Mon Feb 10 12:32:02 1997
Tue Feb 11 17:32:01 1997 | @ 1 min | Tue Feb 11 17:33:01 1997 | Tue Feb 11 17:31:01 1997
Tue Feb 11 17:32:01 1997 | @ 5 hours | Tue Feb 11 22:32:01 1997 | Tue Feb 11 12:32:01 1997
Wed Feb 12 17:32:01 1997 | @ 1 min | Wed Feb 12 17:33:01 1997 | Wed Feb 12 17:31:01 1997
Wed Feb 12 17:32:01 1997 | @ 5 hours | Wed Feb 12 22:32:01 1997 | Wed Feb 12 12:32:01 1997
Thu Feb 13 17:32:01 1997 | @ 1 min | Thu Feb 13 17:33:01 1997 | Thu Feb 13 17:31:01 1997
Thu Feb 13 17:32:01 1997 | @ 5 hours | Thu Feb 13 22:32:01 1997 | Thu Feb 13 12:32:01 1997
Fri Feb 14 17:32:01 1997 | @ 1 min | Fri Feb 14 17:33:01 1997 | Fri Feb 14 17:31:01 1997
Fri Feb 14 17:32:01 1997 | @ 5 hours | Fri Feb 14 22:32:01 1997 | Fri Feb 14 12:32:01 1997
Sat Feb 15 17:32:01 1997 | @ 1 min | Sat Feb 15 17:33:01 1997 | Sat Feb 15 17:31:01 1997
Sat Feb 15 17:32:01 1997 | @ 5 hours | Sat Feb 15 22:32:01 1997 | Sat Feb 15 12:32:01 1997
Sun Feb 16 17:32:01 1997 | @ 1 min | Sun Feb 16 17:33:01 1997 | Sun Feb 16 17:31:01 1997
Sun Feb 16 17:32:01 1997 | @ 1 min | Sun Feb 16 17:33:01 1997 | Sun Feb 16 17:31:01 1997
Sun Feb 16 17:32:01 1997 | @ 5 hours | Sun Feb 16 22:32:01 1997 | Sun Feb 16 12:32:01 1997
Sun Feb 16 17:32:01 1997 | @ 5 hours | Sun Feb 16 22:32:01 1997 | Sun Feb 16 12:32:01 1997
Fri Feb 28 17:32:01 1997 | @ 1 min | Fri Feb 28 17:33:01 1997 | Fri Feb 28 17:31:01 1997
Fri Feb 28 17:32:01 1997 | @ 5 hours | Fri Feb 28 22:32:01 1997 | Fri Feb 28 12:32:01 1997
Sat Mar 01 17:32:01 1997 | @ 1 min | Sat Mar 01 17:33:01 1997 | Sat Mar 01 17:31:01 1997
Sat Mar 01 17:32:01 1997 | @ 5 hours | Sat Mar 01 22:32:01 1997 | Sat Mar 01 12:32:01 1997
Tue Jun 10 17:32:01 1997 | @ 1 min | Tue Jun 10 17:33:01 1997 | Tue Jun 10 17:31:01 1997
Tue Jun 10 17:32:01 1997 | @ 5 hours | Tue Jun 10 22:32:01 1997 | Tue Jun 10 12:32:01 1997
Tue Jun 10 18:32:01 1997 | @ 1 min | Tue Jun 10 18:33:01 1997 | Tue Jun 10 18:31:01 1997
Tue Jun 10 18:32:01 1997 | @ 5 hours | Tue Jun 10 23:32:01 1997 | Tue Jun 10 13:32:01 1997
Tue Dec 30 17:32:01 1997 | @ 1 min | Tue Dec 30 17:33:01 1997 | Tue Dec 30 17:31:01 1997
Tue Dec 30 17:32:01 1997 | @ 5 hours | Tue Dec 30 22:32:01 1997 | Tue Dec 30 12:32:01 1997
Wed Dec 31 17:32:01 1997 | @ 1 min | Wed Dec 31 17:33:01 1997 | Wed Dec 31 17:31:01 1997
Wed Dec 31 17:32:01 1997 | @ 5 hours | Wed Dec 31 22:32:01 1997 | Wed Dec 31 12:32:01 1997
Fri Dec 31 17:32:01 1999 | @ 1 min | Fri Dec 31 17:33:01 1999 | Fri Dec 31 17:31:01 1999
Fri Dec 31 17:32:01 1999 | @ 5 hours | Fri Dec 31 22:32:01 1999 | Fri Dec 31 12:32:01 1999
Sat Jan 01 17:32:01 2000 | @ 1 min | Sat Jan 01 17:33:01 2000 | Sat Jan 01 17:31:01 2000
Sat Jan 01 17:32:01 2000 | @ 5 hours | Sat Jan 01 22:32:01 2000 | Sat Jan 01 12:32:01 2000
Wed Mar 15 02:14:05 2000 | @ 1 min | Wed Mar 15 02:15:05 2000 | Wed Mar 15 02:13:05 2000
Wed Mar 15 02:14:05 2000 | @ 5 hours | Wed Mar 15 07:14:05 2000 | Tue Mar 14 21:14:05 2000
Wed Mar 15 03:14:04 2000 | @ 1 min | Wed Mar 15 03:15:04 2000 | Wed Mar 15 03:13:04 2000
Wed Mar 15 03:14:04 2000 | @ 5 hours | Wed Mar 15 08:14:04 2000 | Tue Mar 14 22:14:04 2000
Wed Mar 15 08:14:01 2000 | @ 1 min | Wed Mar 15 08:15:01 2000 | Wed Mar 15 08:13:01 2000
Wed Mar 15 08:14:01 2000 | @ 5 hours | Wed Mar 15 13:14:01 2000 | Wed Mar 15 03:14:01 2000
Wed Mar 15 12:14:03 2000 | @ 1 min | Wed Mar 15 12:15:03 2000 | Wed Mar 15 12:13:03 2000
Wed Mar 15 12:14:03 2000 | @ 5 hours | Wed Mar 15 17:14:03 2000 | Wed Mar 15 07:14:03 2000
Wed Mar 15 13:14:02 2000 | @ 1 min | Wed Mar 15 13:15:02 2000 | Wed Mar 15 13:13:02 2000
Wed Mar 15 13:14:02 2000 | @ 5 hours | Wed Mar 15 18:14:02 2000 | Wed Mar 15 08:14:02 2000
Sun Dec 31 17:32:01 2000 | @ 1 min | Sun Dec 31 17:33:01 2000 | Sun Dec 31 17:31:01 2000
Sun Dec 31 17:32:01 2000 | @ 5 hours | Sun Dec 31 22:32:01 2000 | Sun Dec 31 12:32:01 2000
t | i | add | subtract
----------------------------+-----------+----------------------------+----------------------------
Wed Feb 28 17:32:01 1996 | @ 1 min | Wed Feb 28 17:33:01 1996 | Wed Feb 28 17:31:01 1996
Wed Feb 28 17:32:01 1996 | @ 5 hours | Wed Feb 28 22:32:01 1996 | Wed Feb 28 12:32:01 1996
Thu Feb 29 17:32:01 1996 | @ 1 min | Thu Feb 29 17:33:01 1996 | Thu Feb 29 17:31:01 1996
Thu Feb 29 17:32:01 1996 | @ 5 hours | Thu Feb 29 22:32:01 1996 | Thu Feb 29 12:32:01 1996
Fri Mar 01 17:32:01 1996 | @ 1 min | Fri Mar 01 17:33:01 1996 | Fri Mar 01 17:31:01 1996
Fri Mar 01 17:32:01 1996 | @ 5 hours | Fri Mar 01 22:32:01 1996 | Fri Mar 01 12:32:01 1996
Mon Dec 30 17:32:01 1996 | @ 1 min | Mon Dec 30 17:33:01 1996 | Mon Dec 30 17:31:01 1996
Mon Dec 30 17:32:01 1996 | @ 5 hours | Mon Dec 30 22:32:01 1996 | Mon Dec 30 12:32:01 1996
Tue Dec 31 17:32:01 1996 | @ 1 min | Tue Dec 31 17:33:01 1996 | Tue Dec 31 17:31:01 1996
Tue Dec 31 17:32:01 1996 | @ 5 hours | Tue Dec 31 22:32:01 1996 | Tue Dec 31 12:32:01 1996
Wed Jan 01 17:32:01 1997 | @ 1 min | Wed Jan 01 17:33:01 1997 | Wed Jan 01 17:31:01 1997
Wed Jan 01 17:32:01 1997 | @ 5 hours | Wed Jan 01 22:32:01 1997 | Wed Jan 01 12:32:01 1997
Thu Jan 02 00:00:00 1997 | @ 1 min | Thu Jan 02 00:01:00 1997 | Wed Jan 01 23:59:00 1997
Thu Jan 02 00:00:00 1997 | @ 5 hours | Thu Jan 02 05:00:00 1997 | Wed Jan 01 19:00:00 1997
Thu Jan 02 03:04:05 1997 | @ 1 min | Thu Jan 02 03:05:05 1997 | Thu Jan 02 03:03:05 1997
Thu Jan 02 03:04:05 1997 | @ 5 hours | Thu Jan 02 08:04:05 1997 | Wed Jan 01 22:04:05 1997
Mon Feb 10 17:32:00 1997 | @ 1 min | Mon Feb 10 17:33:00 1997 | Mon Feb 10 17:31:00 1997
Mon Feb 10 17:32:00 1997 | @ 5 hours | Mon Feb 10 22:32:00 1997 | Mon Feb 10 12:32:00 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 1 min | Mon Feb 10 17:33:01 1997 | Mon Feb 10 17:31:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01 1997 | @ 5 hours | Mon Feb 10 22:32:01 1997 | Mon Feb 10 12:32:01 1997
Mon Feb 10 17:32:01.4 1997 | @ 1 min | Mon Feb 10 17:33:01.4 1997 | Mon Feb 10 17:31:01.4 1997
Mon Feb 10 17:32:01.4 1997 | @ 5 hours | Mon Feb 10 22:32:01.4 1997 | Mon Feb 10 12:32:01.4 1997
Mon Feb 10 17:32:01.5 1997 | @ 1 min | Mon Feb 10 17:33:01.5 1997 | Mon Feb 10 17:31:01.5 1997
Mon Feb 10 17:32:01.5 1997 | @ 5 hours | Mon Feb 10 22:32:01.5 1997 | Mon Feb 10 12:32:01.5 1997
Mon Feb 10 17:32:01.6 1997 | @ 1 min | Mon Feb 10 17:33:01.6 1997 | Mon Feb 10 17:31:01.6 1997
Mon Feb 10 17:32:01.6 1997 | @ 5 hours | Mon Feb 10 22:32:01.6 1997 | Mon Feb 10 12:32:01.6 1997
Mon Feb 10 17:32:02 1997 | @ 1 min | Mon Feb 10 17:33:02 1997 | Mon Feb 10 17:31:02 1997
Mon Feb 10 17:32:02 1997 | @ 5 hours | Mon Feb 10 22:32:02 1997 | Mon Feb 10 12:32:02 1997
Tue Feb 11 17:32:01 1997 | @ 1 min | Tue Feb 11 17:33:01 1997 | Tue Feb 11 17:31:01 1997
Tue Feb 11 17:32:01 1997 | @ 5 hours | Tue Feb 11 22:32:01 1997 | Tue Feb 11 12:32:01 1997
Wed Feb 12 17:32:01 1997 | @ 1 min | Wed Feb 12 17:33:01 1997 | Wed Feb 12 17:31:01 1997
Wed Feb 12 17:32:01 1997 | @ 5 hours | Wed Feb 12 22:32:01 1997 | Wed Feb 12 12:32:01 1997
Thu Feb 13 17:32:01 1997 | @ 1 min | Thu Feb 13 17:33:01 1997 | Thu Feb 13 17:31:01 1997
Thu Feb 13 17:32:01 1997 | @ 5 hours | Thu Feb 13 22:32:01 1997 | Thu Feb 13 12:32:01 1997
Fri Feb 14 17:32:01 1997 | @ 1 min | Fri Feb 14 17:33:01 1997 | Fri Feb 14 17:31:01 1997
Fri Feb 14 17:32:01 1997 | @ 5 hours | Fri Feb 14 22:32:01 1997 | Fri Feb 14 12:32:01 1997
Sat Feb 15 17:32:01 1997 | @ 1 min | Sat Feb 15 17:33:01 1997 | Sat Feb 15 17:31:01 1997
Sat Feb 15 17:32:01 1997 | @ 5 hours | Sat Feb 15 22:32:01 1997 | Sat Feb 15 12:32:01 1997
Sun Feb 16 17:32:01 1997 | @ 1 min | Sun Feb 16 17:33:01 1997 | Sun Feb 16 17:31:01 1997
Sun Feb 16 17:32:01 1997 | @ 1 min | Sun Feb 16 17:33:01 1997 | Sun Feb 16 17:31:01 1997
Sun Feb 16 17:32:01 1997 | @ 5 hours | Sun Feb 16 22:32:01 1997 | Sun Feb 16 12:32:01 1997
Sun Feb 16 17:32:01 1997 | @ 5 hours | Sun Feb 16 22:32:01 1997 | Sun Feb 16 12:32:01 1997
Fri Feb 28 17:32:01 1997 | @ 1 min | Fri Feb 28 17:33:01 1997 | Fri Feb 28 17:31:01 1997
Fri Feb 28 17:32:01 1997 | @ 5 hours | Fri Feb 28 22:32:01 1997 | Fri Feb 28 12:32:01 1997
Sat Mar 01 17:32:01 1997 | @ 1 min | Sat Mar 01 17:33:01 1997 | Sat Mar 01 17:31:01 1997
Sat Mar 01 17:32:01 1997 | @ 5 hours | Sat Mar 01 22:32:01 1997 | Sat Mar 01 12:32:01 1997
Tue Jun 10 17:32:01 1997 | @ 1 min | Tue Jun 10 17:33:01 1997 | Tue Jun 10 17:31:01 1997
Tue Jun 10 17:32:01 1997 | @ 5 hours | Tue Jun 10 22:32:01 1997 | Tue Jun 10 12:32:01 1997
Tue Jun 10 18:32:01 1997 | @ 1 min | Tue Jun 10 18:33:01 1997 | Tue Jun 10 18:31:01 1997
Tue Jun 10 18:32:01 1997 | @ 5 hours | Tue Jun 10 23:32:01 1997 | Tue Jun 10 13:32:01 1997
Tue Dec 30 17:32:01 1997 | @ 1 min | Tue Dec 30 17:33:01 1997 | Tue Dec 30 17:31:01 1997
Tue Dec 30 17:32:01 1997 | @ 5 hours | Tue Dec 30 22:32:01 1997 | Tue Dec 30 12:32:01 1997
Wed Dec 31 17:32:01 1997 | @ 1 min | Wed Dec 31 17:33:01 1997 | Wed Dec 31 17:31:01 1997
Wed Dec 31 17:32:01 1997 | @ 5 hours | Wed Dec 31 22:32:01 1997 | Wed Dec 31 12:32:01 1997
Fri Dec 31 17:32:01 1999 | @ 1 min | Fri Dec 31 17:33:01 1999 | Fri Dec 31 17:31:01 1999
Fri Dec 31 17:32:01 1999 | @ 5 hours | Fri Dec 31 22:32:01 1999 | Fri Dec 31 12:32:01 1999
Sat Jan 01 17:32:01 2000 | @ 1 min | Sat Jan 01 17:33:01 2000 | Sat Jan 01 17:31:01 2000
Sat Jan 01 17:32:01 2000 | @ 5 hours | Sat Jan 01 22:32:01 2000 | Sat Jan 01 12:32:01 2000
Wed Mar 15 02:14:05 2000 | @ 1 min | Wed Mar 15 02:15:05 2000 | Wed Mar 15 02:13:05 2000
Wed Mar 15 02:14:05 2000 | @ 5 hours | Wed Mar 15 07:14:05 2000 | Tue Mar 14 21:14:05 2000
Wed Mar 15 03:14:04 2000 | @ 1 min | Wed Mar 15 03:15:04 2000 | Wed Mar 15 03:13:04 2000
Wed Mar 15 03:14:04 2000 | @ 5 hours | Wed Mar 15 08:14:04 2000 | Tue Mar 14 22:14:04 2000
Wed Mar 15 08:14:01 2000 | @ 1 min | Wed Mar 15 08:15:01 2000 | Wed Mar 15 08:13:01 2000
Wed Mar 15 08:14:01 2000 | @ 5 hours | Wed Mar 15 13:14:01 2000 | Wed Mar 15 03:14:01 2000
Wed Mar 15 12:14:03 2000 | @ 1 min | Wed Mar 15 12:15:03 2000 | Wed Mar 15 12:13:03 2000
Wed Mar 15 12:14:03 2000 | @ 5 hours | Wed Mar 15 17:14:03 2000 | Wed Mar 15 07:14:03 2000
Wed Mar 15 13:14:02 2000 | @ 1 min | Wed Mar 15 13:15:02 2000 | Wed Mar 15 13:13:02 2000
Wed Mar 15 13:14:02 2000 | @ 5 hours | Wed Mar 15 18:14:02 2000 | Wed Mar 15 08:14:02 2000
Sun Dec 31 17:32:01 2000 | @ 1 min | Sun Dec 31 17:33:01 2000 | Sun Dec 31 17:31:01 2000
Sun Dec 31 17:32:01 2000 | @ 5 hours | Sun Dec 31 22:32:01 2000 | Sun Dec 31 12:32:01 2000
(104 rows)
SELECT t.f1 AS t, i.f1 AS i, t.f1 + i.f1 AS "add", t.f1 - i.f1 AS "subtract"
@ -2182,9 +2182,9 @@ SELECT '' AS "64", d1 AS us_postgres FROM TIMESTAMP_TBL;
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:02 1997
| Mon Feb 10 17:32:01.40 1997
| Mon Feb 10 17:32:01.50 1997
| Mon Feb 10 17:32:01.60 1997
| Mon Feb 10 17:32:01.4 1997
| Mon Feb 10 17:32:01.5 1997
| Mon Feb 10 17:32:01.6 1997
| Thu Jan 02 00:00:00 1997
| Thu Jan 02 03:04:05 1997
| Mon Feb 10 17:32:01 1997
@ -2265,9 +2265,9 @@ SELECT '' AS "64", d1 AS us_iso FROM TIMESTAMP_TBL;
| 1997-02-10 17:32:01
| 1997-02-10 17:32:01
| 1997-02-10 17:32:02
| 1997-02-10 17:32:01.40
| 1997-02-10 17:32:01.50
| 1997-02-10 17:32:01.60
| 1997-02-10 17:32:01.4
| 1997-02-10 17:32:01.5
| 1997-02-10 17:32:01.6
| 1997-01-02 00:00:00
| 1997-01-02 03:04:05
| 1997-02-10 17:32:01
@ -2354,9 +2354,9 @@ SELECT '' AS "64", d1 AS us_sql FROM TIMESTAMP_TBL;
| 02/10/1997 17:32:01
| 02/10/1997 17:32:01
| 02/10/1997 17:32:02
| 02/10/1997 17:32:01.40
| 02/10/1997 17:32:01.50
| 02/10/1997 17:32:01.60
| 02/10/1997 17:32:01.4
| 02/10/1997 17:32:01.5
| 02/10/1997 17:32:01.6
| 01/02/1997 00:00:00
| 01/02/1997 03:04:05
| 02/10/1997 17:32:01
@ -2450,9 +2450,9 @@ SELECT '' AS "65", d1 AS european_postgres FROM TIMESTAMP_TBL;
| Mon 10 Feb 17:32:01 1997
| Mon 10 Feb 17:32:01 1997
| Mon 10 Feb 17:32:02 1997
| Mon 10 Feb 17:32:01.40 1997
| Mon 10 Feb 17:32:01.50 1997
| Mon 10 Feb 17:32:01.60 1997
| Mon 10 Feb 17:32:01.4 1997
| Mon 10 Feb 17:32:01.5 1997
| Mon 10 Feb 17:32:01.6 1997
| Thu 02 Jan 00:00:00 1997
| Thu 02 Jan 03:04:05 1997
| Mon 10 Feb 17:32:01 1997
@ -2540,9 +2540,9 @@ SELECT '' AS "65", d1 AS european_iso FROM TIMESTAMP_TBL;
| 1997-02-10 17:32:01
| 1997-02-10 17:32:01
| 1997-02-10 17:32:02
| 1997-02-10 17:32:01.40
| 1997-02-10 17:32:01.50
| 1997-02-10 17:32:01.60
| 1997-02-10 17:32:01.4
| 1997-02-10 17:32:01.5
| 1997-02-10 17:32:01.6
| 1997-01-02 00:00:00
| 1997-01-02 03:04:05
| 1997-02-10 17:32:01
@ -2630,9 +2630,9 @@ SELECT '' AS "65", d1 AS european_sql FROM TIMESTAMP_TBL;
| 10/02/1997 17:32:01
| 10/02/1997 17:32:01
| 10/02/1997 17:32:02
| 10/02/1997 17:32:01.40
| 10/02/1997 17:32:01.50
| 10/02/1997 17:32:01.60
| 10/02/1997 17:32:01.4
| 10/02/1997 17:32:01.5
| 10/02/1997 17:32:01.6
| 02/01/1997 00:00:00
| 02/01/1997 03:04:05
| 10/02/1997 17:32:01

View File

@ -223,7 +223,7 @@ FROM INTERVAL_MULDIV_TBL;
1 year 12 days 122:24:00
-1 years -12 days +93:36:00
-3 days -14:24:00
2 mons 13 days 01:22:28.80
2 mons 13 days 01:22:28.8
-10 mons +120 days 37:28:21.6567
1 mon 6 days
4 mons 6 days
@ -237,7 +237,7 @@ FROM INTERVAL_MULDIV_TBL;
28 years 104 days 2961:36:00
-28 years -104 days +2942:24:00
-98 days -09:36:00
6 years 1 mon -197 days +93:34:27.20
6 years 1 mon -197 days +93:34:27.2
-24 years -7 mons +3946 days 640:15:11.9498
2 years 8 mons 24 days
9 years 6 mons 24 days
@ -251,7 +251,7 @@ FROM INTERVAL_MULDIV_TBL;
4 mons 4 days 40:48:00
-4 mons -4 days +31:12:00
-1 days -04:48:00
25 days -15:32:30.40
25 days -15:32:30.4
-3 mons +30 days 12:29:27.2189
12 days
1 mon 12 days
@ -655,9 +655,9 @@ select interval '0' AS "zero",
(interval '1-2' + interval '3 4:05:06.7') AS "all fields",
(interval '1-2' - interval '3 4:05:06.7') AS "mixed sign",
(- interval '1-2' + interval '3 4:05:06.7') AS "negative";
zero | a year 2 months | a bit over a day | a bit over 2 hours | all fields | mixed sign | negative
------+-----------------+------------------+--------------------+-------------------+-----------------------+---------------------
PT0S | P1Y2M | P1DT2H3M4S | PT2H3M4.45679S | P1Y2M3DT4H5M6.70S | P1Y2M-3DT-4H-5M-6.70S | P-1Y-2M3DT4H5M6.70S
zero | a year 2 months | a bit over a day | a bit over 2 hours | all fields | mixed sign | negative
------+-----------------+------------------+--------------------+------------------+----------------------+--------------------
PT0S | P1Y2M | P1DT2H3M4S | PT2H3M4.45679S | P1Y2M3DT4H5M6.7S | P1Y2M-3DT-4H-5M-6.7S | P-1Y-2M3DT4H5M6.7S
(1 row)
-- test inputting ISO 8601 4.4.2.1 "Format With Time Unit Designators"
@ -669,9 +669,9 @@ select interval 'P0Y' AS "zero",
interval 'P1Y2M3DT4H5M6.7S' AS "all fields",
interval 'P-1Y-2M-3DT-4H-5M-6.7S' AS "negative",
interval 'PT-0.1S' AS "fractional second";
zero | a year 2 months | a week | a bit over a day | all fields | negative | fractional second
------+-----------------+-----------+------------------+---------------------+---------------------+-------------------
0 | 1-2 | 7 0:00:00 | 1 2:03:04 | +1-2 +3 +4:05:06.70 | -1-2 -3 -4:05:06.70 | -0:00:00.10
zero | a year 2 months | a week | a bit over a day | all fields | negative | fractional second
------+-----------------+-----------+------------------+--------------------+--------------------+-------------------
0 | 1-2 | 7 0:00:00 | 1 2:03:04 | +1-2 +3 +4:05:06.7 | -1-2 -3 -4:05:06.7 | -0:00:00.1
(1 row)
-- test inputting ISO 8601 4.4.2.2 "Alternative Format"
@ -697,3 +697,23 @@ select interval 'P0002' AS "year only",
2 years | 2 years 10 mons | 2 years 10 mons 15 days | 2 years 00:00:01 | 2 years 10 mons 00:00:01 | 2 years 10 mons 15 days 00:00:01 | 10:00:00 | 10:30:00
(1 row)
-- test a couple rounding cases that changed since 8.3 w/ HAVE_INT64_TIMESTAMP.
SET IntervalStyle to postgres_verbose;
select interval '-10 mons -3 days +03:55:06.70';
interval
--------------------------------------------------
@ 10 mons 3 days -3 hours -55 mins -6.7 secs ago
(1 row)
select interval '1 year 2 mons 3 days 04:05:06.699999';
interval
-----------------------------------------------------
@ 1 year 2 mons 3 days 4 hours 5 mins 6.699999 secs
(1 row)
select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds';
interval | interval | interval
------------+------------+------------
@ 0.7 secs | @ 0.7 secs | @ 0.7 secs
(1 row)

View File

@ -193,9 +193,9 @@ SELECT '' AS "64", d1 FROM TIMESTAMP_TBL;
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:02 1997
| Mon Feb 10 17:32:01.40 1997
| Mon Feb 10 17:32:01.50 1997
| Mon Feb 10 17:32:01.60 1997
| Mon Feb 10 17:32:01.4 1997
| Mon Feb 10 17:32:01.5 1997
| Mon Feb 10 17:32:01.6 1997
| Thu Jan 02 00:00:00 1997
| Thu Jan 02 03:04:05 1997
| Mon Feb 10 17:32:01 1997
@ -257,15 +257,15 @@ SELECT '' AS "64", d1 FROM TIMESTAMP_TBL;
-- Demonstrate functions and operators
SELECT '' AS "48", d1 FROM TIMESTAMP_TBL
WHERE d1 > timestamp without time zone '1997-01-02';
48 | d1
----+-----------------------------
48 | d1
----+----------------------------
| infinity
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:02 1997
| Mon Feb 10 17:32:01.40 1997
| Mon Feb 10 17:32:01.50 1997
| Mon Feb 10 17:32:01.60 1997
| Mon Feb 10 17:32:01.4 1997
| Mon Feb 10 17:32:01.5 1997
| Mon Feb 10 17:32:01.6 1997
| Thu Jan 02 03:04:05 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
@ -348,9 +348,9 @@ SELECT '' AS "63", d1 FROM TIMESTAMP_TBL
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:02 1997
| Mon Feb 10 17:32:01.40 1997
| Mon Feb 10 17:32:01.50 1997
| Mon Feb 10 17:32:01.60 1997
| Mon Feb 10 17:32:01.4 1997
| Mon Feb 10 17:32:01.5 1997
| Mon Feb 10 17:32:01.6 1997
| Thu Jan 02 03:04:05 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
@ -432,15 +432,15 @@ SELECT '' AS "16", d1 FROM TIMESTAMP_TBL
SELECT '' AS "49", d1 FROM TIMESTAMP_TBL
WHERE d1 >= timestamp without time zone '1997-01-02';
49 | d1
----+-----------------------------
49 | d1
----+----------------------------
| infinity
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:01 1997
| Mon Feb 10 17:32:02 1997
| Mon Feb 10 17:32:01.40 1997
| Mon Feb 10 17:32:01.50 1997
| Mon Feb 10 17:32:01.60 1997
| Mon Feb 10 17:32:01.4 1997
| Mon Feb 10 17:32:01.5 1997
| Mon Feb 10 17:32:01.6 1997
| Thu Jan 02 00:00:00 1997
| Thu Jan 02 03:04:05 1997
| Mon Feb 10 17:32:01 1997
@ -494,9 +494,9 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 2 secs
| @ 39 days 17 hours 32 mins 1.40 secs
| @ 39 days 17 hours 32 mins 1.50 secs
| @ 39 days 17 hours 32 mins 1.60 secs
| @ 39 days 17 hours 32 mins 1.4 secs
| @ 39 days 17 hours 32 mins 1.5 secs
| @ 39 days 17 hours 32 mins 1.6 secs
| @ 0
| @ 3 hours 4 mins 5 secs
| @ 39 days 17 hours 32 mins 1 sec
@ -564,9 +564,9 @@ SELECT '' AS "54", d1 - timestamp without time zone '1997-01-02' AS diff
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 2 secs
| @ 39 days 17 hours 32 mins 1.40 secs
| @ 39 days 17 hours 32 mins 1.50 secs
| @ 39 days 17 hours 32 mins 1.60 secs
| @ 39 days 17 hours 32 mins 1.4 secs
| @ 39 days 17 hours 32 mins 1.5 secs
| @ 39 days 17 hours 32 mins 1.6 secs
| @ 0
| @ 3 hours 4 mins 5 secs
| @ 39 days 17 hours 32 mins 1 sec
@ -622,189 +622,189 @@ SELECT '' AS "54", d1 as "timestamp",
date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour,
date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second
FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamp | year | month | day | hour | minute | second
----+-----------------------------+------+-------+-----+------+--------+--------
| Thu Jan 01 00:00:00 1970 | 1970 | 1 | 1 | 0 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:02 1997 | 1997 | 2 | 10 | 17 | 32 | 2
| Mon Feb 10 17:32:01.40 1997 | 1997 | 2 | 10 | 17 | 32 | 1.4
| Mon Feb 10 17:32:01.50 1997 | 1997 | 2 | 10 | 17 | 32 | 1.5
| Mon Feb 10 17:32:01.60 1997 | 1997 | 2 | 10 | 17 | 32 | 1.6
| Thu Jan 02 00:00:00 1997 | 1997 | 1 | 2 | 0 | 0 | 0
| Thu Jan 02 03:04:05 1997 | 1997 | 1 | 2 | 3 | 4 | 5
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 17:32:01 1997 | 1997 | 6 | 10 | 17 | 32 | 1
| Sat Sep 22 18:19:20 2001 | 2001 | 9 | 22 | 18 | 19 | 20
| Wed Mar 15 08:14:01 2000 | 2000 | 3 | 15 | 8 | 14 | 1
| Wed Mar 15 13:14:02 2000 | 2000 | 3 | 15 | 13 | 14 | 2
| Wed Mar 15 12:14:03 2000 | 2000 | 3 | 15 | 12 | 14 | 3
| Wed Mar 15 03:14:04 2000 | 2000 | 3 | 15 | 3 | 14 | 4
| Wed Mar 15 02:14:05 2000 | 2000 | 3 | 15 | 2 | 14 | 5
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:00 1997 | 1997 | 2 | 10 | 17 | 32 | 0
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 18:32:01 1997 | 1997 | 6 | 10 | 18 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Feb 11 17:32:01 1997 | 1997 | 2 | 11 | 17 | 32 | 1
| Wed Feb 12 17:32:01 1997 | 1997 | 2 | 12 | 17 | 32 | 1
| Thu Feb 13 17:32:01 1997 | 1997 | 2 | 13 | 17 | 32 | 1
| Fri Feb 14 17:32:01 1997 | 1997 | 2 | 14 | 17 | 32 | 1
| Sat Feb 15 17:32:01 1997 | 1997 | 2 | 15 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1
| Wed Feb 28 17:32:01 1996 | 1996 | 2 | 28 | 17 | 32 | 1
| Thu Feb 29 17:32:01 1996 | 1996 | 2 | 29 | 17 | 32 | 1
| Fri Mar 01 17:32:01 1996 | 1996 | 3 | 1 | 17 | 32 | 1
| Mon Dec 30 17:32:01 1996 | 1996 | 12 | 30 | 17 | 32 | 1
| Tue Dec 31 17:32:01 1996 | 1996 | 12 | 31 | 17 | 32 | 1
| Wed Jan 01 17:32:01 1997 | 1997 | 1 | 1 | 17 | 32 | 1
| Fri Feb 28 17:32:01 1997 | 1997 | 2 | 28 | 17 | 32 | 1
| Sat Mar 01 17:32:01 1997 | 1997 | 3 | 1 | 17 | 32 | 1
| Tue Dec 30 17:32:01 1997 | 1997 | 12 | 30 | 17 | 32 | 1
| Wed Dec 31 17:32:01 1997 | 1997 | 12 | 31 | 17 | 32 | 1
| Fri Dec 31 17:32:01 1999 | 1999 | 12 | 31 | 17 | 32 | 1
| Sat Jan 01 17:32:01 2000 | 2000 | 1 | 1 | 17 | 32 | 1
| Sun Dec 31 17:32:01 2000 | 2000 | 12 | 31 | 17 | 32 | 1
| Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1 | 17 | 32 | 1
54 | timestamp | year | month | day | hour | minute | second
----+----------------------------+------+-------+-----+------+--------+--------
| Thu Jan 01 00:00:00 1970 | 1970 | 1 | 1 | 0 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:02 1997 | 1997 | 2 | 10 | 17 | 32 | 2
| Mon Feb 10 17:32:01.4 1997 | 1997 | 2 | 10 | 17 | 32 | 1.4
| Mon Feb 10 17:32:01.5 1997 | 1997 | 2 | 10 | 17 | 32 | 1.5
| Mon Feb 10 17:32:01.6 1997 | 1997 | 2 | 10 | 17 | 32 | 1.6
| Thu Jan 02 00:00:00 1997 | 1997 | 1 | 2 | 0 | 0 | 0
| Thu Jan 02 03:04:05 1997 | 1997 | 1 | 2 | 3 | 4 | 5
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 17:32:01 1997 | 1997 | 6 | 10 | 17 | 32 | 1
| Sat Sep 22 18:19:20 2001 | 2001 | 9 | 22 | 18 | 19 | 20
| Wed Mar 15 08:14:01 2000 | 2000 | 3 | 15 | 8 | 14 | 1
| Wed Mar 15 13:14:02 2000 | 2000 | 3 | 15 | 13 | 14 | 2
| Wed Mar 15 12:14:03 2000 | 2000 | 3 | 15 | 12 | 14 | 3
| Wed Mar 15 03:14:04 2000 | 2000 | 3 | 15 | 3 | 14 | 4
| Wed Mar 15 02:14:05 2000 | 2000 | 3 | 15 | 2 | 14 | 5
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:00 1997 | 1997 | 2 | 10 | 17 | 32 | 0
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 18:32:01 1997 | 1997 | 6 | 10 | 18 | 32 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Feb 11 17:32:01 1997 | 1997 | 2 | 11 | 17 | 32 | 1
| Wed Feb 12 17:32:01 1997 | 1997 | 2 | 12 | 17 | 32 | 1
| Thu Feb 13 17:32:01 1997 | 1997 | 2 | 13 | 17 | 32 | 1
| Fri Feb 14 17:32:01 1997 | 1997 | 2 | 14 | 17 | 32 | 1
| Sat Feb 15 17:32:01 1997 | 1997 | 2 | 15 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 | 1997 | 2 | 16 | 17 | 32 | 1
| Wed Feb 28 17:32:01 1996 | 1996 | 2 | 28 | 17 | 32 | 1
| Thu Feb 29 17:32:01 1996 | 1996 | 2 | 29 | 17 | 32 | 1
| Fri Mar 01 17:32:01 1996 | 1996 | 3 | 1 | 17 | 32 | 1
| Mon Dec 30 17:32:01 1996 | 1996 | 12 | 30 | 17 | 32 | 1
| Tue Dec 31 17:32:01 1996 | 1996 | 12 | 31 | 17 | 32 | 1
| Wed Jan 01 17:32:01 1997 | 1997 | 1 | 1 | 17 | 32 | 1
| Fri Feb 28 17:32:01 1997 | 1997 | 2 | 28 | 17 | 32 | 1
| Sat Mar 01 17:32:01 1997 | 1997 | 3 | 1 | 17 | 32 | 1
| Tue Dec 30 17:32:01 1997 | 1997 | 12 | 30 | 17 | 32 | 1
| Wed Dec 31 17:32:01 1997 | 1997 | 12 | 31 | 17 | 32 | 1
| Fri Dec 31 17:32:01 1999 | 1999 | 12 | 31 | 17 | 32 | 1
| Sat Jan 01 17:32:01 2000 | 2000 | 1 | 1 | 17 | 32 | 1
| Sun Dec 31 17:32:01 2000 | 2000 | 12 | 31 | 17 | 32 | 1
| Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1 | 17 | 32 | 1
(55 rows)
SELECT '' AS "54", d1 as "timestamp",
date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec,
date_part( 'usec', d1) AS usec
FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamp | quarter | msec | usec
----+-----------------------------+---------+-------+----------
| Thu Jan 01 00:00:00 1970 | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:02 1997 | 1 | 2000 | 2000000
| Mon Feb 10 17:32:01.40 1997 | 1 | 1400 | 1400000
| Mon Feb 10 17:32:01.50 1997 | 1 | 1500 | 1500000
| Mon Feb 10 17:32:01.60 1997 | 1 | 1600 | 1600000
| Thu Jan 02 00:00:00 1997 | 1 | 0 | 0
| Thu Jan 02 03:04:05 1997 | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Jun 10 17:32:01 1997 | 2 | 1000 | 1000000
| Sat Sep 22 18:19:20 2001 | 3 | 20000 | 20000000
| Wed Mar 15 08:14:01 2000 | 1 | 1000 | 1000000
| Wed Mar 15 13:14:02 2000 | 1 | 2000 | 2000000
| Wed Mar 15 12:14:03 2000 | 1 | 3000 | 3000000
| Wed Mar 15 03:14:04 2000 | 1 | 4000 | 4000000
| Wed Mar 15 02:14:05 2000 | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:00 1997 | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Jun 10 18:32:01 1997 | 2 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Feb 11 17:32:01 1997 | 1 | 1000 | 1000000
| Wed Feb 12 17:32:01 1997 | 1 | 1000 | 1000000
| Thu Feb 13 17:32:01 1997 | 1 | 1000 | 1000000
| Fri Feb 14 17:32:01 1997 | 1 | 1000 | 1000000
| Sat Feb 15 17:32:01 1997 | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000
| Wed Feb 28 17:32:01 1996 | 1 | 1000 | 1000000
| Thu Feb 29 17:32:01 1996 | 1 | 1000 | 1000000
| Fri Mar 01 17:32:01 1996 | 1 | 1000 | 1000000
| Mon Dec 30 17:32:01 1996 | 4 | 1000 | 1000000
| Tue Dec 31 17:32:01 1996 | 4 | 1000 | 1000000
| Wed Jan 01 17:32:01 1997 | 1 | 1000 | 1000000
| Fri Feb 28 17:32:01 1997 | 1 | 1000 | 1000000
| Sat Mar 01 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Dec 30 17:32:01 1997 | 4 | 1000 | 1000000
| Wed Dec 31 17:32:01 1997 | 4 | 1000 | 1000000
| Fri Dec 31 17:32:01 1999 | 4 | 1000 | 1000000
| Sat Jan 01 17:32:01 2000 | 1 | 1000 | 1000000
| Sun Dec 31 17:32:01 2000 | 4 | 1000 | 1000000
| Mon Jan 01 17:32:01 2001 | 1 | 1000 | 1000000
54 | timestamp | quarter | msec | usec
----+----------------------------+---------+-------+----------
| Thu Jan 01 00:00:00 1970 | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:02 1997 | 1 | 2000 | 2000000
| Mon Feb 10 17:32:01.4 1997 | 1 | 1400 | 1400000
| Mon Feb 10 17:32:01.5 1997 | 1 | 1500 | 1500000
| Mon Feb 10 17:32:01.6 1997 | 1 | 1600 | 1600000
| Thu Jan 02 00:00:00 1997 | 1 | 0 | 0
| Thu Jan 02 03:04:05 1997 | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Jun 10 17:32:01 1997 | 2 | 1000 | 1000000
| Sat Sep 22 18:19:20 2001 | 3 | 20000 | 20000000
| Wed Mar 15 08:14:01 2000 | 1 | 1000 | 1000000
| Wed Mar 15 13:14:02 2000 | 1 | 2000 | 2000000
| Wed Mar 15 12:14:03 2000 | 1 | 3000 | 3000000
| Wed Mar 15 03:14:04 2000 | 1 | 4000 | 4000000
| Wed Mar 15 02:14:05 2000 | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:00 1997 | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Jun 10 18:32:01 1997 | 2 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Feb 11 17:32:01 1997 | 1 | 1000 | 1000000
| Wed Feb 12 17:32:01 1997 | 1 | 1000 | 1000000
| Thu Feb 13 17:32:01 1997 | 1 | 1000 | 1000000
| Fri Feb 14 17:32:01 1997 | 1 | 1000 | 1000000
| Sat Feb 15 17:32:01 1997 | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 | 1 | 1000 | 1000000
| Wed Feb 28 17:32:01 1996 | 1 | 1000 | 1000000
| Thu Feb 29 17:32:01 1996 | 1 | 1000 | 1000000
| Fri Mar 01 17:32:01 1996 | 1 | 1000 | 1000000
| Mon Dec 30 17:32:01 1996 | 4 | 1000 | 1000000
| Tue Dec 31 17:32:01 1996 | 4 | 1000 | 1000000
| Wed Jan 01 17:32:01 1997 | 1 | 1000 | 1000000
| Fri Feb 28 17:32:01 1997 | 1 | 1000 | 1000000
| Sat Mar 01 17:32:01 1997 | 1 | 1000 | 1000000
| Tue Dec 30 17:32:01 1997 | 4 | 1000 | 1000000
| Wed Dec 31 17:32:01 1997 | 4 | 1000 | 1000000
| Fri Dec 31 17:32:01 1999 | 4 | 1000 | 1000000
| Sat Jan 01 17:32:01 2000 | 1 | 1000 | 1000000
| Sun Dec 31 17:32:01 2000 | 4 | 1000 | 1000000
| Mon Jan 01 17:32:01 2001 | 1 | 1000 | 1000000
(55 rows)
SELECT '' AS "54", d1 as "timestamp",
date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week,
date_part( 'dow', d1) AS dow
FROM TIMESTAMP_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamp | isoyear | week | dow
----+-----------------------------+---------+------+-----
| Thu Jan 01 00:00:00 1970 | 1970 | 1 | 4
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:02 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.40 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.50 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.60 1997 | 1997 | 7 | 1
| Thu Jan 02 00:00:00 1997 | 1997 | 1 | 4
| Thu Jan 02 03:04:05 1997 | 1997 | 1 | 4
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Jun 10 17:32:01 1997 | 1997 | 24 | 2
| Sat Sep 22 18:19:20 2001 | 2001 | 38 | 6
| Wed Mar 15 08:14:01 2000 | 2000 | 11 | 3
| Wed Mar 15 13:14:02 2000 | 2000 | 11 | 3
| Wed Mar 15 12:14:03 2000 | 2000 | 11 | 3
| Wed Mar 15 03:14:04 2000 | 2000 | 11 | 3
| Wed Mar 15 02:14:05 2000 | 2000 | 11 | 3
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:00 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Jun 10 18:32:01 1997 | 1997 | 24 | 2
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Feb 11 17:32:01 1997 | 1997 | 7 | 2
| Wed Feb 12 17:32:01 1997 | 1997 | 7 | 3
| Thu Feb 13 17:32:01 1997 | 1997 | 7 | 4
| Fri Feb 14 17:32:01 1997 | 1997 | 7 | 5
| Sat Feb 15 17:32:01 1997 | 1997 | 7 | 6
| Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0
| Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0
| Wed Feb 28 17:32:01 1996 | 1996 | 9 | 3
| Thu Feb 29 17:32:01 1996 | 1996 | 9 | 4
| Fri Mar 01 17:32:01 1996 | 1996 | 9 | 5
| Mon Dec 30 17:32:01 1996 | 1997 | 1 | 1
| Tue Dec 31 17:32:01 1996 | 1997 | 1 | 2
| Wed Jan 01 17:32:01 1997 | 1997 | 1 | 3
| Fri Feb 28 17:32:01 1997 | 1997 | 9 | 5
| Sat Mar 01 17:32:01 1997 | 1997 | 9 | 6
| Tue Dec 30 17:32:01 1997 | 1998 | 1 | 2
| Wed Dec 31 17:32:01 1997 | 1998 | 1 | 3
| Fri Dec 31 17:32:01 1999 | 1999 | 52 | 5
| Sat Jan 01 17:32:01 2000 | 1999 | 52 | 6
| Sun Dec 31 17:32:01 2000 | 2000 | 52 | 0
| Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1
54 | timestamp | isoyear | week | dow
----+----------------------------+---------+------+-----
| Thu Jan 01 00:00:00 1970 | 1970 | 1 | 4
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:02 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.4 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.5 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01.6 1997 | 1997 | 7 | 1
| Thu Jan 02 00:00:00 1997 | 1997 | 1 | 4
| Thu Jan 02 03:04:05 1997 | 1997 | 1 | 4
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Jun 10 17:32:01 1997 | 1997 | 24 | 2
| Sat Sep 22 18:19:20 2001 | 2001 | 38 | 6
| Wed Mar 15 08:14:01 2000 | 2000 | 11 | 3
| Wed Mar 15 13:14:02 2000 | 2000 | 11 | 3
| Wed Mar 15 12:14:03 2000 | 2000 | 11 | 3
| Wed Mar 15 03:14:04 2000 | 2000 | 11 | 3
| Wed Mar 15 02:14:05 2000 | 2000 | 11 | 3
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:00 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Jun 10 18:32:01 1997 | 1997 | 24 | 2
| Mon Feb 10 17:32:01 1997 | 1997 | 7 | 1
| Tue Feb 11 17:32:01 1997 | 1997 | 7 | 2
| Wed Feb 12 17:32:01 1997 | 1997 | 7 | 3
| Thu Feb 13 17:32:01 1997 | 1997 | 7 | 4
| Fri Feb 14 17:32:01 1997 | 1997 | 7 | 5
| Sat Feb 15 17:32:01 1997 | 1997 | 7 | 6
| Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0
| Sun Feb 16 17:32:01 1997 | 1997 | 7 | 0
| Wed Feb 28 17:32:01 1996 | 1996 | 9 | 3
| Thu Feb 29 17:32:01 1996 | 1996 | 9 | 4
| Fri Mar 01 17:32:01 1996 | 1996 | 9 | 5
| Mon Dec 30 17:32:01 1996 | 1997 | 1 | 1
| Tue Dec 31 17:32:01 1996 | 1997 | 1 | 2
| Wed Jan 01 17:32:01 1997 | 1997 | 1 | 3
| Fri Feb 28 17:32:01 1997 | 1997 | 9 | 5
| Sat Mar 01 17:32:01 1997 | 1997 | 9 | 6
| Tue Dec 30 17:32:01 1997 | 1998 | 1 | 2
| Wed Dec 31 17:32:01 1997 | 1998 | 1 | 3
| Fri Dec 31 17:32:01 1999 | 1999 | 52 | 5
| Sat Jan 01 17:32:01 2000 | 1999 | 52 | 6
| Sun Dec 31 17:32:01 2000 | 2000 | 52 | 0
| Mon Jan 01 17:32:01 2001 | 2001 | 1 | 1
(55 rows)
-- TO_CHAR()

View File

@ -264,9 +264,9 @@ SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL;
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:02 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
| Mon Feb 10 17:32:01.50 1997 PST
| Mon Feb 10 17:32:01.60 1997 PST
| Mon Feb 10 17:32:01.4 1997 PST
| Mon Feb 10 17:32:01.5 1997 PST
| Mon Feb 10 17:32:01.6 1997 PST
| Thu Jan 02 00:00:00 1997 PST
| Thu Jan 02 03:04:05 1997 PST
| Mon Feb 10 17:32:01 1997 PST
@ -329,15 +329,15 @@ SELECT '' AS "64", d1 FROM TIMESTAMPTZ_TBL;
-- Demonstrate functions and operators
SELECT '' AS "48", d1 FROM TIMESTAMPTZ_TBL
WHERE d1 > timestamp with time zone '1997-01-02';
48 | d1
----+---------------------------------
48 | d1
----+--------------------------------
| infinity
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:02 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
| Mon Feb 10 17:32:01.50 1997 PST
| Mon Feb 10 17:32:01.60 1997 PST
| Mon Feb 10 17:32:01.4 1997 PST
| Mon Feb 10 17:32:01.5 1997 PST
| Mon Feb 10 17:32:01.6 1997 PST
| Thu Jan 02 03:04:05 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
@ -421,9 +421,9 @@ SELECT '' AS "63", d1 FROM TIMESTAMPTZ_TBL
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:02 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
| Mon Feb 10 17:32:01.50 1997 PST
| Mon Feb 10 17:32:01.60 1997 PST
| Mon Feb 10 17:32:01.4 1997 PST
| Mon Feb 10 17:32:01.5 1997 PST
| Mon Feb 10 17:32:01.6 1997 PST
| Thu Jan 02 03:04:05 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
@ -506,15 +506,15 @@ SELECT '' AS "16", d1 FROM TIMESTAMPTZ_TBL
SELECT '' AS "49", d1 FROM TIMESTAMPTZ_TBL
WHERE d1 >= timestamp with time zone '1997-01-02';
49 | d1
----+---------------------------------
49 | d1
----+--------------------------------
| infinity
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:01 1997 PST
| Mon Feb 10 17:32:02 1997 PST
| Mon Feb 10 17:32:01.40 1997 PST
| Mon Feb 10 17:32:01.50 1997 PST
| Mon Feb 10 17:32:01.60 1997 PST
| Mon Feb 10 17:32:01.4 1997 PST
| Mon Feb 10 17:32:01.5 1997 PST
| Mon Feb 10 17:32:01.6 1997 PST
| Thu Jan 02 00:00:00 1997 PST
| Thu Jan 02 03:04:05 1997 PST
| Mon Feb 10 17:32:01 1997 PST
@ -569,9 +569,9 @@ SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 2 secs
| @ 39 days 17 hours 32 mins 1.40 secs
| @ 39 days 17 hours 32 mins 1.50 secs
| @ 39 days 17 hours 32 mins 1.60 secs
| @ 39 days 17 hours 32 mins 1.4 secs
| @ 39 days 17 hours 32 mins 1.5 secs
| @ 39 days 17 hours 32 mins 1.6 secs
| @ 0
| @ 3 hours 4 mins 5 secs
| @ 39 days 17 hours 32 mins 1 sec
@ -639,9 +639,9 @@ SELECT '' AS "54", d1 - timestamp with time zone '1997-01-02' AS diff
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 1 sec
| @ 39 days 17 hours 32 mins 2 secs
| @ 39 days 17 hours 32 mins 1.40 secs
| @ 39 days 17 hours 32 mins 1.50 secs
| @ 39 days 17 hours 32 mins 1.60 secs
| @ 39 days 17 hours 32 mins 1.4 secs
| @ 39 days 17 hours 32 mins 1.5 secs
| @ 39 days 17 hours 32 mins 1.6 secs
| @ 0
| @ 3 hours 4 mins 5 secs
| @ 39 days 17 hours 32 mins 1 sec
@ -698,192 +698,192 @@ SELECT '' AS "54", d1 as timestamptz,
date_part( 'day', d1) AS day, date_part( 'hour', d1) AS hour,
date_part( 'minute', d1) AS minute, date_part( 'second', d1) AS second
FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamptz | year | month | day | hour | minute | second
----+---------------------------------+------+-------+-----+------+--------+--------
| Wed Dec 31 16:00:00 1969 PST | 1969 | 12 | 31 | 16 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:02 1997 PST | 1997 | 2 | 10 | 17 | 32 | 2
| Mon Feb 10 17:32:01.40 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.4
| Mon Feb 10 17:32:01.50 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.5
| Mon Feb 10 17:32:01.60 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.6
| Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 2 | 0 | 0 | 0
| Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 2 | 3 | 4 | 5
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 17:32:01 1997 PDT | 1997 | 6 | 10 | 17 | 32 | 1
| Sat Sep 22 18:19:20 2001 PDT | 2001 | 9 | 22 | 18 | 19 | 20
| Wed Mar 15 08:14:01 2000 PST | 2000 | 3 | 15 | 8 | 14 | 1
| Wed Mar 15 04:14:02 2000 PST | 2000 | 3 | 15 | 4 | 14 | 2
| Wed Mar 15 02:14:03 2000 PST | 2000 | 3 | 15 | 2 | 14 | 3
| Wed Mar 15 03:14:04 2000 PST | 2000 | 3 | 15 | 3 | 14 | 4
| Wed Mar 15 01:14:05 2000 PST | 2000 | 3 | 15 | 1 | 14 | 5
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:00 1997 PST | 1997 | 2 | 10 | 17 | 32 | 0
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 14:32:01 1997 PST | 1997 | 2 | 10 | 14 | 32 | 1
| Thu Jul 10 14:32:01 1997 PDT | 1997 | 7 | 10 | 14 | 32 | 1
| Tue Jun 10 18:32:01 1997 PDT | 1997 | 6 | 10 | 18 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Feb 11 17:32:01 1997 PST | 1997 | 2 | 11 | 17 | 32 | 1
| Wed Feb 12 17:32:01 1997 PST | 1997 | 2 | 12 | 17 | 32 | 1
| Thu Feb 13 17:32:01 1997 PST | 1997 | 2 | 13 | 17 | 32 | 1
| Fri Feb 14 17:32:01 1997 PST | 1997 | 2 | 14 | 17 | 32 | 1
| Sat Feb 15 17:32:01 1997 PST | 1997 | 2 | 15 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1
| Wed Feb 28 17:32:01 1996 PST | 1996 | 2 | 28 | 17 | 32 | 1
| Thu Feb 29 17:32:01 1996 PST | 1996 | 2 | 29 | 17 | 32 | 1
| Fri Mar 01 17:32:01 1996 PST | 1996 | 3 | 1 | 17 | 32 | 1
| Mon Dec 30 17:32:01 1996 PST | 1996 | 12 | 30 | 17 | 32 | 1
| Tue Dec 31 17:32:01 1996 PST | 1996 | 12 | 31 | 17 | 32 | 1
| Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 1 | 17 | 32 | 1
| Fri Feb 28 17:32:01 1997 PST | 1997 | 2 | 28 | 17 | 32 | 1
| Sat Mar 01 17:32:01 1997 PST | 1997 | 3 | 1 | 17 | 32 | 1
| Tue Dec 30 17:32:01 1997 PST | 1997 | 12 | 30 | 17 | 32 | 1
| Wed Dec 31 17:32:01 1997 PST | 1997 | 12 | 31 | 17 | 32 | 1
| Fri Dec 31 17:32:01 1999 PST | 1999 | 12 | 31 | 17 | 32 | 1
| Sat Jan 01 17:32:01 2000 PST | 2000 | 1 | 1 | 17 | 32 | 1
| Sun Dec 31 17:32:01 2000 PST | 2000 | 12 | 31 | 17 | 32 | 1
| Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1 | 17 | 32 | 1
54 | timestamptz | year | month | day | hour | minute | second
----+--------------------------------+------+-------+-----+------+--------+--------
| Wed Dec 31 16:00:00 1969 PST | 1969 | 12 | 31 | 16 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:02 1997 PST | 1997 | 2 | 10 | 17 | 32 | 2
| Mon Feb 10 17:32:01.4 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.4
| Mon Feb 10 17:32:01.5 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.5
| Mon Feb 10 17:32:01.6 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1.6
| Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 2 | 0 | 0 | 0
| Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 2 | 3 | 4 | 5
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Jun 10 17:32:01 1997 PDT | 1997 | 6 | 10 | 17 | 32 | 1
| Sat Sep 22 18:19:20 2001 PDT | 2001 | 9 | 22 | 18 | 19 | 20
| Wed Mar 15 08:14:01 2000 PST | 2000 | 3 | 15 | 8 | 14 | 1
| Wed Mar 15 04:14:02 2000 PST | 2000 | 3 | 15 | 4 | 14 | 2
| Wed Mar 15 02:14:03 2000 PST | 2000 | 3 | 15 | 2 | 14 | 3
| Wed Mar 15 03:14:04 2000 PST | 2000 | 3 | 15 | 3 | 14 | 4
| Wed Mar 15 01:14:05 2000 PST | 2000 | 3 | 15 | 1 | 14 | 5
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:00 1997 PST | 1997 | 2 | 10 | 17 | 32 | 0
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 2 | 10 | 9 | 32 | 1
| Mon Feb 10 14:32:01 1997 PST | 1997 | 2 | 10 | 14 | 32 | 1
| Thu Jul 10 14:32:01 1997 PDT | 1997 | 7 | 10 | 14 | 32 | 1
| Tue Jun 10 18:32:01 1997 PDT | 1997 | 6 | 10 | 18 | 32 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 2 | 10 | 17 | 32 | 1
| Tue Feb 11 17:32:01 1997 PST | 1997 | 2 | 11 | 17 | 32 | 1
| Wed Feb 12 17:32:01 1997 PST | 1997 | 2 | 12 | 17 | 32 | 1
| Thu Feb 13 17:32:01 1997 PST | 1997 | 2 | 13 | 17 | 32 | 1
| Fri Feb 14 17:32:01 1997 PST | 1997 | 2 | 14 | 17 | 32 | 1
| Sat Feb 15 17:32:01 1997 PST | 1997 | 2 | 15 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1
| Sun Feb 16 17:32:01 1997 PST | 1997 | 2 | 16 | 17 | 32 | 1
| Wed Feb 28 17:32:01 1996 PST | 1996 | 2 | 28 | 17 | 32 | 1
| Thu Feb 29 17:32:01 1996 PST | 1996 | 2 | 29 | 17 | 32 | 1
| Fri Mar 01 17:32:01 1996 PST | 1996 | 3 | 1 | 17 | 32 | 1
| Mon Dec 30 17:32:01 1996 PST | 1996 | 12 | 30 | 17 | 32 | 1
| Tue Dec 31 17:32:01 1996 PST | 1996 | 12 | 31 | 17 | 32 | 1
| Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 1 | 17 | 32 | 1
| Fri Feb 28 17:32:01 1997 PST | 1997 | 2 | 28 | 17 | 32 | 1
| Sat Mar 01 17:32:01 1997 PST | 1997 | 3 | 1 | 17 | 32 | 1
| Tue Dec 30 17:32:01 1997 PST | 1997 | 12 | 30 | 17 | 32 | 1
| Wed Dec 31 17:32:01 1997 PST | 1997 | 12 | 31 | 17 | 32 | 1
| Fri Dec 31 17:32:01 1999 PST | 1999 | 12 | 31 | 17 | 32 | 1
| Sat Jan 01 17:32:01 2000 PST | 2000 | 1 | 1 | 17 | 32 | 1
| Sun Dec 31 17:32:01 2000 PST | 2000 | 12 | 31 | 17 | 32 | 1
| Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1 | 17 | 32 | 1
(56 rows)
SELECT '' AS "54", d1 as timestamptz,
date_part( 'quarter', d1) AS quarter, date_part( 'msec', d1) AS msec,
date_part( 'usec', d1) AS usec
FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamptz | quarter | msec | usec
----+---------------------------------+---------+-------+----------
| Wed Dec 31 16:00:00 1969 PST | 4 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:02 1997 PST | 1 | 2000 | 2000000
| Mon Feb 10 17:32:01.40 1997 PST | 1 | 1400 | 1400000
| Mon Feb 10 17:32:01.50 1997 PST | 1 | 1500 | 1500000
| Mon Feb 10 17:32:01.60 1997 PST | 1 | 1600 | 1600000
| Thu Jan 02 00:00:00 1997 PST | 1 | 0 | 0
| Thu Jan 02 03:04:05 1997 PST | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Jun 10 17:32:01 1997 PDT | 2 | 1000 | 1000000
| Sat Sep 22 18:19:20 2001 PDT | 3 | 20000 | 20000000
| Wed Mar 15 08:14:01 2000 PST | 1 | 1000 | 1000000
| Wed Mar 15 04:14:02 2000 PST | 1 | 2000 | 2000000
| Wed Mar 15 02:14:03 2000 PST | 1 | 3000 | 3000000
| Wed Mar 15 03:14:04 2000 PST | 1 | 4000 | 4000000
| Wed Mar 15 01:14:05 2000 PST | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:00 1997 PST | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 14:32:01 1997 PST | 1 | 1000 | 1000000
| Thu Jul 10 14:32:01 1997 PDT | 3 | 1000 | 1000000
| Tue Jun 10 18:32:01 1997 PDT | 2 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Feb 11 17:32:01 1997 PST | 1 | 1000 | 1000000
| Wed Feb 12 17:32:01 1997 PST | 1 | 1000 | 1000000
| Thu Feb 13 17:32:01 1997 PST | 1 | 1000 | 1000000
| Fri Feb 14 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sat Feb 15 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000
| Wed Feb 28 17:32:01 1996 PST | 1 | 1000 | 1000000
| Thu Feb 29 17:32:01 1996 PST | 1 | 1000 | 1000000
| Fri Mar 01 17:32:01 1996 PST | 1 | 1000 | 1000000
| Mon Dec 30 17:32:01 1996 PST | 4 | 1000 | 1000000
| Tue Dec 31 17:32:01 1996 PST | 4 | 1000 | 1000000
| Wed Jan 01 17:32:01 1997 PST | 1 | 1000 | 1000000
| Fri Feb 28 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sat Mar 01 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Dec 30 17:32:01 1997 PST | 4 | 1000 | 1000000
| Wed Dec 31 17:32:01 1997 PST | 4 | 1000 | 1000000
| Fri Dec 31 17:32:01 1999 PST | 4 | 1000 | 1000000
| Sat Jan 01 17:32:01 2000 PST | 1 | 1000 | 1000000
| Sun Dec 31 17:32:01 2000 PST | 4 | 1000 | 1000000
| Mon Jan 01 17:32:01 2001 PST | 1 | 1000 | 1000000
54 | timestamptz | quarter | msec | usec
----+--------------------------------+---------+-------+----------
| Wed Dec 31 16:00:00 1969 PST | 4 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:02 1997 PST | 1 | 2000 | 2000000
| Mon Feb 10 17:32:01.4 1997 PST | 1 | 1400 | 1400000
| Mon Feb 10 17:32:01.5 1997 PST | 1 | 1500 | 1500000
| Mon Feb 10 17:32:01.6 1997 PST | 1 | 1600 | 1600000
| Thu Jan 02 00:00:00 1997 PST | 1 | 0 | 0
| Thu Jan 02 03:04:05 1997 PST | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Jun 10 17:32:01 1997 PDT | 2 | 1000 | 1000000
| Sat Sep 22 18:19:20 2001 PDT | 3 | 20000 | 20000000
| Wed Mar 15 08:14:01 2000 PST | 1 | 1000 | 1000000
| Wed Mar 15 04:14:02 2000 PST | 1 | 2000 | 2000000
| Wed Mar 15 02:14:03 2000 PST | 1 | 3000 | 3000000
| Wed Mar 15 03:14:04 2000 PST | 1 | 4000 | 4000000
| Wed Mar 15 01:14:05 2000 PST | 1 | 5000 | 5000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:00 1997 PST | 1 | 0 | 0
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 09:32:01 1997 PST | 1 | 1000 | 1000000
| Mon Feb 10 14:32:01 1997 PST | 1 | 1000 | 1000000
| Thu Jul 10 14:32:01 1997 PDT | 3 | 1000 | 1000000
| Tue Jun 10 18:32:01 1997 PDT | 2 | 1000 | 1000000
| Mon Feb 10 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Feb 11 17:32:01 1997 PST | 1 | 1000 | 1000000
| Wed Feb 12 17:32:01 1997 PST | 1 | 1000 | 1000000
| Thu Feb 13 17:32:01 1997 PST | 1 | 1000 | 1000000
| Fri Feb 14 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sat Feb 15 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sun Feb 16 17:32:01 1997 PST | 1 | 1000 | 1000000
| Wed Feb 28 17:32:01 1996 PST | 1 | 1000 | 1000000
| Thu Feb 29 17:32:01 1996 PST | 1 | 1000 | 1000000
| Fri Mar 01 17:32:01 1996 PST | 1 | 1000 | 1000000
| Mon Dec 30 17:32:01 1996 PST | 4 | 1000 | 1000000
| Tue Dec 31 17:32:01 1996 PST | 4 | 1000 | 1000000
| Wed Jan 01 17:32:01 1997 PST | 1 | 1000 | 1000000
| Fri Feb 28 17:32:01 1997 PST | 1 | 1000 | 1000000
| Sat Mar 01 17:32:01 1997 PST | 1 | 1000 | 1000000
| Tue Dec 30 17:32:01 1997 PST | 4 | 1000 | 1000000
| Wed Dec 31 17:32:01 1997 PST | 4 | 1000 | 1000000
| Fri Dec 31 17:32:01 1999 PST | 4 | 1000 | 1000000
| Sat Jan 01 17:32:01 2000 PST | 1 | 1000 | 1000000
| Sun Dec 31 17:32:01 2000 PST | 4 | 1000 | 1000000
| Mon Jan 01 17:32:01 2001 PST | 1 | 1000 | 1000000
(56 rows)
SELECT '' AS "54", d1 as timestamptz,
date_part( 'isoyear', d1) AS isoyear, date_part( 'week', d1) AS week,
date_part( 'dow', d1) AS dow
FROM TIMESTAMPTZ_TBL WHERE d1 BETWEEN '1902-01-01' AND '2038-01-01';
54 | timestamptz | isoyear | week | dow
----+---------------------------------+---------+------+-----
| Wed Dec 31 16:00:00 1969 PST | 1970 | 1 | 3
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:02 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.40 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.50 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.60 1997 PST | 1997 | 7 | 1
| Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 4
| Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 4
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Tue Jun 10 17:32:01 1997 PDT | 1997 | 24 | 2
| Sat Sep 22 18:19:20 2001 PDT | 2001 | 38 | 6
| Wed Mar 15 08:14:01 2000 PST | 2000 | 11 | 3
| Wed Mar 15 04:14:02 2000 PST | 2000 | 11 | 3
| Wed Mar 15 02:14:03 2000 PST | 2000 | 11 | 3
| Wed Mar 15 03:14:04 2000 PST | 2000 | 11 | 3
| Wed Mar 15 01:14:05 2000 PST | 2000 | 11 | 3
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:00 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 14:32:01 1997 PST | 1997 | 7 | 1
| Thu Jul 10 14:32:01 1997 PDT | 1997 | 28 | 4
| Tue Jun 10 18:32:01 1997 PDT | 1997 | 24 | 2
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Tue Feb 11 17:32:01 1997 PST | 1997 | 7 | 2
| Wed Feb 12 17:32:01 1997 PST | 1997 | 7 | 3
| Thu Feb 13 17:32:01 1997 PST | 1997 | 7 | 4
| Fri Feb 14 17:32:01 1997 PST | 1997 | 7 | 5
| Sat Feb 15 17:32:01 1997 PST | 1997 | 7 | 6
| Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0
| Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0
| Wed Feb 28 17:32:01 1996 PST | 1996 | 9 | 3
| Thu Feb 29 17:32:01 1996 PST | 1996 | 9 | 4
| Fri Mar 01 17:32:01 1996 PST | 1996 | 9 | 5
| Mon Dec 30 17:32:01 1996 PST | 1997 | 1 | 1
| Tue Dec 31 17:32:01 1996 PST | 1997 | 1 | 2
| Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 3
| Fri Feb 28 17:32:01 1997 PST | 1997 | 9 | 5
| Sat Mar 01 17:32:01 1997 PST | 1997 | 9 | 6
| Tue Dec 30 17:32:01 1997 PST | 1998 | 1 | 2
| Wed Dec 31 17:32:01 1997 PST | 1998 | 1 | 3
| Fri Dec 31 17:32:01 1999 PST | 1999 | 52 | 5
| Sat Jan 01 17:32:01 2000 PST | 1999 | 52 | 6
| Sun Dec 31 17:32:01 2000 PST | 2000 | 52 | 0
| Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1
54 | timestamptz | isoyear | week | dow
----+--------------------------------+---------+------+-----
| Wed Dec 31 16:00:00 1969 PST | 1970 | 1 | 3
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:02 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.4 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.5 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01.6 1997 PST | 1997 | 7 | 1
| Thu Jan 02 00:00:00 1997 PST | 1997 | 1 | 4
| Thu Jan 02 03:04:05 1997 PST | 1997 | 1 | 4
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Tue Jun 10 17:32:01 1997 PDT | 1997 | 24 | 2
| Sat Sep 22 18:19:20 2001 PDT | 2001 | 38 | 6
| Wed Mar 15 08:14:01 2000 PST | 2000 | 11 | 3
| Wed Mar 15 04:14:02 2000 PST | 2000 | 11 | 3
| Wed Mar 15 02:14:03 2000 PST | 2000 | 11 | 3
| Wed Mar 15 03:14:04 2000 PST | 2000 | 11 | 3
| Wed Mar 15 01:14:05 2000 PST | 2000 | 11 | 3
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:00 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 09:32:01 1997 PST | 1997 | 7 | 1
| Mon Feb 10 14:32:01 1997 PST | 1997 | 7 | 1
| Thu Jul 10 14:32:01 1997 PDT | 1997 | 28 | 4
| Tue Jun 10 18:32:01 1997 PDT | 1997 | 24 | 2
| Mon Feb 10 17:32:01 1997 PST | 1997 | 7 | 1
| Tue Feb 11 17:32:01 1997 PST | 1997 | 7 | 2
| Wed Feb 12 17:32:01 1997 PST | 1997 | 7 | 3
| Thu Feb 13 17:32:01 1997 PST | 1997 | 7 | 4
| Fri Feb 14 17:32:01 1997 PST | 1997 | 7 | 5
| Sat Feb 15 17:32:01 1997 PST | 1997 | 7 | 6
| Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0
| Sun Feb 16 17:32:01 1997 PST | 1997 | 7 | 0
| Wed Feb 28 17:32:01 1996 PST | 1996 | 9 | 3
| Thu Feb 29 17:32:01 1996 PST | 1996 | 9 | 4
| Fri Mar 01 17:32:01 1996 PST | 1996 | 9 | 5
| Mon Dec 30 17:32:01 1996 PST | 1997 | 1 | 1
| Tue Dec 31 17:32:01 1996 PST | 1997 | 1 | 2
| Wed Jan 01 17:32:01 1997 PST | 1997 | 1 | 3
| Fri Feb 28 17:32:01 1997 PST | 1997 | 9 | 5
| Sat Mar 01 17:32:01 1997 PST | 1997 | 9 | 6
| Tue Dec 30 17:32:01 1997 PST | 1998 | 1 | 2
| Wed Dec 31 17:32:01 1997 PST | 1998 | 1 | 3
| Fri Dec 31 17:32:01 1999 PST | 1999 | 52 | 5
| Sat Jan 01 17:32:01 2000 PST | 1999 | 52 | 6
| Sun Dec 31 17:32:01 2000 PST | 2000 | 52 | 0
| Mon Jan 01 17:32:01 2001 PST | 2001 | 1 | 1
(56 rows)
-- TO_CHAR()

View File

@ -235,3 +235,9 @@ select interval 'P0002' AS "year only",
interval 'P0002-10-15T1S' AS "year month day plus time",
interval 'PT10' AS "hour only",
interval 'PT10:30' AS "hour minute";
-- test a couple rounding cases that changed since 8.3 w/ HAVE_INT64_TIMESTAMP.
SET IntervalStyle to postgres_verbose;
select interval '-10 mons -3 days +03:55:06.70';
select interval '1 year 2 mons 3 days 04:05:06.699999';
select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds';