Re: [GENERAL] minimum function

2007-06-25 Thread Gunther Mayer
Tom Lane wrote: Gunther Mayer <[EMAIL PROTECTED]> writes: SELECT minimum(5,6) => 5 You're looking for the least/greatest functions (in 8.1 and up IIRC). regards, tom lane Awesome, that's exactly what I was looking for. My pl/pgsql minimum() hack is gonna go

Re: [GENERAL] minimum function

2007-06-23 Thread Tom Lane
Gunther Mayer <[EMAIL PROTECTED]> writes: > SELECT minimum(5,6) => 5 You're looking for the least/greatest functions (in 8.1 and up IIRC). regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] minimum function

2007-06-23 Thread PFC
Check out greatest() and least()... (I think ;) On Sat, 23 Jun 2007 18:35:36 +0200, Raymond O'Donnell <[EMAIL PROTECTED]> wrote: On 23/06/2007 17:17, Gunther Mayer wrote: Any way I can achieve that on one line? I.e. I want it simpler than IF arg1 < arg2 THEN RETURN arg1; ELSE

Re: [GENERAL] minimum function

2007-06-23 Thread Martijn van Oosterhout
On Sat, Jun 23, 2007 at 06:17:03PM +0200, Gunther Mayer wrote: > Hi there, > > I'm busy writing a trigger function in pl/pgsql and find myself in need > of a minimum() function. I can't see how the builtin min() aggregate > function can be of any use here since all I want to do is something like

Re: [GENERAL] minimum function

2007-06-23 Thread Raymond O'Donnell
On 23/06/2007 17:17, Gunther Mayer wrote: Any way I can achieve that on one line? I.e. I want it simpler than IF arg1 < arg2 THEN RETURN arg1; ELSE RETURN arg2; END IF; That looks pretty simple already, but why not enclose it in a pl/pgsql function - something like: create function m

[GENERAL] minimum function

2007-06-23 Thread Gunther Mayer
Hi there, I'm busy writing a trigger function in pl/pgsql and find myself in need of a minimum() function. I can't see how the builtin min() aggregate function can be of any use here since all I want to do is something like SELECT minimum(5,6) => 5 Any way I can achieve that on one line? I.e