Skip site navigation (1) Skip section navigation (2)

Re: Problem with encode() function

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Glenn_Wiens(at)via-christi(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem with encode() function
Date: 2004-05-21 22:21:32
Message-ID: m38yfl2zgz.fsf@conexa.fciencias.unam.mx (view raw or flat)
Thread:
Lists: pgsql-novice
Glenn_Wiens(at)via-christi(dot)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.

In response to

pgsql-novice by date

Next:From: Jeffrey MelloyDate: 2004-05-22 02:52:48
Subject: Re: Set search_path
Previous:From: Glenn_WiensDate: 2004-05-21 19:50:31
Subject: Problem with encode() function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group