Re: IFNULL -> COALESCE - Mailing list pgsql-hackers

From Lee Kindness
Subject Re: IFNULL -> COALESCE
Date
Msg-id 15463.37499.44819.752088@kelvin.csl.co.uk
Whole thread Raw
In response to Re: IFNULL -> COALESCE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: IFNULL -> COALESCE  (Peter Eisentraut <peter_e@gmx.net>)
Re: IFNULL -> COALESCE  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-hackers
Oh, i'd agree - it's not really worth the hassle adding the code to
automatically do this. Useful to have it mentioned in the archives so
someone else coming up against the same issue can pick up on it
quicker...

Got me thinking about an option for ecpg to report about any
non-standard/user-defined functions used in the source (which of
course it assumes are such and just lets them through). Also that
'sqlca is included by default' message added for 7.2 is annoying!

And Bruce, yeah there's a lock ;)

Regards, Lee Kindness.

Tom Lane writes:> Lee Kindness <lkindness@csl.co.uk> writes:> > Okay, lets try that again...> >   SELECT
IFNULL(MAX(id),0) + 1 from test;> > can be replaced by the following PostgreSQL query:> >   SELECT COALESCE(MAX(id), 0)
+1 from test;> > For any specific datatype that you might need this for, you could> provide a user-defined IFNULL
functionto avoid having to translate> your code.  Might get a bit tedious if you are doing it for a lot> of different
datatypes,however.> > Not sure if it's worth adding a keyword and a grammar production> to get Postgres to do this for
you. If it were part of a full-court> press to improve our Oracle compatibility, I wouldn't object, but> I'm not sure I
seethe point of doing just the one nonstandard> feature.> >             regards, tom lane
 


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: GiST on 64-bit box
Next
From: Jean-Michel POURE
Date:
Subject: Re: Fetature enhancement request : use of libgda in PostgreSQL to access legacy databases.