From: | "Berend Tober" <btober(at)seaworthysys(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: change user password |
Date: | 2005-02-17 20:08:50 |
Message-ID: | 63616.216.238.112.88.1108670930.squirrel@216.238.112.88 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> hi, is it possible to change the current user's password from a
> function/stored procedure , I mean, is there a system function/stored
> procedure to do it? like the dbo.sp_password found in adaptive server
> anywhere.
>
CREATE OR REPLACE FUNCTION public.alter_password(name, name)
RETURNS "varchar" AS
'
DECLARE
l_user ALIAS FOR $1;
l_pwd ALIAS FOR $2;
CMD VARCHAR;
BEGIN
CMD := \'ALTER USER "\' || l_user || \'" WITH ENCRYPTED PASSWORD \' ||
\'\'\'\' || l_pwd || \'\'\'\' || \' VALID UNTIL \' || \'\'\'\' ||
CURRENT_DATE+INTERVAL \'30 days\' || \'\'\'\';
EXECUTE CMD;
RETURN \'ALTER USER\';
END;
'
LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER;
-- Of course, you'ld want to be careful about whom was granted execute
permission on this.
-- BMT
From | Date | Subject | |
---|---|---|---|
Next Message | Sailer, Denis (YBUSA-CDR) | 2005-02-17 20:32:00 | CREATE INDEX failing; No space left on device; Database recycling itself |
Previous Message | John Allgood | 2005-02-17 19:18:37 | Re: Problems compiling 7.4.6 src rpms |