Re: how to read bytea field

Поиск
Список
Период
Сортировка
От Markus Schiltknecht
Тема Re: how to read bytea field
Дата
Msg-id 45B76170.7010501@bluegap.ch
обсуждение исходный текст
Ответ на Re: how to read bytea field  (marcelo Cortez <jmdc_marcelo@yahoo.com.ar>)
Ответы Re: how to read bytea field  (marcelo Cortez <jmdc_marcelo@yahoo.com.ar>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: marcelo Cortez
Дата:
Сообщение: Re: how to read bytea field
Следующее
От: marcelo Cortez
Дата:
Сообщение: Re: how to read bytea field