pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Rudi Starcevic <rudi@oasis.net.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Table Updates ..
Date: Tue, 11 Mar 2003 19:57:23 -0800
Message-ID: <200303111957.23061.josh@agliodbs.com> (raw)
In-Reply-To: <3E6EAE99.8030005@oasis.net.au>
References: <3E6EAE99.8030005@oasis.net.au>


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.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (3+ messages)  latest in thread

Message-ID: <200303111957.23061.josh@agliodbs.com>
Permalink:  ../200303111957.23061.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200303111957.23061.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, rudi@oasis.net.au
  Subject: Re: Table Updates ..
  In-Reply-To: <200303111957.23061.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox