pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: gordonc@acenet.net.au
Cc: pgsql-sql@postgresql.org
Subject: Re: Null parm to a function
Date: Sat, 17 Jun 2000 01:46:01 -0400
Message-ID: <18044.961220761@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.10.10006132048130.27505-100000@localhost.localdomain>
References: <Pine.LNX.4.10.10006132048130.27505-100000@localhost.localdomain>

Gordon Clarke <gordonc@acenet.net.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



view thread (2+ messages)

Message-ID: <18044.961220761@sss.pgh.pa.us>
Permalink:  ../18044.961220761@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18044.961220761@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gordonc@acenet.net.au
  Subject: Re: Null parm to a function
  In-Reply-To: <18044.961220761@sss.pgh.pa.us>
  References: <Pine.LNX.4.10.10006132048130.27505-100000@localhost.localdomain> <18044.961220761@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox