Re: Largest & Smallest Functions
От | Ken Tanzer |
---|---|
Тема | Re: Largest & Smallest Functions |
Дата | |
Msg-id | CAD3a31Xvyco+pmEaeZtTi1K3wmvOm=_U-aYUXF_0DJn=vqidxA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Largest & Smallest Functions (Andrew Gierth <andrew@tao11.riddles.org.uk>) |
Список | pgsql-general |
On Wed, Nov 7, 2018 at 10:10 PM Andrew Gierth <andrew@tao11.riddles.org.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
(253) 245-3801
learn more about AGENCY or
follow the discussion.
В списке pgsql-general по дате отправления: