decode/encode backslash to base64

Поиск
Список
Период
Сортировка
Искать

decode/encode backslash to base64

От:
ft <ftimmer@ft-c.de>
Дата:
Hello, 

here is an example for decode and encode 
a string with backslash: 'a\'

select trim(convert_from(decode('YVw=', 'base64'), 'UTF8') )::text; 
answer: 'a\'

the next query throw an error: 
SQL Error [22P02]: ERROR: invalid input syntax for type bytea

select encode(trim(convert_from(decode('YVw=', 'base64'), 'UTF8')
)::text::bytea, 'base64' );

also:
select encode('a\'::text::bytea, 'base64');

What should I do?

Franz


Re: decode/encode backslash to base64

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
ft  writes:
> here is an example for decode and encode 
> a string with backslash: 'a\'

That is not valid input syntax for bytea.  See

https://www.postgresql.org/docs/current/datatype-binary.html

You've said nothing about what your actual purpose is,
so it's difficult to suggest what you should do differently.

			regards, tom lane


FAQ