public inbox for [email protected]
help / color / mirror / Atom feeddecode/encode backslash to base64
3+ messages / 3 participants
[nested] [flat]
* decode/encode backslash to base64
@ 2024-03-24 21:29 ft <[email protected]>
2024-03-25 13:48 ` Re: decode/encode backslash to base64 Tom Lane <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: ft @ 2024-03-24 21:29 UTC (permalink / raw)
To: [email protected]
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: decode/encode backslash to base64
2024-03-24 21:29 decode/encode backslash to base64 ft <[email protected]>
@ 2024-03-25 13:48 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2024-03-25 13:48 UTC (permalink / raw)
To: [email protected]; ft <[email protected]>; +Cc: [email protected]
ft <[email protected]> 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* decode/encode backslash to base64
@ 2024-03-24 21:31 ft <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: ft @ 2024-03-24 21:31 UTC (permalink / raw)
To: [email protected]
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-03-25 13:48 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-03-24 21:29 decode/encode backslash to base64 ft <[email protected]>
2024-03-25 13:48 ` Re: decode/encode backslash to base64 Tom Lane <[email protected]>
2024-03-24 21:31 decode/encode backslash to base64 ft <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox