On Fri, 2002-08-02 at 22:39, [EMAIL PROTECTED] wrote:
> On 29 Jul 2002 18:27:40 MDT, the world broke into rejoicing as
> Stephen Deasey <[EMAIL PROTECTED]>  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


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to