Tom Lane wrote:
>
> Hannu Krosing <[EMAIL PROTECTED]> writes:
> > Is there no simple (i.e. cheap) way to disallow \0 alltogether for
> > these types then ?
> > perhaps just strip them out in textin() (or is it text_in()) ?
>
> They *are* stripped out in textin(), by virtue of the fact that
> textin expects to see a null-terminated input string.
Ok, I was mistaken to think that pg_trigger.tgargs contained real \0's
and not fakes and I was able to get similar output from other char
types by using \\000 - You never can tell how many \\\\ are required to
input a single \ to next level.
Also I remember being told that bytea _can_ hold embedded \0, no ?
> > Should we not examine "the _possible_ outputs of every C-coded function
> > to make sure it produces a valid value of the datatype" ;)
>
> Go for it.
>
> Possibly chr() should reject chr(0) ...
there is no function chr() at least in 7.0.2.
and char is not usable from psql (gives out strange errors);
hannu=# select char(0);
ERROR: length for type 'bpchar' must be at least 1
hannu=# select char(32);
ERROR: parser: parse error at or near ";"
hannu=# select char('a');
ERROR: parser: parse error at or near "'"
could it be possible somehow distinguish between user callable (safe)
functions and "internal" ones ?
------------
Hannu