Skip site navigation (1) Skip section navigation (2)

Re: Re: charin(), text_char() should return something else for empty input

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Re: charin(), text_char() should return something else for empty input
Date: 2001-05-29 21:20:47
Message-ID: Pine.LNX.4.30.0105292310550.757-100000@peter.localdomain (view raw or flat)
Thread:
Lists: 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(at)gmx(dot)net   http://funkturm.homeip.net/~peter


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-05-29 22:55:13
Subject: Re: Re: charin(), text_char() should return something else for empty input
Previous:From: Peter EisentrautDate: 2001-05-29 21:03:36
Subject: Re: pg_log ??

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group