From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Denis Zaitsev <zzz(at)cd-club(dot)ru> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Are scalar type's in/out functions implicitly STRICT? |
Date: | 2003-02-28 02:44:37 |
Message-ID: | 1341.1046400277@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Denis Zaitsev <zzz(at)cd-club(dot)ru> writes:
> So, I create some new scalar type and I don't declare its in/out
> functions as STRICT. But PostgreSQL copes with them such as they
> would be STRICT - they never get the NULL value.
This is likely true in many places --- for example, COPY has a shortcut
because it wants to substitute \N for nulls. It would not be a bright
idea to assume that it's true in every place and forevermore. In
general, if you have a C function and don't want to be bothered with
explicit PG_ISNULL testing, you'd better mark it STRICT.
An example of an easy way to crash an I/O function without such guards
is to invoke it explicitly:
regression=# select textin(null::cstring);
textin
--------
(1 row)
regression=# select textout(null::text);
textout
---------
(1 row)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2003-02-28 03:24:44 | Re: Are scalar type's in/out functions implicitly STRICT? |
Previous Message | Denis Zaitsev | 2003-02-28 00:45:44 | Are scalar type's in/out functions implicitly STRICT? |