From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Scott Ribe <scott_ribe(at)killerbytes(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: IS it a good practice to use SERIAL as Primary Key? |
Date: | 2006-11-27 21:27:49 |
Message-ID: | 1164662869.16182.96.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2006-11-27 at 14:00 -0700, Scott Ribe wrote:
> > You would update the address, the address id wouldn't change. If you
> > want to keep track of old addresses you would keep an archive table
> > associated with the user.id.
>
> But what about historical data that referenced the address? If you move
> today, I still want to know where I shipped last week's orders.
As I mentioned, you can use an archive table, or you could have a column
in the order table that references the sale_to or ship_to address id.
There are actually many different ways to do this. For example:
insert a new address, and update the users table to the new address_id.
The new address has a column called active(boolean). Thus all your sales
orders would reference an inactive, but valid address for that sale.
Sincerely,
Joshua D. Drake
>
>
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2006-11-27 21:36:24 | Re: IS it a good practice to use SERIAL as Primary Key? |
Previous Message | Scott Ribe | 2006-11-27 21:24:06 | Re: IS it a good practice to use SERIAL as Primary Key? |