pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7824: documentation bug: Extract DOW
3+ messages / 3 participants
[nested] [flat]

* BUG #7824: documentation bug: Extract DOW
@ 2013-01-22 20:40  tim.romano@yahoo.com
  0 siblings, 2 replies; 3+ messages in thread

From: tim.romano@yahoo.com @ 2013-01-22 20:40 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7824
Logged by:          Tim Romano
Email address:      tim.romano@yahoo.com
PostgreSQL version: 9.2.2
Operating system:   Windows 7 x64
Description:        

Documentation seems to indicate that only a Timestamp value is a valid
argument to the Extract function when trying to get the DOW, but a Date also
works:

dow 
The day of the week (0 - 6; Sunday is 0) (for timestamp values only)

SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); Result: 5



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7824: documentation bug: Extract DOW
@ 2013-01-23 06:27  Pavan Deolasee <pavan.deolasee@gmail.com>
  parent: tim.romano@yahoo.com
  1 sibling, 0 replies; 3+ messages in thread

From: Pavan Deolasee @ 2013-01-23 06:27 UTC (permalink / raw)
  To: tim.romano@yahoo.com; +Cc: pgsql-bugs

On Wed, Jan 23, 2013 at 2:10 AM, <tim.romano@yahoo.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      7824
> Logged by:          Tim Romano
> Email address:      tim.romano@yahoo.com
> PostgreSQL version: 9.2.2
> Operating system:   Windows 7 x64
> Description:
>
> Documentation seems to indicate that only a Timestamp value is a valid
> argument to the Extract function when trying to get the DOW, but a Date
> also
> works:
>
> dow
> The day of the week (0 - 6; Sunday is 0) (for timestamp values only)
>
>
The document also mentions:
"(Expressions of type date will be cast to timestamp and can therefore be
used as well.)"

ISTM that "for timestamp values only" means that a source of type interval
or time can not b used. Other functions will also accept those additional
types. I don't know if the documentation needs to make that more clear
though.

Thanks,
Pavan

-- 
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7824: documentation bug: Extract DOW
@ 2013-09-10 01:38  Bruce Momjian <bruce@momjian.us>
  parent: tim.romano@yahoo.com
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2013-09-10 01:38 UTC (permalink / raw)
  To: tim.romano@yahoo.com; +Cc: pgsql-bugs

On Tue, Jan 22, 2013 at 08:40:30PM +0000, tim.romano@yahoo.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      7824
> Logged by:          Tim Romano
> Email address:      tim.romano@yahoo.com
> PostgreSQL version: 9.2.2
> Operating system:   Windows 7 x64
> Description:        
> 
> Documentation seems to indicate that only a Timestamp value is a valid
> argument to the Extract function when trying to get the DOW, but a Date also
> works:
> 
> dow 
> The day of the week (0 - 6; Sunday is 0) (for timestamp values only)
> 
> SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); Result: 5

[Sorry for the late reply.]

I assume you mean:

	SELECT EXTRACT(DOW FROM DATE '2001-02-16');
	 date_part
	-----------
	         5
	(1 row)

That does work fine, and is documented in PG 9.2:

	http://www.postgresql.org/docs/9.2/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
	The extract function retrieves subfields such as year or hour from
	date/time values. source must be a value expression of type timestamp,
-->	time, or interval. (Expressions of type date are cast to timestamp and
-->	can therefore be used as well.) 

Where did you see that DATE is not supported for EXTRACT?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2013-09-10 01:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-22 20:40 BUG #7824: documentation bug: Extract DOW tim.romano@yahoo.com
2013-01-23 06:27 ` Pavan Deolasee <pavan.deolasee@gmail.com>
2013-09-10 01:38 ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox