Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpAvm-0003oi-6Y for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Dec 2020 14:03:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpAvk-0001GU-5q for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Dec 2020 14:03:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpAvi-0001GN-VF for pgsql-hackers@lists.postgresql.org; Tue, 15 Dec 2020 14:03:55 +0000 Received: from [64.147.123.34] (helo=wforward4-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpAvd-0002JZ-AE for pgsql-hackers@postgresql.org; Tue, 15 Dec 2020 14:03:54 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id A887F3FA; Tue, 15 Dec 2020 09:03:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 15 Dec 2020 09:03:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=7jQJbI B8gkfA+DJmTvKG3UaooVpH+ZREkTiRfEtYxTU=; b=A7MYO5nXRaFmaEGXriJZNb KeiMpzMzpqMI5xYrMrDcr4khiayKezv30ajYNSDbJeJtWYBTXRvMRQDOZI2OKEkE Cx+vKdaUf/STRmwi/PNNukGCjqb1CzPLvzQhj1NGNozXsgtRneTIW5aK7l6B16d9 8map0gfeFtH6TUDATijiAmhQC+Ql1ATJbKRrSZkvWZXUf2qdbvsqRFgGjp+pCE+6 aaD1rXnRXzMU0H2RTQsvVbG86ORfOt9ZaFX67n5QBBL27QUmSUGVynezdUjnf4+Q mcFW7tfNoixoZ5MPVJBus5tp7sFrS6gAKjDOR3J/ucEa5prVzg/TaInNJ7F0iAjw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeltddgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgesmhdtreertdefheenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeffhfetuedvteelgfeileei uddvvefghedvvdegiedvieegteekiedvvedvtdetheenucffohhmrghinhepvdhnughquh grughrrghnthdrtghomhenucfkphepkeejrddujeejrdejvddrudegvdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p57b1488e.dip0.t-ipconnect.de [87.177.72.142]) by mail.messagingengine.com (Postfix) with ESMTPA id 44F60240065; Tue, 15 Dec 2020 09:03:33 -0500 (EST) Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch To: pgsql-hackers References: <1551357.1599435992@sss.pgh.pa.us> <097a4242-0748-98e3-06ab-ded1d366cd76@2ndquadrant.com> <1893468.1599658711@sss.pgh.pa.us> <38fc499a-ae52-efb6-aad6-82f812d6782d@2ndquadrant.com> <20200917055327.GU2873@paquier.xyz> <20200930071543.GL1996@paquier.xyz> Cc: Tom Lane , Pavel Stehule , Thomas Munro , Petr Fedorov From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <2fb99632-9302-6509-78ce-3aaed3fd7f40@2ndquadrant.com> Date: Tue, 15 Dec 2020 15:03:31 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200930071543.GL1996@paquier.xyz> Content-Type: multipart/mixed; boundary="------------B62791CD335383A2A55B53DB" Content-Language: en-US X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.34 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------B62791CD335383A2A55B53DB Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Here is a new patch for this. This now follows the implementation that Tom has suggested: Leave date_part() alone, add a new set of extract() functions, and map the SQL EXTRACT construct to those. I have basically just copied over the implementations from my previous patch and placed them next to the existing date_part() implementations. So all the behavior is still the same as in the previous patches. One thing I still need to look into is how to not lose all the test coverage for date_part(). But that should be fairly mechanical, so I'm leaving it off in this version. -- Peter Eisentraut 2ndQuadrant, an EDB company https://www.2ndquadrant.com/ --------------B62791CD335383A2A55B53DB Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="v4-0001-Change-return-type-of-EXTRACT-to-numeric.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="v4-0001-Change-return-type-of-EXTRACT-to-numeric.patch"