From: Dana Hudes <dhudes@tcp-ip.info>
To: pgsql-sql@postgresql.org
Subject: Re: bytea or blobs?
Date: Wed, 18 Feb 2004 01:44:52 -0500 (EST)
Message-ID: <Pine.LNX.4.58.0402180116000.729@screamer.tcp-ip.info> (raw)
In-Reply-To: <200402180914.29318.sad@bankir.ru>
References: <E8D7DFA4-5C92-11D8-B55E-0003938366A4@ntlworld.com>
<40322E69.30606@Yahoo.com>
<200402180914.29318.sad@bankir.ru>
The documentation indicates that bytea will -store- binary data
The problem is getting the data into the column through SQL.
The Postgresql SQL is character data only (side note: what about unicode?
is this USASCII only?). You cannot just wrap your binary stream in a pair
of quotes and off you go. You must encode before saving and decode after
retrieving. The encoded form is stored in the column.
What I have not figured out is how to pass my data to encode.
This is a builtin function but it doesn't take a filename so how can
you use it!
At least with base64 I have ample libraries and can convert my data
before sending to sql or after receiving from sql. It becomes my
application's issue. Mind, this bloats the data considerably.
escape is less bloat but I have to recreate the encode/decode in my app,
so far as I see.
On Wed, 18
Feb 2004, sad wrote:
> On Tuesday 17 February 2004 18:08, you wrote:
>
> > I'd recommend to let the application convert the binary
> > data to and from base64,
>
> Don't, please don't !
>
> Since you have the good bytea rule to convert so called "binary" data into so
> called "text". You have no need another encoding at all.
>
> Generally, the problem is to represent zero (0x00) when input/output. Any
> other byte might be stored, dumped, input, output without any problem. Then
> why to avoid 8bit chars ?
>
> Bytea notation rule completely resolve the problem of zeroes.
> (and also apostrophes :-) naturally)
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: dhudes@tcp-ip.info
Subject: Re: bytea or blobs?
In-Reply-To: <Pine.LNX.4.58.0402180116000.729@screamer.tcp-ip.info>
References: <E8D7DFA4-5C92-11D8-B55E-0003938366A4@ntlworld.com> <40322E69.30606@Yahoo.com> <200402180914.29318.sad@bankir.ru> <Pine.LNX.4.58.0402180116000.729@screamer.tcp-ip.info>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox