Re: Unclear documentation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unclear documentation
Date
Msg-id 5368.1131599696@sss.pgh.pa.us
Whole thread Raw
In response to Unclear documentation  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-hackers
Christopher Kings-Lynne <chriskl@familyhealth.com.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Comments from a Firebird user via Borland Newsgroups.
Next
From: "Magnus Hagander"
Date:
Subject: Re: Install issue on Windows and directory permission