X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C50C656475 for ; Tue, 15 Mar 2005 10:36:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84978-05 for ; Tue, 15 Mar 2005 10:36:24 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 995D65645B for ; Tue, 15 Mar 2005 10:36:23 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1DB9PR-000FTG-FY; Tue, 15 Mar 2005 10:36:25 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 1CBDB15990; Tue, 15 Mar 2005 10:36:06 +0000 (GMT) Message-ID: <4236BA96.4050701@archonet.com> Date: Tue, 15 Mar 2005 10:36:06 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: U K Laxmi Cc: pgsql-sql@postgresql.org Subject: Re: comparing 2 tables References: <20050315101058.91004.qmail@web20025.mail.yahoo.com> In-Reply-To: <20050315101058.91004.qmail@web20025.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/218 X-Sequence-Number: 20697 U K Laxmi wrote: > Thank you for the reply. Sorry for posting this > problem here. Thought SQL syntax for Ms Access and > PostgreSQL are similar. So, i posted here. > > My problem is: > > I've original version of a table called PMM (Product > Material Master). Thro' a web interface, user can > change that table contents. Once changed i need to > raise a ECN (Engineering CHange Note) specifying what > changes happened to original PMM table whether rows > are deleted, new rows are added or existing rows are > modified etc. I've both old and new version of PMM > tables. > > The difference between two PMM tables are captured in > a third table called ECN and it has both original & > new PMM table entries which are not same. Another option I've used in similar cases is to add a "version" column to the relevant tables (PMM in your case). Users can only change rows with version="editing" (or "live" or other code) and after review can confirm their changes. This makes a copy of all the data but with a new version-code (usually auto-generated). You can now compare any two versions to track changes. This system works well if you have relatively infrequent changes in large batches. In my case it was company-profile data (services, specialisations, contact personnel etc) and users would update their data at most every few months. I actually had a review phase in my system between editing and publishing a new version of a company's data. -- Richard Huxton Archonet Ltd