X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 622269FB32F for ; Mon, 31 Jul 2006 01:17:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 40742-02 for ; Mon, 31 Jul 2006 01:16:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web56610.mail.re3.yahoo.com (web56610.mail.re3.yahoo.com [66.196.97.54]) by postgresql.org (Postfix) with SMTP id 251BE9FB32C for ; Mon, 31 Jul 2006 01:16:52 -0300 (ADT) Received: (qmail 32249 invoked by uid 60001); 31 Jul 2006 04:16:44 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=FDhqWizy+yJykmU0hFcPfG6FixfyoQnhzNpECL6gESb4qRy6NKXhHuVxHuvDgjpqRQlTK05jjiJC7KnOZN3s1yfNVWAVr26XGMKCvThZLdLWss3LgJ7ZvCri0IjKS1oXkNlMuEoZCs4gCoZNOQtZZkzcIOIc8gdW+AIlwpte3yA= ; Message-ID: <20060731041644.32247.qmail@web56610.mail.re3.yahoo.com> Received: from [203.143.27.130] by web56610.mail.re3.yahoo.com via HTTP; Sun, 30 Jul 2006 21:16:44 PDT Date: Sun, 30 Jul 2006 21:16:44 -0700 (PDT) From: Thusitha Kodikara Subject: Triggers using PL/pgSQL To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1292997655-1154319404=:29607" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=4.429 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_00_10, HTML_MESSAGE X-Spam-Level: **** X-Archive-Number: 200607/368 X-Sequence-Number: 25942 --0-1292997655-1154319404=:29607 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello, I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be on a separate table). Though I have done similar things in other RDBMs using SQL, I find doing this in Postgres, a little bit complicated - may be because it needs to be done through a separate procedural language and through a separate function. The Postgres documentation also didn't provide much help ( the examples in C). I was mainly looking for example showing how to refer 'OLD' and 'NEW' rows using PL/pgSQL. Can someone please direct me to some such examples? Thanks and regards, -Thusitha --0-1292997655-1154319404=:29607 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello,

I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be on a separate table). 

Though I  have done similar things in other RDBMs using SQL, I find doing this in Postgres, a little bit complicated - may be because it needs to be done through a separate procedural language and through a separate function. The Postgres documentation also didn't provide much help ( the examples in C). I was mainly looking for example showing how to refer 'OLD' and 'NEW' rows using PL/pgSQL.

Can someone please direct me to some such examples?

Thanks and regards,
-Thusitha
--0-1292997655-1154319404=:29607--