Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UHdLK-0002Ue-SH for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2013 16:55:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UHdLK-0003JR-CQ for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Mar 2013 16:55:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UHdLJ-0003JL-HI for pgsql-bugs@postgresql.org; Mon, 18 Mar 2013 16:55:25 +0000 Received: from plane.gmane.org ([80.91.229.3]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UHdLF-0001at-5p for pgsql-bugs@postgresql.org; Mon, 18 Mar 2013 16:55:25 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UHdLZ-0003nf-Ng for pgsql-bugs@postgresql.org; Mon, 18 Mar 2013 17:55:41 +0100 Received: from ppp-82-135-75-130.dynamic.mnet-online.de ([82.135.75.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Mar 2013 17:55:41 +0100 Received: from spam_eater by ppp-82-135-75-130.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 18 Mar 2013 17:55:41 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-bugs@postgresql.org From: Thomas Kellerer Subject: Re: BUG #7967: Wrong week number in extract function Date: Mon, 18 Mar 2013 17:55:04 +0100 Lines: 38 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp-82-135-75-130.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: X-Pg-Spam-Score: -4.4 (----) 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 noose@noose.pl wrote on 18.03.2013 09:23: > The following bug has been logged on the website: > > Bug reference: 7967 > Logged by: Pawel Kobylak > Email address: noose@noose.pl > PostgreSQL version: 9.1.3 > Operating system: Debian > Description: > > Hi, > I'm running that query and result is ... unexpected for me... > > Query: > select '2012-12-31', EXTRACT(year from '2012-12-31'::date), EXTRACT(week > from '2012-12-31'::date) > > Result: > "2012-12-31";2012;1 > > Expected: > "2012-12-31";2012;53 > OR > "2012-12-31";2013;1 > > This result is correct? Or that is little bug? :-) > Regards, > Pawel Expected - or at least documented. You are looking for "isoyear" instead of "year": select extract(isoyear from date '2012-12-31') Result: 2013 The same "option" is available for the to_char() function: IYYY vs. YYYY -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs