X-Original-To: pgsql-sql@postgresql.org Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by postgresql.org (Postfix) with ESMTP id 1E2D8476128 for ; Tue, 11 Mar 2003 23:05:39 -0500 (EST) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id OAA23691 for ; Wed, 12 Mar 2003 14:04:11 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3E6EB296.4020800@oasis.net.au> Date: Wed, 12 Mar 2003 14:07:50 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Table Updates .. References: <3E6EAE99.8030005@oasis.net.au> <200303111957.23061.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/273 X-Sequence-Number: 12313 Josh, Thanks for that. You're suggestion is how I currently have it. However some other's had doubted my method and suggested the logging table(s). Keeping is simple is much better. Thanks again. Regards Rudi. Josh Berkus wrote: >Rudi, > > > >>If I have 3 tables : >> >>orders, >>products, >>orders_products ( join table for orders and products ) >> >>If I insert an order with two products I have: >> >>2 rows in the products table, ( the two products ) >>1 row in the orders table and ( one order ) >>2 rows in the orders_products table. ( two products for this order ) >> >>So far so good. All that works well. >>But what if next week one the the products in the products table is >>updated and changed ? >>Then my order from last week is now different -- corrupted. It links to >>the same product_id but the product is changed. >> >> > >If you're concerned with "freezing" the product characteristics at the time of >the order, the answer is to add all or most of the columns in the products >table to orders_products. Then, at the time of order finalization >(shipping? not sure) you copy those columns from products to order_products. > >If you're into ORDMBS, you could even create orders_products as inheriting >products. But this isnt' required. > >This will work better than a monthly log. > > >