Re: [BUGS] BUG #14854: daterange[] is an anyarray or anyrange?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #14854: daterange[] is an anyarray or anyrange?
Дата
Msg-id 21231.1507933695@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14854: daterange[] is an anyarray or anyrange?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [BUGS] BUG #14854: daterange[] is an anyarray or anyrange?
Следующее
От: GDR!
Дата:
Сообщение: Re: [BUGS] BUG #14851: Systemd kills long-running recovery