Re: C Language Stored Procedure Returning No Data

From: Jeff Trout <threshar(at)torgo(dot)978(dot)org>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: bfraci(at)aol(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: C Language Stored Procedure Returning No Data
Date: 2006-02-03 14:07:48
Message-ID: 48DFCEDF-B290-40DC-910E-71E04BE14374@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Feb 2, 2006, at 7:17 PM, Michael Fuhr wrote:

> On Wed, Feb 01, 2006 at 12:56:30PM -0500, bfraci(at)aol(dot)com wrote:
>> From a C stored procedure, how can I tell Postgres to pass on to
>> the Java client that there is No Data? A zero length byte array or
>> a null value is not the same as No Data.
>
> If you declare the function with "RETURNS bytea" then the function
> must return something; if zero-length data and NULL aren't suitable
> for indicating no data then you could raise an error and catch that
> error in the client. Another possibility would be to make the
> function set-returning ("RETURNS SETOF bytea" and some code changes)
> and return no rows to indicate no data.

Another possibility is to log an exception with elog & company.
However that will also have the side effect of rolling back the txn
if you are currently in one.

--
Jeff Trout <jeff(at)jefftrout(dot)com>
http://www.jefftrout.com/
http://www.stuarthamm.net/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stéphane SCHILDKNECHT 2006-02-03 14:43:01 Number format problem
Previous Message Magnus Hagander 2006-02-03 13:24:43 Re: Alternative to knoda, kexi and rekall?