Re: Referencing a view?

From: "Grigoriy G(dot) Vovk" <grigoriy(dot)vovk(at)linustech(dot)com(dot)cy>
To: James Orr <james(at)lrgmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Referencing a view?
Date: 2001-07-13 15:12:13
Message-ID: 20010713175036.P886-100000@callisto.internal.linustech.com.cy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jul 13, 09:41 -0400, James Orr wrote:

> Thanks for all the responses! The one from Grigoriy was particularly
> interesting, I hadn't thought of that approach.
>
> However, I came to the realization that if somebody changes their address, I
> don't want it to be changed on previous orders. So I think i'll change the
> orders table to contain the actual address information and use an INSERT ...
> SELECT instead. That way I can be sure I have an accurate record of all
> orders.
Yes, its really a problem... When information sometime changes but we
want to keep old information for depending data. (If I understand correctly
what about you are speaking).
But, you can resolve the problem if will copy information about address
for executed order in a different place as a text, not as a link to the
table 'address'. So, after execution of an order you will take current
address by the link and copy all information (may be, as one field
everything - concat all fields from the address together). Its a one
solution.
Next - you can use many addresses for an entity, and work only with some
of them, 'valid', or 'current', as do you like, not with all.
So, you will have full addresses history - when was changed, etc. And the
order will always links to correct address, even now current address is
different.
You can do it by add field 'current' bool in the table 'address' or
create additional table 'current_address' which will have 'id_entity' and
'id_address', so if you will do a search on 'current_address' you got
a list of current addresses, in case you will do a search on 'address' -
you got a list of all addresses. I prefere to create additional table.
May be I've explained not well - ask, I'll type an database structure
example, for developers it may be easy way :)

my best regards,
----------------
Grigoriy G. Vovk

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-07-13 15:14:22 Re: Referencing a view?
Previous Message James Orr 2001-07-13 13:41:16 Re: Referencing a view?