Concatenating bytea types... - Mailing list pgsql-sql

From Marko Rihtar
Subject Concatenating bytea types...
Date
Msg-id CABSSDoFrOazsjrngAomQ4kgWgnrxbkLz8Gt_9YO6pQmTXgkEyQ@mail.gmail.com
Whole thread Raw
Responses Re: Concatenating bytea types...
List pgsql-sql
Hi all,<br /><br />i have a little problem.<br />I'm trying to rewrite one procedure from mysql that involves bytes
concatenation.<br/>This is my snippet from postgres code:<br />...<br />cv1 bytea;<br />...<br />cv1 :=
E'\\000'::bytea;<br/> ...<br />cv1 := CONCAT(cv1, DECODE(TO_HEX(11), 'escape'));<br />...<br />this third line throws
followingerror:<br />invalid hexadecimal digit: "\"<br /><br />I run it through the debugger and saw that after
assigningthe zero byte value to cv1 variable, postgres automatically converts it to \x00.<br /> And then inside CONCAT
itbrakes with above error.<br /><br />Inside select it works fine<br />select CONCAT(E'\\000'::bytea,
DECODE(TO_HEX(11),'escape'))<br />select CONCAT('\x00'::bytea, DECODE(TO_HEX(11), 'escape'))<br /><br />Is there a way
tosolve this somehow?<br /><br />thanks for help,<br /><br />Marko<br /> 

pgsql-sql by date:

Previous
From: Igor Neyman
Date:
Subject: Re: Using Ltree For Hierarchical Structures
Next
From: Mark Stosberg
Date:
Subject: Need help revoking access WHERE state = 'deleted'