Re: greatest/least semantics different between oracle and postgres

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrej Ricnik-Bay <andrej(dot)groups(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: greatest/least semantics different between oracle and postgres
Date: 2007-06-30 15:05:15
Message-ID: 874pkpfpp0.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Bruno Wolff III" <bruno(at)wolff(dot)to> writes:

> Also what value should I have used in a coalesce to guaranty still getting
> the maximum?

I would expect coalesce(coalesce(greatest(a,b),a),b) to do what you want. It's
not terribly legible though and if a and b are subselects I would worry a
little about the optimizer rerunning them unnecessarily.

Perhaps coalesce(greatest(a,b), coalesce(a,b)) is more legible?

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-06-30 15:09:25 Re: greatest/least semantics different between oracle and postgres
Previous Message Masaru Sugawara 2007-06-30 13:25:07 Re: Possible bug (or I don't understand how foreign keys should work with partitions)