Re: What can I use as a [non-aggregate] minimum function

Поиск
Список
Период
Сортировка
От Chris Albertson
Тема Re: What can I use as a [non-aggregate] minimum function
Дата
Msg-id 3C15948F.2CF7942@yahoo.com
обсуждение исходный текст
Ответ на Re: What can I use as a [non-aggregate] minimum function  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: What can I use as a [non-aggregate] minimum function  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
All you need is a "max" function with two arguments.  To find the
max of four numbers you can do this

            max(max(max(a,b),c),d)

It is not even all that ugly.

Tom Lane wrote:
>
> "=?iso-8859-1?Q?Paul_Wehr?=" <postgresql@industrialsoftworks.com> writes:
> > Since you didn't volunteer "just use not_aggregate_max()", I'm assuming
> > there's no built-in thing, so the follow-up question(s) would be:
> >   1) can a function be defined with a variable number of arguments
>
> No, although sometimes you can fake it by defining a family of functions
> with the same name and different numbers of arguments.
>
> >   2) can a function be created that calls itself (i.e. recursive)
>
> Sure, although I don't see how that helps in this case.
>
> >   3) can you do it for me? :)
>
> Nope, got too many things to do already...
>
>                         regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--

--
   Chris Albertson
   Redondo Beach, California
   home:   310-376-1029   chrisalbertson90278@yahoo.com
   cell:   310-990-7550
   office: 310-336-5189   Christopher.J.Albertson@aero.org

В списке pgsql-general по дате отправления:

Предыдущее
От: Justin Clift
Дата:
Сообщение: Re: Analyzer for postgresql.log
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: What can I use as a [non-aggregate] minimum function