Using chkpass() in a query

From: Michael A Nachbaur <mike(at)nachbaur(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Using chkpass() in a query
Date: 2003-12-11 18:34:14
Message-ID: 200312111034.14571.mike@nachbaur.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm trying to perform an SQL statement to extract usernames and crypt'd
passwords from a database table, and am running into difficulties with
chkpass. I can run it just fine in a straight query, but when I try to use
it on a column from an SQL statement I get an error.

scamp=# SELECT CHKPASS('foo');
chkpass
----------------
:Zbcg0W4wPBNBU
(1 row)

scamp=# SELECT CHKPASS(Password) FROM EmailAddress;
ERROR: Function chkpass(character varying) does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts
scamp=# SELECT CHKPASS(Password::TEXT) FROM EmailAddress;
ERROR: Function chkpass(text) does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts
scamp=# SELECT CHKPASS(Password::CSTRING) FROM EmailAddress;
ERROR: Cannot cast type character varying to cstring

Does anyone have any suggestions on how I could accomplish the above?

--
/* Michael A. Nachbaur <mike(at)nachbaur(dot)com>
* http://nachbaur.com/pgpkey.asc
*/

...[Arthur] leapt to his feet like an author hearing the phone ring...

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2003-12-11 21:01:22 simple LEFT JOIN giving wrong results ...
Previous Message Guy Fraser 2003-12-10 23:11:10 Re: picking max from list