transactional shared variable in postgresql

From: "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: transactional shared variable in postgresql
Date: 2006-11-18 12:30:56
Message-ID: a97c77030611180430p764dac32ue19ade554ec80cbe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi ,

Is there any way to set a variable from a web application (using dbi/perl ,
libpq etc),
and access the same variable from a C trigger inside a transaction ?

the %_SHARED hash available in plperl provides only session level isolation
and
does not suit the requirement.

Original problem:

we want to setup table auditing using table_log or audittrail projects.
the triggers used in these systems uses the current database user
to log to the audit tables..

In our webapps, we use the same username to connect to the database
for all kind of updates. Hence we are not able to makeout whoo modified
what . However at application level we have different "userid" for different

users of the system. we want to somehow pass this "userid" to the databasee
server and accesss it from the triggers that implement the audit functions.

we thought of using a table of single row and single column to store
the userid but we are concerned over the performance due to locking
issues.

Regds
Mallah.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message imad 2006-11-18 13:46:02 Re: transactional shared variable in postgresql
Previous Message Aaron Bono 2006-11-17 23:14:51 Re: Random()