Re: C function and NULL result

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Victor Ivanov <v0rbiz(at)icon(dot)bg>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: C function and NULL result
Date: 2000-10-17 15:58:50
Message-ID: 1248.971798330@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Victor Ivanov <v0rbiz(at)icon(dot)bg> writes:
> I'm using PostgreSQL 7.0.2 and I'm trying to create my own types with
> input and output functions in C. Everything works fine, but when the input
> is invalid and the function returns NULL, the backend crashes with SIGSEGV.

You can't return an SQL NULL by returning a NULL pointer. Right now
there isn't a way for an input converter function to return NULL at all
(this is fixed for 7.1 though). I'd recommend throwing an elog(ERROR)
if you don't like the input data.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Bax 2000-10-17 16:04:56 Re: OpenBSD startup - logfile?
Previous Message Mitch Vincent 2000-10-17 15:57:58 Re: Re: C function returning rows, was Boolean text, with phrase ranking, search under Postgres