Re: LEAST and GREATEST functions? - Mailing list pgsql-sql

From Ang Chin Han
Subject Re: LEAST and GREATEST functions?
Date
Msg-id 3F028585.1020600@bytecraft.com.my
Whole thread Raw
In response to Re: LEAST and GREATEST functions?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Tom Lane wrote:

> create function greatest(anyelement, anyelement) returns anyelement as
> 'select case when $1>$2 then $1 else $2 end' language sql;

Any chance of this making it into 7.4's contrib? Maybe with enough 
documentation to make it a tutorial for PostgreSQL's user functions?

> You do have to create several greatest() functions for different numbers
> of arguments, but not one for each datatype you want to handle.

Insignificant, compared with the flexiblity.

> I have not seen enough requests for a native LEAST/GREATEST
> implementation to make me think we need to do more than this...
> certainly I'd rather spend development effort on general facilities
> like polymorphism and inlining than on creating one-use facilities
> like built-in LEAST/GREATEST.

Nice. It would speed up our current functions too. Thanks, developers, 
esp. Tom and Joe for this!

Wow, less reasons to use VIEWs when CREATE FUNCTION can be just as fast, 
but more flexible. Can't wait, IMHO, the advocacy people can and should 
be promoting this(functions returning sets, and how it can be used) as a 
killer feature for 7.3 and 7.4. I know I was pretty happy to discover 
that gem  lurking in the documentation in 7.3.

-- 
Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 
GNU/Linux  2:30pm  up 188 days,  5:35,  4 users,  load average: 5.04, 5.15, 5.16

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: LEAST and GREATEST functions?
Next
From: Együd Csaba
Date:
Subject: Re: Getting all rows even if not a member of any groups