Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faiMD-0003xW-Vg for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Jul 2018 14:02:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1faiMC-0006sv-Au for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Jul 2018 14:02:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1faiGH-0004nD-MI for pgsql-bugs@lists.postgresql.org; Wed, 04 Jul 2018 13:56:01 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1faiGE-0003XH-Ku for pgsql-bugs@postgresql.org; Wed, 04 Jul 2018 13:56:01 +0000 Received: by mail-wm0-x244.google.com with SMTP id v3-v6so2221941wmh.0 for ; Wed, 04 Jul 2018 06:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digiperience-de.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=KwU98WebVzGUbWvR7XkvTx321u8wc5hlvRqCWwKV3hk=; b=D/Kf5DOH0A34GKfDyRdXP9v3YxJyYvOpk+hWgLQj7vYx9kJ3p/mEMLD5XdB9+xj9KM OZSrM+X3NacUhGrZ5mt0JBoO8zmru9ZyBz4dwgkd6uOVFtQijwBOWDYKyijbf7o5knZL 8Qkr+udXMqAPeGvwCWROQwEsA5eu8zv3lLUsX8/eG6erXK0L2TioJEnSwvGu3sr9qj+E UGvIa9KxmvnOURzULu3Rh0vvo3WEi9NYLdfBngScfa8e579l8cvSmgm+Ljcq51zNmW3+ F4CAU67nBP6H+WgpZb0BRHAQP+Yxf31Al0aMCvCq4iI1Sw7M2haCh1Eu2OqeBYZQpl7P UewA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=KwU98WebVzGUbWvR7XkvTx321u8wc5hlvRqCWwKV3hk=; b=oLn9+cCLf60GFMM/5zJVZ5ktPv7zDWCkm2NAhS7YbOxJBjCQbVXBRqXMGz31lRphKE GaVLjdC0M2nWCF8UVDwob5h1b1CnnvAQwgvrcyEC/gy981pn04OthojOpWZTEEo1RcAW eIpObiylfmGfqnJvi115UieTtbuApOEKiqUyeRvt5+U8mpfr0afwYaqZbwLgvz3LmXrQ RH+KbbHrKSqwNi+FJLYRQDeoxVIoZDhbchUfW/w48FIlMo70NYFLHjhsWnWVaQHF7ewL NSEmQSudMsDWuua/hNhMSIzyJ4asTnc4IeNLrIU1Lik774DkEPTT9Xs/oN9aKvdbJ9tx 6FEQ== X-Gm-Message-State: APt69E0hbtU3jUR2/0+00umt9XqlojBRJCLKRG3G6mlLpcpWMHN4ug+d UDPPdW1/3UvYNg2uF0OnG1DaxHlvwdU= X-Google-Smtp-Source: AAOMgpfr8BpCQlxLDAZ5guzUssnUEzUX3UJ9iAvFrGy53WkYQeesqZlT2t6C2GbCCq5cRDOTnewFXw== X-Received: by 2002:a1c:abc6:: with SMTP id u189-v6mr1684932wme.64.1530712555979; Wed, 04 Jul 2018 06:55:55 -0700 (PDT) Received: from ?IPv6:2a02:8108:9c0:68d0:3053:e33b:dc90:faf9? ([2a02:8108:9c0:68d0:3053:e33b:dc90:faf9]) by smtp.gmail.com with ESMTPSA id 72-v6sm6616460wmo.26.2018.07.04.06.55.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 06:55:55 -0700 (PDT) To: pgsql-bugs@postgresql.org From: Michael Monscheuer Subject: Year 2024: Extracting week from date gives wrong results for the last two days of the year Message-ID: <018392b4-52b1-5166-0c71-6bf09c65d530@digiperience.de> Date: Wed, 4 Jul 2018 15:55:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Team, Extracting the week from a date gives wrong results for the last two days of 2024. SELECT EXTRACT (WEEK FROM DATE '20241230'); or SELECT EXTRACT (WEEK FROM DATE '20241231'); both result in a value of  1 which is wrong, obviously... The expected result is 53 The results for the year 2020 are correct: SELECT EXTRACT (WEEK FROM DATE '20201230'); results to 53 Version: PostgreSQL 10.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit on Amazon RDS Greetings from Hamburg, DE MiMo