Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id D602E9FA004 for ; Sat, 18 Nov 2006 08:32:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 69704-05 for ; Sat, 18 Nov 2006 08:32:36 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id C22DB9F9F0A for ; Sat, 18 Nov 2006 08:32:34 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by svr4.postgresql.org (Postfix) with ESMTP id 9107D5AF8B3 for ; Sat, 18 Nov 2006 12:32:33 +0000 (GMT) Received: by py-out-1112.google.com with SMTP id d32so586526pye for ; Sat, 18 Nov 2006 04:31:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=dobrcywSB8f6bYvniORluP8JVmd7Er8nQROwL8zi7vLzTLiOnyAzJwvDRBUHifcYffLQveTW2StYbN9mZCLzaAAOAsSn2XIO3PTAMfiRcJfSrSjWjAHbbl770N0JKv0iFjWz0V8ndgvXiSSi/9duE21rB+DOIB74f1jGSDXpRBk= Received: by 10.35.41.14 with SMTP id t14mr4349004pyj.1163853056400; Sat, 18 Nov 2006 04:30:56 -0800 (PST) Received: by 10.35.80.10 with HTTP; Sat, 18 Nov 2006 04:30:56 -0800 (PST) Message-ID: Date: Sat, 18 Nov 2006 18:00:56 +0530 From: "Rajesh Kumar Mallah" To: pgsql-sql@postgresql.org Subject: transactional shared variable in postgresql MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_889_6177256.1163853056349" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/191 X-Sequence-Number: 26843 ------=_Part_889_6177256.1163853056349 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. ------=_Part_889_6177256.1163853056349 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.
------=_Part_889_6177256.1163853056349--