From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Paul A Jungwirth <pj@illuminatedcomputing.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: range_agg
Date: Fri, 20 Dec 2019 16:15:24 -0500
Message-ID: <9926.1576876524@sss.pgh.pa.us> (raw)
In-Reply-To: <20191220192901.GA9955@alvherre.pgsql>
References: <20191220192901.GA9955@alvherre.pgsql>
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2019-Dec-20, Paul A Jungwirth wrote:
>> Is it permitted to add casts with polymorphic inputs & outputs? Is
>> that something that we would actually want to do? I'd probably need
>> both the polymorphic and concrete casts so that you could still say
>> `int4range(1,2)::int4multirange`.
> I'm embarrased to admit that I don't grok the type system well enough
> (yet) to answer this question.
I would say no; if you want behavior like that you'd have to add code for
it into the coercion machinery, much like the casts around, say, types
record and record[] versus named composites and arrays of same. Expecting
the generic cast machinery to do the right thing would be foolhardy.
In any case, even if it did do the right thing, you'd still need
some additional polymorphic type to express the behavior you wanted,
no? So it's not clear there'd be any net savings of effort.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, pj@illuminatedcomputing.com, pavel.stehule@gmail.com, pgsql@j-davis.com
Subject: Re: range_agg
In-Reply-To: <9926.1576876524@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox