pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grigoriy G. Vovk <grigoriy.vovk@linustech.com.cy>
To: James Orr <james@lrgmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Referencing a view?
Date: Fri, 13 Jul 2001 18:12:13 +0300 (EEST)
Message-ID: <20010713175036.P886-100000@callisto.internal.linustech.com.cy> (raw)
In-Reply-To: <002301c10ba1$90872260$1600000a@lrg.office>

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




view thread (6+ messages)  latest in thread

Message-ID: <20010713175036.P886-100000@callisto.internal.linustech.com.cy>
Permalink:  ../20010713175036.P886-100000@callisto.internal.linustech.com.cy/
Also on:    postgresql.org/message-id/20010713175036.P886-100000@callisto.internal.linustech.com.cy

 · 

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: grigoriy.vovk@linustech.com.cy, james@lrgmail.com
  Subject: Re: Referencing a view?
  In-Reply-To: <20010713175036.P886-100000@callisto.internal.linustech.com.cy>

* 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