IFNULL -> COALESCE - Mailing list pgsql-hackers

From Lee Kindness
Subject IFNULL -> COALESCE
Date
Msg-id 15459.65199.280887.269425@kelvin.csl.co.uk
Whole thread Raw
Responses Re: IFNULL -> COALESCE
List pgsql-hackers
Guys, I've recently being going back over code from Ingres and porting
it over to PostgreSQL. Heavy use was made of the IFNULL function, this
function simply returns the 2nd argument if the first is
NULL. Consider the following query:
SELECT COALESCE(MAX(id), 0) + 1 from test;

can be replaced by the following PostgreSQL query:
SELECT COALESCE(MAX(id), 0) + 1 from test;

I've manually done this, but wouldn't this be a useful auto-tranlation
to make in the parser? Aid to porting and all...

Yeah, I know i should be using a SERIAL column, that's later work...

Regards, Lee.


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: PostgreSQL 7.2 on SlashDot
Next
From: Vince Vielhaber
Date:
Subject: Re: PostgreSQL 7.2 on SlashDot