From: Tom Lane <tgl@sss.pgh.pa.us>
To: Denis Zaitsev <zzz@cd-club.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: Are scalar type's in/out functions implicitly STRICT?
Date: Thu, 27 Feb 2003 21:44:37 -0500
Message-ID: <1341.1046400277@sss.pgh.pa.us> (raw)
In-Reply-To: <20030228054544.A4208@natasha.zzz.zzz>
References: <20030228054544.A4208@natasha.zzz.zzz>
Denis Zaitsev <zzz@cd-club.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, zzz@cd-club.ru
Subject: Re: Are scalar type's in/out functions implicitly STRICT?
In-Reply-To: <1341.1046400277@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox