Re: Re: charin(), text_char() should return something else for empty input - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Re: charin(), text_char() should return something else for empty input
Date
Msg-id Pine.LNX.4.30.0105292310550.757-100000@peter.localdomain
Whole thread Raw
In response to Re: Re: charin(), text_char() should return something else for empty input  (ncm@zembu.com (Nathan Myers))
Responses Re: Re: charin(), text_char() should return something else for empty input
List pgsql-hackers
Nathan Myers writes:

> Does the standard require any particular behavior in with NUL
> characters?

The standard describes the behaviour of the character types in terms of
character sets.  This decouples glyphs, encoding, and storage.  So
theoretically you could (AFAICT) define a character set that encodes some
meaningful character with code zero, but the implementation is not
required to handle this zero byte internally, it could catch it during
input and represent it with an escape code.

The standard also defines some possible "built-in" character sets, such as
LATIN1 and UTF16.  Most of these do not naturally contain a character that
is encoded with the zero byte.  In the case of the ISO8BIT/ASCII_FULL
charset, the standard explicitly says that the zero byte is not contained
in the character set.

In general, I don't see a point in accepting a zero byte in character
strings.  If you want to store binary data there are binary data types (or
effort could be invested in them).

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_log ??
Next
From: Tom Lane
Date:
Subject: Re: Re: charin(), text_char() should return something else for empty input