Re: range_agg

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: range_agg
Date: 2020-01-19 08:09:56
Message-ID: CAFj8pRDYkdi4vDmKTAL-7dQqX5CbxHzAzkn=VH=ojZc9F+mbcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

so 18. 1. 2020 v 17:35 odesílatel Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
napsal:

>
>
> so 18. 1. 2020 v 17:07 odesílatel Paul A Jungwirth <
> pj(at)illuminatedcomputing(dot)com> napsal:
>
>> On Sat, Jan 18, 2020 at 7:20 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
>> wrote:
>> > Can be nice to have a polymorphic function
>> >
>> > multirange(anymultirange, anyrange) returns anymultirange. This
>> functions should to do multirange from $2 to type $1
>> >
>> > It can enhance to using polymorphic types and simplify casting.
>>
>> Thanks for taking another look! I actually have that already but it is
>> named anymultirange:
>>
>> regression=# select anymultirange(int4range(1,2));
>> anymultirange
>> ---------------
>> {[1,2)}
>> (1 row)
>>
>> Will that work for you?
>>
>
> It's better than I though
>
>
>> I think I only wrote that to satisfy some requirement of having an
>> anymultirange type, but I agree it could be useful. (I even used it in
>> the regress tests.) Maybe it's worth documenting too?
>>
>
Now, I think so name "anymultirange" is not good. Maybe better name is just
"multirange"

> yes
>
>
>> > when I tried to write this function in plpgsql I got
>> >
>> > create or replace function multirange(anymultirange, anyrange) returns
>> anymultirange as $$
>> > begin
>> > execute format('select $2::%I', pg_typeof($1)) into $1;
>> > return $1;
>> > end;
>> > $$ language plpgsql immutable strict;
>> >
>> > ERROR: unrecognized typtype: 109
>> > CONTEXT: compilation of PL/pgSQL function "multirange" near line 1
>>
>> Hmm, I'll add a test for that and see if I can find the problem.
>>
>
> ok
>
>
>> Thanks!
>> Paul
>>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2020-01-19 08:52:40 Re: Parallel grouping sets
Previous Message Richard Guo 2020-01-19 04:01:16 Re: A problem about partitionwise join