Re: Bytea/Base64 encoders for libpq - interested?

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Karel Zak" <zakkr(at)zf(dot)jcu(dot)cz>, "Joerg Hessdoerfer" <Joerg(dot)Hessdoerfer(at)sea-gmbh(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bytea/Base64 encoders for libpq - interested?
Date: 2001-09-04 15:46:44
Message-ID: 00dc01c13558$cd6ad790$0705a8c0@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> Ugh ... if the conversion functions are not inverses then I think they
> lose much of their value. I could see doing either of these:
>
> 1. Conversion functions based on byteaout/byteain.
>
> 2. Bytea to text escapes *only* null bytes, text to bytea treats only
> "\0" as an escape sequence.
>
> Or maybe both, with two pairs of conversion functions.
>
> In any case, we have to decide whether these coercion functions should
> be named after the types --- ie, should they be made invokable as
> implicit coercions? I'm dubious that that's a good idea; if we do it
> then all sorts of textual operations will suddenly be allowed for bytea
> without any explicit conversion, which is likely to do more harm than
> good. The reason for having a separate bytea type is exactly so that
> you *can't* apply text ops to it without thinking.
>
> regards, tom lane

You're right, as usual (I was tired when I wrote this last night ;). But I
think we have to escape/unescape both null and '\', don't we?

I agree that it would be better to *not* allow implicit coercions. Given
that, any preferences on function names? Are text_to_bytea() and
bytea_to_text() too ugly?

-- Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-09-04 16:01:11 Re: Bytea/Base64 encoders for libpq - interested?
Previous Message Tom Lane 2001-09-04 15:46:37 Re: Postgres is eating my CPU

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-09-04 16:01:11 Re: Bytea/Base64 encoders for libpq - interested?
Previous Message Karel Zak 2001-09-04 15:43:18 Re: [PATCHES] to_char and Roman Numeral (RN) bug