From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: balazs@obiserver.hu, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14854: daterange[] is an anyarray or anyrange?
Date: Fri, 13 Oct 2017 18:28:15 -0400
Message-ID: <21231.1507933695@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwatCNQcFg7hkHzNNtn1So316U2M-ut=0qRue9mvY6CGdA@mail.gmail.com>
References: <20171013194521.8203.22579@wrigleys.postgresql.org>
<CAKFQuwatCNQcFg7hkHzNNtn1So316U2M-ut=0qRue9mvY6CGdA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, Oct 13, 2017 at 12:45 PM, <balazs@obiserver.hu> wrote:
>> CREATE FUNCTION range_overlap_array_any(anyrange, anyarray) RETURNS
>> boolean
>> AS $$SELECT false;$$ LANGUAGE sql IMMUTABLE STRICT;
>>
>> SELECT range_overlap_array_any(daterange('2017-01-01', '2017-04-01'),
>> array['x'::text]);
>>
>> ERROR: function range_overlap_array_any(daterange, text[]) does not exist
> The invocation (daterange, text[]) is not a valid combination for any pure
> pseudo-argument function.
Yeah. The expectation with these pseudotypes is that you're trying to
declare a function that takes some set of arguments of related types.
Back when we first invented the idea of polymorphic pseudotypes,
which was a good long time ago now, there was discussion of having
a second set of pseudotypes that are tied to a second underlying
"base type" type variable, so that while
myfunc(anyrange, anyarray)
means "a range over some type, and an array over that same type"
then you could write, say
myfunc(anyrange, anyelement2, anyarray2)
to mean "a range over some type A, and a value of some possibly-different
type B, and an array over type B". We didn't do it because nobody had a
particularly compelling use-case at the time, and also because if we
needed 2 sets of pseudotypes then maybe we needed 3, etc; it wasn't clear
where to stop.
Nearly fifteen years later, we still haven't seen a compelling example
for inventing a second set of pseudotypes. If you've got one it would
definitely be interesting.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
Subject: Re: BUG #14854: daterange[] is an anyarray or anyrange?
In-Reply-To: <21231.1507933695@sss.pgh.pa.us>
References: <20171013194521.8203.22579@wrigleys.postgresql.org> <CAKFQuwatCNQcFg7hkHzNNtn1So316U2M-ut=0qRue9mvY6CGdA@mail.gmail.com> <21231.1507933695@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