Re: Re[2]: AW: [HACKERS] isnull() or is it?t

From: jwieck(at)debis(dot)com (Jan Wieck)
To: sferac(at)bo(dot)nettuno(dot)it
Cc: pgsql-hackers(at)postgreSQL(dot)org, vev(at)michvhf(dot)com
Subject: Re: Re[2]: AW: [HACKERS] isnull() or is it?t
Date: 1998-12-10 20:26:41
Message-ID: m0zoCfZ-000EBQC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> 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

Pardon, but you still misuse the fact, that PL/pgSQL's IF
expression is implicitly casted into a boolean. That's only
possible for integer values.

Please use

IF nonullo ISNULL THEN
RETURN 0;
ELSE
RETURN nonullo;
END IF;

instead, because this would work for other types (like text,
varchar etc.) too.

Since PL functions can be overloaded (like SQL functions), it
would be possible, but currently not that performant :-(, to
create such a function for all types required.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dan Gowin 1998-12-10 20:50:31 RE: [HACKERS] PgAccess version 0.93 (for Unix and Windows) has be en released!
Previous Message Frank Ridderbusch 1998-12-10 20:10:21 subscribe