Re: [HACKERS] Re: [DOCS] Reference Manual - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] Re: [DOCS] Reference Manual
Date
Msg-id 35225046.78645566@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] Re: [DOCS] Reference Manual  ("Jose' Soares Da Silva" <sferac@proxy.bazzanese.com>)
Responses Re: [HACKERS] Re: [DOCS] Reference Manual
List pgsql-hackers
> The point is: why EXTRACT accepts only date types ?
> SQL92 specifies date, time, timestamp and interval.

tgl=> select extract (year from date 'now');
date_part
---------
     1998
(1 row)
tgl=> select extract (year from datetime 'now');
date_part
---------
     1998
(1 row)
tgl=> select extract (year from abstime 'now');
date_part
---------
     1998
(1 row)
tgl=> select extract(year from timestamp 'now');
date_part
---------
     1998
(1 row)
tgl=> select extract (hour from timespan '5 hours');
date_part
---------
        5
(1 row)

tgl=> select extract (hour from reltime '5 hours');
date_part
---------
        5
(1 row)
tgl=> select extract (hour from interval '5 hours');
date_part
---------
        5
(1 row)

And,

tgl=> select extract (hour from time '03:04:05');
ERROR:  function 'time_timespan(time)' does not exist

This is a known problem; will fix for v6.4.

                       - Tom

pgsql-hackers by date:

Previous
From: "Jose' Soares Da Silva"
Date:
Subject: Re: [HACKERS] Re: [DOCS] Reference Manual
Next
From: Maurice Gittens
Date:
Subject: patch for some more overruns; two to go