Re: cast bytea to text

From: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
To: "Willy-Bas Loos *EXTERN*" <willybas(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: cast bytea to text
Date: 2007-03-01 16:39:00
Message-ID: AFCCBB403D7E7A4581E48F20AF3E5DB2017A6FFC@EXADV1.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-03-01 16:39:39 Re: creating a function with a variable table name
Previous Message Tom Lane 2007-03-01 16:38:05 Re: Constructors for dates, times, and timestamps