From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Patrick Robin <Patrick(dot)Robin(at)disney(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: backend dies when a user defined type returns null |
Date: | 2000-11-22 06:15:31 |
Message-ID: | 10679.974873731@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Patrick Robin <Patrick(dot)Robin(at)disney(dot)com> writes:
> In the example in chapter 5 it shows that the input function for the
> user defined type returns null when the input type doesn't match the
> correct format.
> I do that for input strings that don't match my strict n.n.n format ( ex
> 3.2.1) but it causes the backend to die.
The example is out to lunch, unfortunately :-( In current releases the
only clean way for an input routine to fail is to throw elog(ERROR).
You cannot return a SQL NULL, and if you try to fake it by returning
a null pointer, you'll just cause a null-pointer-dereference crash.
7.1 has a redesigned function-call interface that allows you to return
a NULL cleanly, but for now elog is the only way.
I'll make a note to fix that example in the 7.1 docs...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | John Gray | 2000-11-22 08:48:31 | Re: copy table from... |
Previous Message | rob | 2000-11-22 05:49:29 | Synchronization Toolkit |