Skip site navigation (1) Skip section navigation (2)

Re: isnull

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Shraibman <jks(at)p1(dot)selectacast(dot)net>
Cc: Julie Hunt <jhunt(at)chac(dot)qld(dot)edu(dot)au>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: isnull
Date: 2000-03-31 00:11:49
Message-ID: 28671.954461509@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Joseph Shraibman <jks(at)p1(dot)selectacast(dot)net> writes:
> Ah, I think the documentation that came with 6.5.3 was wrong, because
> http://www.postgresql.org/docs/postgres/functions.htm#AEN2257 has the
> function nullif where ifnull was in my documentation.  I don't get
> errors now, but it just doesn't seem to do it's job.

NULLIF doesn't do what you seem to expect: it is for *creating* nulls,
not removing them.  It produces a null if the two arguments are equal,
else the first argument.

COALESCE is probably the thing you are after: it produces the first
nonnull value among its arguments, reading left to right.

There isn't anything called IFNULL in the SQL92 spec, though there
is an IS NULL test (note space).

No, I didn't choose these names ;-) ... blame the SQL92 authors ...

			regards, tom lane

In response to

  • Re: isnull at 2000-03-30 22:25:38 from Joseph Shraibman

pgsql-sql by date

Next:From: Julie HuntDate: 2000-03-31 01:10:42
Subject: Re: isnull
Previous:From: Joseph ShraibmanDate: 2000-03-30 23:07:16
Subject: Re: isnull

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group