dbTalk Databases Forums  

Re: [BUGS] BUG #6178: date_trunc : interval units "week" notsupported contradicts documentation

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] BUG #6178: date_trunc : interval units "week" notsupported contradicts documentation in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] BUG #6178: date_trunc : interval units "week" notsupported contradicts documentation - 08-15-2012 , 03:50 PM






On Thu, Aug 25, 2011 at 07:05:34PM +0000, Noah Hamerslough wrote:
Quote:
The following bug has been logged online:

Bug reference: 6178
Logged by: Noah Hamerslough
Email address: noah (AT) pcc (DOT) com
PostgreSQL version: 8.4
Operating system: Windows Vista
Description: date_trunc : interval units "week" not supported
contradicts documentation
Details:

http://www.postgresql.org/docs/8.4/s...tml#FUNCTIONS-
DATETIME-TRUNC

The documentation for date_trunc('field', source) lists 'week' in the as a
valid value for 'field' However, if the source is an interval, 'week' is not
supported.

select date_trunc('week', '1 month 15 days'::interval);

ERROR: interval units "week" not supported
SQL state: 0A000

Either 'week' should be supported or the documentation should be updated to
reflect that it is not.
Turns out the reason we don't support this is because there are usually
a fractional number of weeks in a month, so there is no good way to do
this for intervals. I have applied the attached patch to PG 9.3 which
will explain why this is not supported. I saw this as better than a
documentation mention.

--
Bruce Momjian <bruce (AT) momjian (DOT) us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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


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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.