[GENERAL] Two variable passed to PL/Function and on is NULL

From: Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Two variable passed to PL/Function and on is NULL
Date: 1999-06-14 12:44:50
Message-ID: v04020a05b38aa7ad8bc7@[128.40.242.190]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear All,

I have written a PL/pgSQL fucntion which takes two arguments and returns a
boolean on the basis of a few (string) comparaisons.

The function works fine as long as BOTH passed variables are non-NULL but
behaves strangely if one of the variables is non-NULL.

Looking at previous postings, I found:

>Very observant of you. The postgres function system doesn't have a way
>to tell which parameter is null, so the function just returns null.
>I don't like it and we hope to get it changed for PGv6.5 (at least I
>do).

Now that example was with a 'c' function but presumably, function are
handled the same way internally whatever the function language?

SO my question are:

i) Is it the case that if you pass to variables to a postgres function and
one is NULL, the function cannot tell which one?
ii) Is there a workaround of some kind (in particular in pl/pgsql)?
[Currently I am copying the table into a temp table and updating all NULL
values to a token value.]

regards,

Stuart.

+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street |
| Tel. (0171) 878 4041 | London, W1P 8BT, UNITED KINGDOM. |
| Fax. (0171) 878 4040 | stuart(at)ludwig(dot)ucl(dot)ac(dot)uk |
+-------------------------+--------------------------------------+

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hub.Org News Admin 1999-06-14 13:30:24
Previous Message Sascha Schumann 1999-06-14 11:05:31 Re: [GENERAL] Re: [HACKERS] postgres processes