pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: tim.romano@yahoo.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7824: documentation bug: Extract DOW
Date: Mon, 9 Sep 2013 21:38:28 -0400
Message-ID: <20130910013828.GG32173@momjian.us> (raw)
In-Reply-To: <E1Txkdy-0006X2-8a@wrigleys.postgresql.org>
References: <E1Txkdy-0006X2-8a@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (3+ messages)

Message-ID: <20130910013828.GG32173@momjian.us>
Permalink:  ../20130910013828.GG32173@momjian.us/
Also on:    postgresql.org/message-id/20130910013828.GG32173@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, tim.romano@yahoo.com
  Subject: Re: BUG #7824: documentation bug: Extract DOW
  In-Reply-To: <20130910013828.GG32173@momjian.us>
  References: <E1Txkdy-0006X2-8a@wrigleys.postgresql.org> <20130910013828.GG32173@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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