Re: Making TEXT NUL-transparent - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Making TEXT NUL-transparent
Date
Msg-id 24421.1322153236@sss.pgh.pa.us
Whole thread Raw
In response to Re: Making TEXT NUL-transparent  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On Thu, Nov 24, 2011 at 4:54 AM, Florian Weimer <fweimer@bfk.de> wrote:
>> By the way, I refuse the notion that UTF-8 strings with embedded NULs
>> are "broken".  I can't recall any other system which enforces UTF-8
>> well-formedness, but does not permit embedded NULs.

> Refuse away, but I don't think you know what you're asking for. Given the
> number of places that treat text values as being nul-terminated in the
> code, we'd be many years fixing bugs from a change like this, IMNSHO.

Yeah.  This has been discussed before (see the archives) and every time
we've concluded that the amount of pain and developer effort would
outweigh the benefit by many orders of magnitude.  Just to start with,
we'd have to change the convention that datatype I/O functions take and
return cstring, thus breaking every core and add-on datatype.

If you really need to store nulls, use bytea.  If there are specific
operations you need that aren't available on bytea, we'd probably
entertain proposals to add them.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: proposal: better support for debugging of overloaded functions
Next
From: Tom Lane
Date:
Subject: Re: Wire protocol: type-specific opt-in to binary format