On Wed, Nov 7, 2018 at 2:46 PM Ondřej Bouda <obo...@email.cz> wrote:

> Hi,
>
>  > 2) Is there any particular reason functions like that aren't built
>  > into Postgres?  They seem like they would be useful.  (Or maybe I
>  > missed them?)
>
> LEAST() and GREATEST() expressions do the same thing as yours smallest()
> and largest(). See
> https://www.postgresql.org/docs/current/functions-conditional.html
>
>
Ah, thanks very much!   I missed those because I didn't see them as
functions, and didn't think about expressions.

But then going back to my Q3, what is the point of the separate
date_larger,int2smaller, etc. functions?  Are they faster than
least/greatest because they are specific to a particular data type?



> Now to be a little more serious, if you want a single function to both
> support variadic number of arguments AND all of them in a single array,
> how could the function decide whether smallest(ARRAY[1,2,3]) shall
> return 1 or ARRAY[1,2,3] (which is the smallest out of all arguments)?
>

Personally I don't have any use cases where I'd be comparing arrays, and so
would be happy to have a single array be treated as a list of elements.
But I definitely see your point in more general terms!

Thanks again,
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.tan...@agency-software.org
(253) 245-3801

Subscribe to the mailing list
<agency-general-requ...@lists.sourceforge.net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

Reply via email to