Re: Table inheritance versus views

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: cbbrowne(at)acm(dot)org, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Table inheritance versus views
Date: 2002-08-04 06:50:08
Message-ID: Pine.NEB.4.44.0208041547420.12724-100000@angelic.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cynic(dot)net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2002-08-04 06:53:46 Re: anonymous composite types for Table Functions (aka
Previous Message Thomas Lockhart 2002-08-04 06:44:47 pgsql-server/src include/utils/timestamp.h bac ...