X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B3407310DC6 for ; Wed, 2 Jul 2003 07:02:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 95000-03 for ; Wed, 2 Jul 2003 04:02:46 -0300 (ADT) Received: from cerebro.int-bytecraft.com (unknown [219.93.229.26]) by svr1.postgresql.org (Postfix) with ESMTP id B2D79310DD9 for ; Wed, 2 Jul 2003 04:02:43 -0300 (ADT) Received: from bytecraft.com.my (home.int-bytecraft.com [127.0.0.1]) by cerebro.int-bytecraft.com (8.11.6/8.11.6) with ESMTP id h6270Vq13995; Wed, 2 Jul 2003 15:00:31 +0800 Message-ID: <3F028585.1020600@bytecraft.com.my> Date: Wed, 02 Jul 2003 15:11:01 +0800 From: Ang Chin Han User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: LEAST and GREATEST functions? 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> In-Reply-To: <25189.1057127804@sss.pgh.pa.us> X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigEDF9135096CEAE41D70B673B" X-Archive-Number: 200307/41 X-Sequence-Number: 14155 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigEDF9135096CEAE41D70B673B Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 --------------enigEDF9135096CEAE41D70B673B Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/AoWKNYbTUIgzwfARAjMAAKDBdA3/yr1GgbqTombxl2xXpIDPwwCgrVEn WJoHwyusYYeENS0iRlGDly8= =V9eJ -----END PGP SIGNATURE----- --------------enigEDF9135096CEAE41D70B673B--