Search Postgresql Archives

Re: Largest & Smallest Functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 7, 2018 at 10:10 PM Andrew Gierth <andrew@xxxxxxxxxxxxxxxxxxxx> 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
(253) 245-3801

learn more about AGENCY or
follow the discussion.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux