Re: how do i store \0 inside a text attribute? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: how do i store \0 inside a text attribute?
Date
Msg-id 10209.978134389@sss.pgh.pa.us
Whole thread Raw
In response to how do i store \0 inside a text attribute?  (Paul A Vixie <vixie@mfnx.net>)
Responses Re: how do i store \0 inside a text attribute?  (Paul A Vixie <vixie@mfnx.net>)
List pgsql-hackers
Paul A Vixie <vixie@mfnx.net> writes:
> this is not what i was hoping for at ALL.  evidently the implementation of
> text assumes NUL-termination in other places than the parser.

Yes.  The entire datatype I/O system is based on null-terminated
strings, so there's no easy way to fix this.  If it were just an
internal problem then maybe we'd bite the bullet and do it, but
breaking every user-defined datatype in existence seems too high
a price to pay for this problem.

> ultimately
> this means that pgsql will need a "blob" type whose presentation format is
> uuencode or some such.

See bytea, though its presentation format leaves something to be desired
IMHO.

> how would someone be expected to store, say, a GIF image in a TOAST text?

One would not.  A TOASTed bytea is the appropriate column type.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: GNU readline and BSD license
Next
From: Alfred Perlstein
Date:
Subject: Re: GNU readline and BSD license