pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ang Chin Han <angch@bytecraft.com.my>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: LEAST and GREATEST functions?
Date: Wed, 02 Jul 2003 15:11:01 +0800
Message-ID: <3F028585.1020600@bytecraft.com.my> (raw)
In-Reply-To: <25189.1057127804@sss.pgh.pa.us>
References: <20030630201057.14507.qmail@web13905.mail.yahoo.com>
	<200306302032.23113.josh@agliodbs.com>
	<87d6gu2otf.fsf@stark.dyndns.tv>
	<3F025942.6000507@bytecraft.com.my>
	<24828.1057124242@sss.pgh.pa.us>
	<3F0277E6.9090906@bytecraft.com.my>
	<25189.1057127804@sss.pgh.pa.us>

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

view thread (14+ messages)

Message-ID: <3F028585.1020600@bytecraft.com.my>
Permalink:  ../3F028585.1020600@bytecraft.com.my/
Also on:    postgresql.org/message-id/3F028585.1020600@bytecraft.com.my

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: angch@bytecraft.com.my, tgl@sss.pgh.pa.us
  Subject: Re: LEAST and GREATEST functions?
  In-Reply-To: <3F028585.1020600@bytecraft.com.my>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox