X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 065D6D1B52C for ; Tue, 2 Sep 2003 16:05:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78130-01 for ; Tue, 2 Sep 2003 13:04:58 -0300 (ADT) Received: from ctb-mesg2.saix.net (ctb-mesg2.saix.net [196.25.240.74]) by svr1.postgresql.org (Postfix) with ESMTP id 305E4D1B574 for ; Tue, 2 Sep 2003 13:04:52 -0300 (ADT) Received: from lazy (rrba-bras-203-248.telkom-ipnet.co.za [165.165.203.248]) by ctb-mesg2.saix.net (Postfix) with SMTP id A418335FE for ; Tue, 2 Sep 2003 18:04:49 +0200 (SAST) From: "Conrad Vermeulen" To: Subject: referencing an unknown variable in the NEW record in a trigger Date: Tue, 2 Sep 2003 18:08:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=MSGID_GOOD_EXCHANGE, RCVD_IN_OSIRUSOFT_COM X-Spam-Level: X-Archive-Number: 200309/21 X-Sequence-Number: 10109 Hi, I have a situation where I need to dereference the fields in the NEW record within a trigger. I know the standard way where NEW.fieldname where fieldname is known before hand. What if fieldname is a text variable? Say, -------------------------- DECLARE fldname text; begin fldname = 'name'; raise exception '% has value %', fldname, NEW.fldname; -- is this possible? return NEW; end; -------------------------- is there a way such as NEW.fldname, or NEW.%fldname, or NEW.$fldname? Any help appreciated, Thanks, Conrad