Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Returning NULL to a set returning C type function


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Bborie Park <bkpark(at)ucdavis(dot)edu>
  • Cc: pgsql-general(at)postgresql(dot)org
  • Subject: Re: Returning NULL to a set returning C type function
  • Date: Wed, 11 May 2011 14:23:39 -0400
  • Message-id: <3247.1305138219@sss.pgh.pa.us> <text/plain>

Bborie Park <bkpark(at)ucdavis(dot)edu> writes:
> I have a C type function that returns a set of a type.  The problem I 
> have is that the underlying function may return NULL.  When the 
> underlying function returns NULL, I get the error message:

> ERROR:  function returning set of rows cannot return null value

> I'm wondering what is the proper way to correct this problem?

Don't do that ;-).  You could choose either to not return any row
at all when this happens, or to construct an all-nulls row to return.
ExecMakeTableFunctionResult doesn't want to guess which behavior is
appropriate for your use-case, so it just complains.

			regards, tom lane



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group