Hi all,

i have a little problem.
I'm trying to rewrite one procedure from mysql that involves bytes
concatenation.
This is my snippet from postgres code:
...
cv1 bytea;
...
cv1 := E'\\000'::bytea;
...
cv1 := CONCAT(cv1, DECODE(TO_HEX(11), 'escape'));
...
this third line throws following error:
invalid hexadecimal digit: "\"

I run it through the debugger and saw that after assigning the zero byte
value to cv1 variable, postgres automatically converts it to \x00.
And then inside CONCAT it brakes with above error.

Inside select it works fine
select CONCAT(E'\\000'::bytea, DECODE(TO_HEX(11), 'escape'))
select CONCAT('\x00'::bytea, DECODE(TO_HEX(11), 'escape'))

Is there a way to solve this somehow?

thanks for help,

Marko

Reply via email to