Re: Null parm to a function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gordonc(at)acenet(dot)net(dot)au
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Null parm to a function
Date: 2000-06-17 05:46:01
Message-ID: 18044.961220761@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gordon Clarke <gordonc(at)acenet(dot)net(dot)au> writes:
> Now if I try to do the same thing but via my function,
> SELECT insert_row(1235,null,100);
> I get the following error
> ERROR: typeidTypeRelid: Invalid type - oid = 0

> Why wont the function allow me to pass a 'null' parm?

You're running into a longstanding shortcoming of the function-call
interface inside Postgres: there's only one NULL-parameter flag passed
to a function, so if any of the parameters are NULL then they all are
taken to be NULL. I'm not quite sure why you're seeing that particular
error message, but in any case you'd have gotten a failure from the NOT
NULL constraints on the other two columns.

The only comfort I have to offer is that this will work in 7.1 ---
in fact, your example does work in current development sources.
That's a result of a major rewrite of the function manager. There's
no chance of backpatching the fix into 7.0.* or earlier.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message James Carpenter 2000-06-17 09:39:07 Determining Array size. (HACK)
Previous Message Gordon Clarke 2000-06-17 05:15:36 Null parm to a function