Hi,
marcelo Cortez wrote:
Yes i know, but if your define bytea field and store
bytea in this field , decode don't work,
Sure it does:
test=# select encode(E'\\000\\001', 'escape')::text;
encode
----------
\000\x01
(1 row)
If you inspect the function, you'll find that encode can *only* handle
bytea, not text (as the first parameter):
test=# \df encode;
List of functions
Schema | Name | Result data type | Argument data types
------------+--------+------------------+---------------------
pg_catalog | encode | text | bytea, text
(1 row)
And trying to feed it text gives:
test=# select encode('some text'::text, 'escape')::text;
ERROR: function encode(text, "unknown") does not exist
Are you sure you tested with a real bytea field?
Regards
Markus