Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCuX-0006x0-G9 for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2013 01:38:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VJCuW-0004Ri-UK for pgsql-bugs@arkaria.postgresql.org; Tue, 10 Sep 2013 01:38:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCuV-0004Qf-S1 for pgsql-bugs@postgresql.org; Tue, 10 Sep 2013 01:38:31 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VJCuT-0001Zr-58 for pgsql-bugs@postgresql.org; Tue, 10 Sep 2013 01:38:31 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1VJCuS-0007QZ-4X; Mon, 09 Sep 2013 21:38:28 -0400 Date: Mon, 9 Sep 2013 21:38:28 -0400 From: Bruce Momjian To: tim.romano@yahoo.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7824: documentation bug: Extract DOW Message-ID: <20130910013828.GG32173@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.8 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 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