Re: Need Help and suggestion.

From: Richard Huxton <dev(at)archonet(dot)com>
To: amedp(at)fascom(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Need Help and suggestion.
Date: 2004-12-02 09:26:16
Message-ID: 41AEDFB8.8070009@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Artistic-HO- IT-Department wrote:
> Hi
>
> I have a user table in which number of users are created in a
> database rather creating postgresql user. We are having only one
> database user, through which we connect database.

OK

> Like Mr. A add intry into table and data is copied into audit table.
> Mr. B edit entry into table and data is copied into audit table. Mr.
> C delete entry into table but it add data into audit table that Mr. B
> delete it(As it was the person who edit last). It saved the whole row
> that was deleted.

> """"How can i make trigger on database that will add userid into
> audit table that Mr. C has deleted the entry."""""

Create a session table and store your user-name there when you connect.
Then the trigger can access the session table for the user-name. You can
use the backend process-id as a key for the table:
SELECT pg_backend_pid()

HTH
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-12-02 09:34:37 Re: Get diagnistic (row_count) 7.3 vs. 7.4 changes
Previous Message Chris Green 2004-12-02 08:44:22 Re: Upcoming Changes to News Server ...