Search Postgresql Archives

Re: C Language Stored Procedure Returning No Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

On Wed, Feb 01, 2006 at 12:56:30PM -0500, bfraci@xxxxxxx 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@xxxxxxxxxxxxx>
http://www.jefftrout.com/
http://www.stuarthamm.net/




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux