Re: MAY I HAVE YOUR ASSISTANCE

From: "Gary Chambers" <gwchamb(at)gmail(dot)com>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Cc: jameskitambara(at)yahoo(dot)co(dot)uk, pgsql-sql(at)postgresql(dot)org
Subject: Re: MAY I HAVE YOUR ASSISTANCE
Date: 2008-09-01 14:31:25
Message-ID: 302670f20809010731gd2d5d64xec8bb212d356a641@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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! */

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Fernando Hevia 2008-09-01 15:42:40 Re: MAY I HAVE YOUR ASSISTANCE
Previous Message D'Arcy J.M. Cain 2008-09-01 14:08:52 Re: MAY I HAVE YOUR ASSISTANCE