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 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Julie Hunt | 2000-03-31 01:10:42 | Re: isnull |
Previous Message | Joseph Shraibman | 2000-03-30 23:07:16 | Re: isnull |