Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E36609F9F0A for ; Sat, 18 Nov 2006 09:46:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26756-08 for ; Sat, 18 Nov 2006 09:46:04 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.186]) by postgresql.org (Postfix) with ESMTP id 70CF99F9B3F for ; Sat, 18 Nov 2006 09:46:04 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so1856016nfb for ; Sat, 18 Nov 2006 05:46:02 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NQ9s6UlkQpiox9FYCEsy66Fp+KQ0rayIasKgWf3YEvkBHLDseIoETJu91R5V+f+DKObuVIj29BHpVNCaDqB/rY/hTyZBsSA6pRF5Fx86aAZfa7lFvTVN9hoDgJ7iEos8kheMZPwM1YFG7dcdPVONmr/brcsKEZbwD0DkRr6mhdo= Received: by 10.82.153.5 with SMTP id a5mr359821bue.1163857562075; Sat, 18 Nov 2006 05:46:02 -0800 (PST) Received: by 10.82.161.3 with HTTP; Sat, 18 Nov 2006 05:46:02 -0800 (PST) Message-ID: <1f30b80c0611180546p35332e82mb592bcd6a048576d@mail.gmail.com> Date: Sat, 18 Nov 2006 18:46:02 +0500 From: imad To: "Rajesh Kumar Mallah" Subject: Re: transactional shared variable in postgresql Cc: pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/192 X-Sequence-Number: 26844 Why dont you try to make 'username' part of your query. While auditing updates and inserts, the username can be some how made a part of the tuple being inserted. Just a thought! --Imad www.EnterpriseDB.com On 11/18/06, Rajesh Kumar Mallah wrote: > 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. >