Re: greatest/least semantics different between oracle and postgres - Mailing list pgsql-general

From Gregory Stark
Subject Re: greatest/least semantics different between oracle and postgres
Date
Msg-id 874pkpfpp0.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: greatest/least semantics different between oracle and postgres  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: greatest/least semantics different between oracle and postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
"Bruno Wolff III" <bruno@wolff.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


pgsql-general by date:

Previous
From: Masaru Sugawara
Date:
Subject: Re: Possible bug (or I don't understand how foreign keys should work with partitions)
Next
From: Gregory Stark
Date:
Subject: Re: greatest/least semantics different between oracle and postgres