Stuart Rison <rison@biochemistry.ucl.ac.uk> writes:
> Now this would work except that there's a problem with pl/pgSQL such that
> when you pass several values to a plpgsql function and one of them is
> NULL, then all values passed to the function become NULL.
Yes. That's not plpgsql's fault; there's a basic design limitation in
the function-call interface (only one isnull flag gets passed). There
has been some talk on the pghackers list of fixing this, but I do not
know if it will happen any time soon or not. Fixing that interface
would mean revising *all* the code that implements any SQL function or
operator, so it'd be pretty tedious --- and it'd break any C-coded
user functions, too. It'll probably get done eventually, maybe even
for 6.6, but don't hold your breath...
regards, tom lane