Re: storing binary data - Mailing list pgsql-hackers

From Tom Lane
Subject Re: storing binary data
Date
Msg-id 6115.1003859376@sss.pgh.pa.us
Whole thread Raw
In response to storing binary data  ("Jason Orendorff" <jason@jorendorff.com>)
List pgsql-hackers
"Jason Orendorff" <jason@jorendorff.com> writes:
> Hi.  I was surprised to discover today that postgres's
> character types don't support zero bytes.  That is,
> Postgres isn't 8-bit clean.  Why is that?

(a) because all our datatype I/O interfaces are based on C-style   (null terminated) strings

(b) because comparison of character datatypes is based on strcoll()   (at least if you compiled with locale support)

Fixing either of these is far more pain than is justified to allow
people to store non-textual data in textual datatypes.  I don't foresee
it happening.

>  + What I really need is a binary *short* object type.
>    I have heard rumors of a legendary "bytea" type that might
>    help me, but it doesn't appear to be documented anywhere,
>    so I hesitate to use it.

It's real and it's not going away.  It is pretty poorly documented
and doesn't have a wide variety of functions ... but hey, you can help
improve that situation.  This is an open source project after all ;-)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Roland Roberts
Date:
Subject: Re: Is there no "DESCRIBE ;" on PGSQL? help!!!
Next
From: "Christopher Kings-Lynne"
Date:
Subject: LOCK ROW SHARE MODE