Re: cast bytea to text - Mailing list pgsql-general

From Albe Laurenz
Subject Re: cast bytea to text
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB2017A6FFC@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to cast bytea to text  ("Willy-Bas Loos" <willybas@gmail.com>)
Responses Re: cast bytea to text  ("Willy-Bas Loos" <willybas@gmail.com>)
List pgsql-general
> 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

Try ENCODE instead of DECODE ...

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Constructors for dates, times, and timestamps
Next
From: George Nychis
Date:
Subject: get username of user calling function?