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 1lpvnP-0006a7-1n for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Jun 2021 16:38: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 1lpvnN-00047C-VN for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Jun 2021 16:38:41 +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 1lpvnN-000474-Nt for pgsql-hackers@lists.postgresql.org; Sun, 06 Jun 2021 16:38:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lpvnH-0004xx-DT for pgsql-hackers@postgresql.org; Sun, 06 Jun 2021 16:38:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 156GcQ6w650853; Sun, 6 Jun 2021 12:38:26 -0400 From: Tom Lane To: Noah Misch cc: Peter Eisentraut , Vik Fearing , 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: <633566.1622990278@sss.pgh.pa.us> References: <9a680979-ad76-4c3b-1bc0-403152cf49dc@postgresfriends.org> <5752.1590424827@sss.pgh.pa.us> <428767b1-6a18-cc5a-bb2f-a78bc306fae3@postgresfriends.org> <6816.1590426450@sss.pgh.pa.us> <7994.1590428104@sss.pgh.pa.us> <298489.1604188643@sss.pgh.pa.us> <829899.1604357408@sss.pgh.pa.us> <1090402.1604449334@sss.pgh.pa.us> <20210606063331.GC297923@rfd.leadboat.com> <633566.1622990278@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 06 Jun 2021 10:37:58 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <650851.1622997506.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Jun 2021 12:38:26 -0400 Message-ID: <650852.1622997506@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Noah Misch writes: >> equalfuncs.c has been using COMPARE_COERCIONFORM_FIELD() to ignore diff= erences >> in fields of this type. Does this spot have cause to depart from the p= attern? > Oversight, I think. Will fix. After looking closer, I see that there are a couple of very very minor ways in which parse analysis changes behavior based on the value of FuncCall.funcformat: * transformRangeFunction won't apply the appropriate transformation to a multiple-argument unnest() unless the format is COERCE_EXPLICIT_CALL. (This is likely a no-op, though, as no grammar production that emits COERCE_SQL_SYNTAX could apply to the function name "unnest".) * ParseFuncOrColumn will not believe that a FuncCall could_be_projection unless the format is COERCE_EXPLICIT_CALL. This is next door to a no-op, since other restrictions such as nargs =3D=3D 1 would usually suffice to reject COERCE_SQL_SYNTAX calls, but maybe there are corner cases where it'd matter. So if you wanted to be picky you could claim that within FuncCall, funcformat is semantically significant and thus that equalfuncs.c is coded correctly. Nonetheless I'm inclined to think that it'd be better to use COMPARE_COERCIONFORM_FIELD here. I'm quite sure I didn't make the above analysis when I wrote the code; using COMPARE_SCALAR_FIELD was just reflex. We could make use of COMPARE_COERCIONFORM_FIELD 100% correct by removing these two tests of the funcformat value, but on the whole I doubt that would be better. BTW, I'm not sure any of this matters anyway; do we ever use equal() on raw parse trees, except for debug purposes? Thoughts? regards, tom lane