Re: Unclear documentation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unclear documentation
Date: 2005-11-10 05:14:56
Message-ID: 5368.1131599696@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> In the CREATE FUNCTION docs I notice this:
> RETURNS NULL ON NULL INPUT or STRICT indicates that the function always
> returns null whenever any of its arguments are null. If this parameter
> is specified, the function is not executed when there are null
> arguments; instead a null result is assumed automatically.

> I'm wondering what this means when the function returns a composite
> type,

You get a null rowtype value ... which is not really the same thing as a
row of nulls, though it behaves similarly in the sense that trying to
extract any one field from it produces null.

> or a setof scalar or a setof composite?

You get zero rows.

> So if you indicate STRICT, does PostgreSQL assume one row of all nulls
> for each column in the return composite type?

No.

> Perhaps someone who knows better could tweak the docs a bit?

Can you propose wording that defines all this without being even more
confusing? The point that the quoted sentence is making is merely that
the function is never actually called, which is true in all cases.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fredrik Olsson 2005-11-10 10:33:30 Underlying view columns?
Previous Message Tom Lane 2005-11-10 05:07:14 Re: Comments from a Firebird user via Borland Newsgroups.