Re: [PATCH] by request: base64 for bytea - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [PATCH] by request: base64 for bytea
Date
Msg-id 200106242105.f5OL5sh28859@candle.pha.pa.us
Whole thread Raw
In response to Re: [PATCH] by request: base64 for bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Alex Pilosov <alex@pilosoft.com> writes:
> > Function to cast bytea as text, I think, should do proper checking that
> > input did not contain nulls, and return text data back.
> 
> That is most definitely not good enough.  In MULTIBYTE installations
> you'd have to also check that there were no illegal multibyte sequences.
> 
> The whole approach seems misguided to me anyway.  bytea isn't equivalent
> to text and conversion functions based on providing incomplete binary
> equivalence are fundamentally wrong.  hex or base64 encode/decode
> functions seem like reasonable conversion paths, or you could provide
> a function that mimics the existing I/O conversions for bytea, ugly as
> they are.

He can create an output function just to text, and varchar, etc will work
OK, right?

I think the main issue is that char(), varchar(), text all input/output
strings of the same format while bytea has special backslash handling
for binary/null values.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] by request: base64 for bytea
Next
From: Bruce Momjian
Date:
Subject: Re: Why would this use 600Meg of VM?