Re: Bytea/Base64 encoders for libpq - interested?

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Joerg Hessdoerfer <Joerg(dot)Hessdoerfer(at)sea-gmbh(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bytea/Base64 encoders for libpq - interested?
Date: 2001-08-28 09:55:28
Message-ID: 20010828115528.A12403@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Tue, Aug 28, 2001 at 11:07:32AM +0200, Joerg Hessdoerfer wrote:
> Hi!
>
> Please find attached some very simple encoders/decoders for bytea and base64.
> Bytea encoder is very picky about what it leaves unescaped - basically the
> base64
> char set ;-)
>
> Since this seems to be a very poorly documented but much asked-for thing, I
> thought
> you would maybe like to add this code to libpq (so that everyone benefits).
>
> I'm aware that function renames might be necessary, though.
> If you like, I could make the code fit into libpq, and send diffs.
>
> Any comments/interests?

What implement base64 PostgreSQL datetype that use externaly base64 and
internaly same things as bytea. It prevent FE and parser problems with
"bad" chars and internaly for data storage save less space than text
with base64. Of course it doesn't solve a problem with encoding/decoding
data in your application to/from base64. May be implement for this
datetype cast to/from bytea too.

SELECT my_bytea::base64 FROM foo;

INSERT INTO foo (my_bytea) VALUES ('some_base64_string'::bytea);

And you can still fetch all data directly in batea by binary cursor.

Comments?

Karel
--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2001-08-28 10:00:58 Re: Re: Link to bug webpage
Previous Message Peter Eisentraut 2001-08-28 09:51:30 Re: 7.1.3, IRIX 6.5 and gcc

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-08-28 16:14:48 Re: official submission for OU8/UnixWare sharedlib patch
Previous Message Joerg Hessdoerfer 2001-08-28 09:07:32 Bytea/Base64 encoders for libpq - interested?