Re: History - Mailing list pgsql-general

From will trillich
Subject Re: History
Date
Msg-id 20030203100659.GA3543@mail.serensoft.com
Whole thread Raw
In response to Re: History  (Alan Gutierrez <ajglist@izzy.net>)
List pgsql-general
On Sun, Feb 02, 2003 at 07:07:42PM -0600, Alan Gutierrez wrote:
> >     insert into loc(addr,city,zip) values
> >         ('329 Main','Middlegulch','24680');
> >
> > then when i
> >
> >     select * from delta;
> >
> > i'll see the id (from loc) and the created date as well?  hmm!
> > and this way it's ONE sequence for all related tables. i bet
> > that's a nice un-cluttering side-effect. plus, the child tables
> > would all take up that much LESS space, right? whoa, serious
> > paradigm shift in the works... cool!
>
> Shift back. I am not advocating the use of PostgreSQL inheritance. When
> I want to model inheritance I do so explicitly.
>
> CREATE TABLE Person
>  (person_id INTEGER NOT NULL,
>   first_name VARCHAR(32),
>   last_name VARCHAR(32) NOT NULL,
>   PRIMARY KEY (person_id));
>
> CREATE TABLE Worker
>  (worker_id int NOT NULL REFERENCES (Person),
>   date_hired DATE NOT NULL,
>   PRIMARY KEY (worker_id));

a subset table, i think that's called. right. i've got those
coming and going. does the inheritence thing work similarly? (do
you advocate the avoidance of postgresql inheritance?)

curious aside -- do you not subscribe to the "all instances of
the same field much be names identically" camp? they'd have you
rename worker.worker_id to worker.person_id ... what's your
take?

> > but -- is there some way to tell which offspring table the delta
> > record came from? now THAT would be useful.
>
> There is no good way.

i like oliver's revelation. easy to hobble together a view to do
that and have it be part of the system toolkit...

> You moved the goal posts. I thought you wanted a history table
> to store changes per row. How's that coming along?

w.trillich (lurking and learning) != OP

i'm all for reducing redundancy -- and if i can have all of my

    (
        id serial,
        created date,
        modified timestamp(0),
        by,
    )

fields in one table with others referring to it, i'm all the
happier. is there a significant drawback to doing that kind of
thing? (this looks like exactly that kind of application that
that feature was born and bred for...)

--
There are 10 kinds of people:
ones that get binary, and ones that don't.

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Looking for a firewall? Do you think smoothwall sucks? You're
probably right... Try the folks at http://clarkconnect.org/ !

pgsql-general by date:

Previous
From: Jean-Christian Imbeault
Date:
Subject: Dferred constraints not deferred?
Next
From: Lincoln Yeoh
Date:
Subject: Re: DBI driver and transactions