Returning null from Userdefined C function

From: Andrew Selle <aselle(at)upl(dot)cs(dot)wisc(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Returning null from Userdefined C function
Date: 2000-08-11 20:29:21
Message-ID: 20000811152921.C27329@upl.cs.wisc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm trying to write a function that takes a text input and returns
a text output. I can get this to work. The problem is that I want
to return NULL when the input string doesn't match the criteria I
desire. Unfortunately, returning NULL seems to crash the backend.
i.e. if I did

#include "postgres.h"
text * andytest ( text * str )
{
return NULL;
}

The backend would quit unexpectantly when I ran
select andytest('fds');
or select andytest(NULL);

Obviously, there must be some way to create a NULL text * return
variable, but I haven't been able to find it. I've looked at all
the code I've been able to find to no avail.

-Andy

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Louis-David Mitterrand 2000-08-11 21:18:23 Re: Off topic 'C' question
Previous Message Louis-David Mitterrand 2000-08-11 20:07:39 Re: problem with float8 input format