Re: IFNULL -> COALESCE

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: IFNULL -> COALESCE
Date: 2002-02-08 17:12:10
Message-ID: 20020209011111.J14715-100000@houston.familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

Ummm...did you make a mistake here? Those statements are identical...

Chris

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-02-08 17:12:24 Re: compile error of PostgreSQL 7.2 on FreeBSD-current
Previous Message Christopher Kings-Lynne 2002-02-08 17:09:16 Re: Database abstration layers