Re: converting E'C:\\something' to bytea

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: converting E'C:\\something' to bytea
Дата
Msg-id 15216.1300291857@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: converting E'C:\\something' to bytea  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: converting E'C:\\something' to bytea  (Vlad Romascanu <vromascanu@accurev.com>)
Список pgsql-general
Bruce Momjian <bruce@momjian.us> writes:
> Vlad Romascanu wrote:
>> Is there any way of casting (reinterpreting) a varchar/text field
>> containing arbitrary backslashes to bytea without making an escaped
>> copy of the varchar/text first?

> Well, the '\\' is being converted to '\' because of the single-quotes,
> and then bytea is saying it doesn't know how to process \something.  It
> sounds like you want bytea but don't want the ability to use backslash
> escapes to input the bytea values.  I am unsure how to accomplish that.

A really dangerous way is

CREATE CAST (text AS bytea) WITHOUT FUNCTION;

It's dangerous because it assumes more than it ought to about the
internal representation of the two types ... but for a one-shot
conversion I think it'd be all right.

            regards, tom lane

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

Предыдущее
От: Vlad Romascanu
Дата:
Сообщение: Re: converting E'C:\\something' to bytea
Следующее
От: "Davenport, Julie"
Дата:
Сообщение: query taking much longer since Postgres 8.4 upgrade