Re: [PATCH] by request: base64 for bytea

Поиск
Список
Период
Сортировка
От Alex Pilosov
Тема Re: [PATCH] by request: base64 for bytea
Дата
Msg-id Pine.BSO.4.10.10106241108290.9446-100000@spider.pilosoft.com
обсуждение исходный текст
Ответ на Re: [PATCH] by request: base64 for bytea  (Marko Kreen <marko@l-t.ee>)
Список pgsql-hackers
On Sun, 24 Jun 2001, Marko Kreen wrote:

> On Sat, Jun 23, 2001 at 10:46:46PM -0400, Tom Lane wrote:
> > Marko Kreen <marko@l-t.ee> writes:
> > > Question to -hackers: currently there is not possible to cast
> > > bytea to text and vice-versa.  Is this intentional or bug?
> > 
> > Intentional.  text and friends do not like embedded nulls.
> > 
> > If there were a cast it would have to be one that implies
> > an I/O conversion, just like any other type that contains
> > non-textual data.
> 
> Well, I have functions that should work on both - encode(),
> digest(), hmac().  Probably should do then several entries.  Ok.
> 
> But what should be return type of decrypt()?  I imagine well
> situations where user wants to crypt both bytea and text data.
> When there is even not a way to cast them to each other, then
> he is stuck for no good reason.
There SHOULD be a text_bytea function to cast a text as bytea, as it is
always safe. (It doesn't exist yet, but its a trivial patch)

Function to cast bytea as text, I think, should do proper checking that
input did not contain nulls, and return text data back.

Your encrypt/decrypt should take bytea and return bytea. Its user's
responsibility to cast the things to bytea when needed.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] by request: base64 for bytea
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] by request: base64 for bytea