If it is interesting to someone, we can partially emulate COALESCE
right now as:
create function coalesce(integer) returns integer as
'declare nonullo alias for $1;
begin if nonullo then return nonullo; else return 0; end if;end;
' language 'plpgsql';
CREATE
select *,coalesce(comm) from emp where comm is null;
ename|empno|job | hiredate|sal |comm|deptno|level| mgr|coalesce
-----+-----+----------+----------+---------+----+------+-----+----+--------
BLAKE| 7698|MANAGER |1981-05-01|$2,850.00| | 30| 3|7782| 0
JONES| 7900|CLERK |1981-12-03|$950.00 | | 30| 2|7782| 0
CLARK| 7844|SALESMAN |1981-09-08|$1,500.00| | 10| 2|7839| 0
(3 rows)
-Jose'-
>> > > With SyBase, IsNull(X,Y) returns X if X is not null, and Y
>> > > if X is null.
>> >
>> > Which is identical in behavior to the SQL92-defined function
>> > COALESCE(X,Y) (IsNull() is not in the standard). This is now in the
>> > Postgres development tree, to be available in the next release. Should
>> > we also have the less capable IsNull() available too? COALESCE() has the
>> > nice feature that it takes an unlimited number of arguments, returning
>> > the first non-null result.
>>
>> Oh, NVL and isnull are not standard? Then let's just use coalesce. I
>> will remove them from the TODO list.
VV> Surprises me too. I was under the (incorrect) impression that isnull
VV> was standard.