Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioOQv-0003Eh-G1 for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 09:12:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ioOQr-0001d1-FI for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jan 2020 09:12:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ioOQr-0001cu-03 for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 09:12:17 +0000 Received: from mout.gmx.net ([212.227.15.18]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ioOQn-00044m-UH for pgsql-bugs@lists.postgresql.org; Mon, 06 Jan 2020 09:12:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1578301929; bh=wd35dKh5oH0CX31YpFAlBtwXBn+KoEHyWCy/nzHpb4M=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=dUQV08KZ2HqRrFZshaN4XnL4rpSTmZpagHTq1lqerawq/o40yMRsc1YF3kFuRS3T0 JUFKFtEaff65KKizjjCz80pSP15rDPzmqFJJGgun1dMfKykYv0qFq7bKGUkSdlfU3w iReUyNpCySlQgrVxW2q+DXOCUco58WsTxsY38jdI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.20] ([188.174.170.48]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N2V4P-1jqlkM1w8V-013uUG; Mon, 06 Jan 2020 10:12:09 +0100 Subject: Re: BUG #16192: Function to_char(date,'IW') return incorrect value for last days of a year To: olivier.delemar@free.fr, pgsql-bugs@lists.postgresql.org References: <16192-0a7c830763891773@postgresql.org> From: Thomas Kellerer Message-ID: Date: Mon, 6 Jan 2020 10:12:06 +0100 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 MIME-Version: 1.0 In-Reply-To: <16192-0a7c830763891773@postgresql.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:as3vZTQUmrJNbBmMDFK4fUK44uTgPMZwCwDQ61QLXYAYYh45IzV aIF5hINH37JZ5C2s03GGUbm5x/dbnh50f35Mfwvxuao6WcScb/Nml+ofqXJvUXSMNKaVrIc rjfl2a0G3S7Kxn1a6w69G5JUK5FNv2VXB7gj/Ohbzzsjo7886H0M7OrRJZesUCPuYVnVMrA Brwu4eLeg9GMBkjrACLyA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:pkIzB2fxvCU=:jURIVw7uHCx0FR2c62D6Zi vs7vh+g29I3x5OTAJuBQaRR/Nb2XrgdobdYH4E6T8l5KJEHZpVevfoxCniTU9RXgz4u7XqFTx oZT8U1RiNklbOlZshpN3A8nBQK0IAICJpA5JQjayTGmQnMQdBdBk1HOnddhjL1gMTnFAGIIRa wpNJIhg78pLCu0mWB7J053HHQm/b/diosynHAOxMVqBcQgdutExm5kP9pCmvj4PijOSdDbQZT /jnQjzAZ30mEdt7HL7AyS+X1VRAo/kCG+BPWTkdhPSv4baQm/IA3mDs6yUJ6Ac7KF3tZVznVy Clr168Ym2mDhzxX2/q4DuHQ89ZJvFiTNHQ+P6pQdyA6k6GqVb1lL7gjx149jJT8eHBymODBwN ttLbZ71LRdheqHx2qZmwkmmGUwKd6YcmfOLJMIUjS2Wumfn9+eLIRj79q+/BH39wIXsJRygJA 6Lhe/IUnnLdEzSRQKh43NG8jffDEFHvy8NWRR8FfvP3aPv9O+yTqOAsSVY8t8RJknUkxElv38 rwqmUGF52E3IZx8Sz2H7UriN4Ja4I9oooDBrgzaT4ROgAj2JmR4yDcBdT5IyK0NvaDi4AcfW/ bpg6UV/I/CEJe9SIKPyDYsSDcutQARBmno/8vMSsSqIlWnall2inc22KmYHuTS0WniSMDwMwe jQdyFut+s4Jz56NkLGonjQQNzkUUoAlCelspucuBO7xwF4YqoZk8pQ+9jnVIe8kVtbFhlW14K cQFG64RQNfFsQCc49uv6KCKjos0MLrkqYVGrYIDVfY30RMK3o0dp9Wl/2AbsJdiW8JpSSZEpn 0gpoNs0uSRgg9nqvefWzdNygLoIzbWEnmzl5G2GUQWcJAQvFwTrO9gtixsS4ncVSNdTXMmxoY oa4gXzr2G02fNWih48op5MCBGuNWkXO4d5k7trUx1X8ZW0x6LnKIxztXjK52kleSm8Pexw3br HCPaFomOad00RR7x8LTpuksNbfedaac6JMjcnJ5XlmKvlW+W9wcLi8B12+Gn9O6CtVWsZ7jE5 M6XdRKLMP7YZJ3noISCEs555nCyfzARglkGQrcXnGQJLtFV24i8Rb5IEF3f8KTnBhpDTyw10v T9GK58FhdMgQRJQBHJHsoAP9aCG7IKeOxe/6UjnT+Zu2VBo8zNyZVYjd9udQLAy8vz5U/CZwD 9/4WOp+KYxHeUZ5+aNsjsQMhKx7sgqGNG760Twf8espcCrboAoh0S2Dt2S0/ViO4sH1f/8cOb iqcGV52pUjDtB0SEeK2pt5m7EwPkcgpc/IPT9tP4YPxh1MIFPvhmC+q6VWCc= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form schrieb am 06.01.2020 um 09:39: > According to ISO 8691 specifications, the first week of a year is the we= ek > containing the first thursday of the year. Thus, the 30 and 31 of decemb= er > 2019 should be in the first week of 2020, but "to_char" set them in the > first week of... 2019! > > [postgres] $ psql > psql (9.6.6) > Saisissez =C2=AB help =C2=BB pour l'aide. > > # select to_char('2019-12-30'::date, 'YYYY-IW'); > to_char > --------- > 2019-01 > (1 ligne) Not a bug. To get the year corresponding to the ISO week, you need to use the format = for the "ISO Year" select to_char('2019-12-30'::date, 'IYYY-IW');