Search Postgresql Archives

Re: how to read bytea field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux