From: | Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> |
---|---|
To: | andrew(at)tao11(dot)riddles(dot)org(dot)uk |
Cc: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Largest & Smallest Functions |
Date: | 2018-11-08 06:32:56 |
Message-ID: | CAD3a31Xvyco+pmEaeZtTi1K3wmvOm=_U-aYUXF_0DJn=vqidxA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Nov 7, 2018 at 10:10 PM Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
wrote:
>
> But you don't need to create more functions, because you can do this:
>
> select largest(variadic array[1,2,3]);
> largest
> ---------
> 3
>
>
> As already pointed out, greatest() and least() exist (though they were
> added before VARIADIC was, so they don't use it)
>
>
Yeah, I get that my four functions can collapse down to 2. I was just
trying to say that if the greatest() and least() expressions did use
VARIADIC, that would collapse down to 0 additional functions. :)
> Ken> 3) Bonus question--how come all the existing _larger and _smaller
> Ken> functions are specific to each data type, as opposed to more
> Ken> general smaller/larger functions?
>
> Because it saves looking up the type comparison function and doing an
> indirect call.
>
> That makes sense--thanks for the explanation!
Cheers,
Ken
--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801
Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-11-08 06:34:02 | Re: Largest & Smallest Functions |
Previous Message | Pavel Stehule | 2018-11-08 06:21:48 | Re: Largest & Smallest Functions |