decode/encode backslash to base64

From: ft <ftimmer(at)ft-c(dot)de>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: decode/encode backslash to base64
Date: 2024-03-24 21:29:39
Message-ID: 627b2e786823e1a27c3ee982c381fab627c39ff6.camel@ft-c.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message ft 2024-03-24 21:31:08 decode/encode backslash to base64
Previous Message Jamie Thompson 2024-03-22 19:51:33 Re: UPDATE with AND clarification