Re: LEAST and GREATEST functions?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>
Cc: Stefan Bill <sjb26(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: LEAST and GREATEST functions?
Date: 2003-07-02 00:04:26
Message-ID: 200307011704.26768.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Joe,

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

Way cool. I'd have to imagine that it would blow up if you did this, though:

select greatest ( 512, now() );

With an "Operator is not defined" error, hey?

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2003-07-02 01:42:18 Re: LEAST and GREATEST functions?
Previous Message Joe Conway 2003-07-01 23:31:42 Re: LEAST and GREATEST functions?