From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | cbbrowne(at)acm(dot)org |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Table inheritance versus views |
Date: | 2002-08-03 13:10:44 |
Message-ID: | 1028380244.2210.12.camel@rh72.home.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, 2002-08-02 at 22:39, cbbrowne(at)cbbrowne(dot)com wrote:
> On 29 Jul 2002 18:27:40 MDT, the world broke into rejoicing as
> Stephen Deasey <stephen(at)bollocks(dot)net> said:
> > Curt Sampson wrote:
> >> I'm still waiting to find out just what advantage table inheritance
> >> offers. I've asked a couple of times here, and nobody has even
> >> started to come up with anything.
>
> > Table inheritance offers data model extensibility. New (derived) tables
> > can be added to the system, and will work with existing code that
> > operates on the base tables, without having to hack up all the code.
>
> But it kind of begs the question of why you're creating the new table in
> the first place.
>
> The new table certainly _won't_ work with existing code, at least from
> the perspective that the existing code doesn't _refer_ to that table.
The beuty of OO is that it does not need to :
hannu=# create table animal (name text, legcount int);
CREATE
hannu=# insert into animal values('pig',4);
INSERT 34183 1
hannu=# select * from animal;
name | legcount
------+----------
pig | 4
(1 row)
hannu=# create table bird (wingcount int) inherits (animal);
CREATE
hannu=# insert into bird values('hen',2,2);
INSERT 34189 1
hannu=# select * from animal;
name | legcount
------+----------
pig | 4
hen | 2
(2 rows)
------------------
Hannu
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2002-08-03 13:19:30 | Re: Why is MySQL more chosen over PostgreSQL? |
Previous Message | Hannu Krosing | 2002-08-03 12:55:36 | Re: getpid() function |