Re: Table inheritance versus views - Mailing list pgsql-hackers

From Curt Sampson
Subject Re: Table inheritance versus views
Date
Msg-id Pine.NEB.4.44.0208041547420.12724-100000@angelic.cynic.net
Whole thread Raw
In response to Re: Table inheritance versus views  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
On 3 Aug 2002, Hannu Krosing wrote:

> 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)

You can do this just as well with views. In posgres, it's harder
only because you're forced to create rules for updating views. But
it's possible to have the system automatically do the right thing.

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org   Don't you know, in this new Dark Age, we're
alllight.  --XTC
 



pgsql-hackers by date:

Previous
From: Curt Sampson
Date:
Subject: Re: Why is MySQL more chosen over PostgreSQL
Next
From: Joe Conway
Date:
Subject: Re: FUNC_MAX_ARGS benchmarks