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 1jdGZj-0000UN-Hv for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2020 17:07:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jdGZi-0007Ct-84 for pgsql-hackers@arkaria.postgresql.org; Mon, 25 May 2020 17:07:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdGZi-0007CK-0n for pgsql-hackers@lists.postgresql.org; Mon, 25 May 2020 17:07:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jdGZb-0001b8-RW for pgsql-hackers@postgresql.org; Mon, 25 May 2020 17:07:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 04PH7UnH006817; Mon, 25 May 2020 13:07:30 -0400 From: Tom Lane To: Vik Fearing cc: Peter Eisentraut , Thomas Munro , Petr Fedorov , pgsql-hackers Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch In-reply-to: <428767b1-6a18-cc5a-bb2f-a78bc306fae3@postgresfriends.org> References: <42b73d2d-da12-ba9f-570a-420e0cce19d9@phystech.edu> <18389.1575241151@sss.pgh.pa.us> <1c2262e2-6812-7baa-cbdd-63039db12952@phystech.edu> <9a680979-ad76-4c3b-1bc0-403152cf49dc@postgresfriends.org> <5752.1590424827@sss.pgh.pa.us> <428767b1-6a18-cc5a-bb2f-a78bc306fae3@postgresfriends.org> Comments: In-reply-to Vik Fearing message dated "Mon, 25 May 2020 18:52:01 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6815.1590426450.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 25 May 2020 13:07:30 -0400 Message-ID: <6816.1590426450@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Vik Fearing writes: > On 5/25/20 6:40 PM, Tom Lane wrote: >> While at it, maybe we could >> fix things so that the syntax reverse-lists the same way instead >> of injecting Postgres-isms... > I'm not sure what this means. This: regression=3D# create view myview as select extract(year from current_time= stamp) as y; CREATE VIEW regression=3D# \d+ myview ... View definition: SELECT date_part('year'::text, CURRENT_TIMESTAMP) AS y; What had been a 100% spec-compliant view definition is now quite Postgres-specific. I fixed some similar problems in 0bb51aa96 (before that, the CURRENT_TIMESTAMP part would've reverse-listed differently too); but I didn't tackle EXTRACT(), SUBSTRING(), and other cases. I'm not claiming that we really need to fix all of those. But if we are going to pick nits about which data type EXTRACT() returns then I think it's legit to worry about its reverse-list representation at the same time ... especially if we must touch the grammar's translation anyway. regards, tom lane