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 1itL5C-00077s-FW for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2020 00:38:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1itL5B-0003UV-18 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2020 00:38:21 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1itL5A-0003UM-Oj for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2020 00:38:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1itL58-0000qv-Fe for pgsql-hackers@postgresql.org; Mon, 20 Jan 2020 00:38:20 +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 00K0cDL0027620; Sun, 19 Jan 2020 19:38:13 -0500 From: Tom Lane To: Paul A Jungwirth cc: Pavel Stehule , Alvaro Herrera , Jeff Davis , Pgsql Hackers Subject: Re: range_agg In-reply-to: References: <20191220192901.GA9955@alvherre.pgsql> Comments: In-reply-to Paul A Jungwirth message dated "Sun, 19 Jan 2020 15:34:25 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27618.1579480693.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Jan 2020 19:38:13 -0500 Message-ID: <27619.1579480693@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Paul A Jungwirth writes: > On Sun, Jan 19, 2020 at 12:10 AM Pavel Stehule = wrote: >> Now, I think so name "anymultirange" is not good. Maybe better name is = just "multirange" > Are you sure? This function exists to be a cast to an anymultirange, > and I thought the convention was to name cast functions after their > destination type. True for casts involving concrete types, mainly because we'd like the identity "value::typename =3D=3D typename(value)" to hold without too much worry about whether the latter is a plain function call or a special case. Not sure whether it makes as much sense for polymorphics, since casting to a polymorphic type is pretty silly: we do seem to allow you to do that, but it's a no-op. I'm a little troubled by the notion that what you're talking about here is not a no-op (if it were, you wouldn't need a function). That seems like there's something fundamentally not quite right either with the design or with how you're thinking about it. As a comparison point, we sometimes describe subscripting as being a polymorphic operation like subscript(anyarray, integer) returns anyelement It would be completely unhelpful to call that anyelement(). I feel like you might be making a similar mistake here. Alternatively, consider this: a cast from some concrete multirange type to anymultirange is a no-op, while any other sort of cast probably ought to be casting to some particular concrete multirange type. That would line up with the existing operations for plain ranges. regards, tom lane