pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Joe Conway <mail@joeconway.com>
To: Greg Stark <gsstark@mit.edu>
Cc: Stefan Bill <sjb26@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: LEAST and GREATEST functions?
Date: Tue, 1 Jul 2003 17:04:26 -0700
Message-ID: <200307011704.26768.josh@agliodbs.com> (raw)
In-Reply-To: <3F01ED9F.3060704@joeconway.com>
References: <20030630201057.14507.qmail@web13905.mail.yahoo.com>
	<87d6gu2otf.fsf@stark.dyndns.tv>
	<3F01ED9F.3060704@joeconway.com>

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



view thread (14+ messages)  latest in thread

Message-ID: <200307011704.26768.josh@agliodbs.com>
Permalink:  ../200307011704.26768.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200307011704.26768.josh@agliodbs.com

 · 

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: josh@agliodbs.com, mail@joeconway.com, gsstark@mit.edu, sjb26@yahoo.com
  Subject: Re: LEAST and GREATEST functions?
  In-Reply-To: <200307011704.26768.josh@agliodbs.com>

* 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