Re: Problem with encode() function - Mailing list pgsql-novice

From Manuel Sugawara
Subject Re: Problem with encode() function
Date
Msg-id m38yfl2zgz.fsf@conexa.fciencias.unam.mx
Whole thread Raw
In response to Problem with encode() function  (Glenn_Wiens@via-christi.org)
List pgsql-novice
Glenn_Wiens@via-christi.org writes:

> but I still get the error:
>
> ERROR:  Function encode(text, "unknown") does not exist
>         Unable to identify a function that satisfies the given argument
> types
>         You may need to add explicit typecasts
>
> Is there a way I can accomplish this task?

The problem is that there is no cast from varchar to bytea (which is
what encode takes as first argument). Try creating the cast first:

  CREATE CAST (varchar as bytea) WITHOUT FUNCTION;
  SELECT encode(password::bytea, 'base64'::text) FROM texttable;

You may want to drop the cast afterwards.

Regards,
Manuel.

pgsql-novice by date:

Previous
From: Glenn_Wiens@via-christi.org
Date:
Subject: Problem with encode() function
Next
From: Jeffrey Melloy
Date:
Subject: Re: Set search_path