cast bytea to text

From: "Willy-Bas Loos" <willybas(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: cast bytea to text
Date: 2007-03-01 13:15:49
Message-ID: 1dd6057e0703010515j6bc6cad7he3c444e78bb9e07d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear List,

How can i cast bytea to text?
I´ve read about the DECODE function, but my 8.1 backend doesn´t recognize
it.
I´m trying to create an implicit cast using the function:

create or replace function bytea2text(bytea) returns text as
$$
select DECODE($1, 'escape');
$$
language sql strict;

Answer:
ERROR: function decode(bytea, "unknown") does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You may need to
add explicit type casts.
Context: SQL function "bytea2text"

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-03-01 13:32:57 Re: [HACKERS] urgent: upgraded to 8.2, getting kernel panics
Previous Message Kenneth Downs 2007-03-01 13:13:05 Re: usage for 'with recursive'?