Re: store in bytea

From: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>
Cc: "Joe Conway" <joseph(dot)conway(at)home(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: store in bytea
Date: 2001-08-26 15:03:43
Message-ID: 3.0.5.32.20010826230343.016477c0@192.228.128.13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 09:28 AM 8/24/01 -0400, Tom Lane wrote:
>"Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il> writes:
>> On the theoretical issue, can I use TEXT field to store binary ?
>
>TEXT will not handle null (zero) bytes. If you are using a multibyte
>character set, it will likely also do the wrong thing with byte
>sequences that are illegal or incomplete multibyte characters.
>
>Use BYTEA if you want to store arbitrary byte sequences --- that's what
>it's for.

I wanted to use bytea wasn't sure how though. So I used base64 and text.
Yeah that is ugly but it works.

With bytea I didn't understand how to quote and unquote stuff. And how
stuff is stored. At that time the docs were sparse on it. I didn't know
what characters I'd need to unquote and quote and how, yeah null was one
but the others?

Sure people can use the source to figure out how to use bytea. But what if
the source is different from the intended behaviour and the source is fixed
later.

Don't want to be hit by a gotcha after writing lots of code y'know.

So base64 and text it was. It was either that or store in the filesystem
(that's what I did with 6.5 - sorry but I have no confidence in postgresql
BLOBs).

Cheerio,
Link.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francesco Casadei 2001-08-26 15:40:30 Re: version 1 C-Language Functions
Previous Message Lincoln Yeoh 2001-08-26 14:46:23 Re: MySQL's (false?) claims... (was: Re: PL/java?)