From: | Chris Albertson <chrisalbertson90278(at)yahoo(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Paul Wehr <postgresql(at)industrialsoftworks(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: What can I use as a [non-aggregate] minimum function |
Date: | 2001-12-11 05:07:28 |
Message-ID: | 3C15948F.2CF7942@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)industrialsoftworks(dot)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(at)postgresql(dot)org
--
--
Chris Albertson
Redondo Beach, California
home: 310-376-1029 chrisalbertson90278(at)yahoo(dot)com
cell: 310-990-7550
office: 310-336-5189 Christopher(dot)J(dot)Albertson(at)aero(dot)org
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Wehr | 2001-12-11 06:30:13 | What can I use as a [non-aggregate] minimum function |
Previous Message | Martijn van Oosterhout | 2001-12-11 04:22:51 | Re: What can I use as a [non-aggregate] minimum function |