Re: MAY I HAVE YOUR ASSISTANCE - Mailing list pgsql-sql

From Gary Chambers
Subject Re: MAY I HAVE YOUR ASSISTANCE
Date
Msg-id 302670f20809010731gd2d5d64xec8bb212d356a641@mail.gmail.com
Whole thread Raw
In response to Re: MAY I HAVE YOUR ASSISTANCE  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Responses Re: MAY I HAVE YOUR ASSISTANCE  ("Fernando Hevia" <fhevia@ip-tel.com.ar>)
List pgsql-sql
>> I have one problem with the user table. I want to hide the password for the users.

Here's what I did, which requires using the contrib/pgcrypto extension:

CREATE FUNCTION encryptpw() RETURNS TRIGGER AS
$encryptpw$
BEGIN       NEW.password = CRYPT(NEW.password, GEN_SALT('md5'));       RETURN NEW;
END;
$encryptpw$

CREATE TRIGGER trg_encryptpw BEFORE INSERT OR UPDATE ON assignees
FOR EACH ROW EXECUTE PROCEDURE encryptpw();

Comments, suggestions, criticisms?

-- Gary Chambers

/* Nothing fancy and nothing Microsoft! */


pgsql-sql by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: MAY I HAVE YOUR ASSISTANCE
Next
From: "Fernando Hevia"
Date:
Subject: Re: MAY I HAVE YOUR ASSISTANCE