inheritance - Mailing list pgsql-general

From will trillich
Subject inheritance
Date
Msg-id 20010424173458.M30699@serensoft.com
Whole thread Raw
In response to Re: Insert data into multiple tables  (Joel Burton <jburton@scw.org>)
List pgsql-general
On Tue, Apr 24, 2001 at 04:14:10PM -0400, Joel Burton wrote:
> On Tue, 24 Apr 2001, will trillich wrote:
> > BUT -- if this is a 1:1 relation, and customers ALWAYS have
> > addresses, and addresses ALWAYS have customers, then just make
> > the sucker into one table and you're done.
>
> If this is a 1:1 relationship, and you don't mind wandering slightly
> afield of the SQL standard, inheritance is a good way to go, too.

okay. is there a way to have a function defined to accept an
inherited record type, that'll work in an inheritee-record?

    create table basic (
        v1 int4,
        v2 int4
    );
    create table dat (
        who varchar(30),
        id serial
    ) inherits (basic);
    create function calc(basic) returns int4 as '
        select $1.v1 + $1.v2
    ' language 'sql';

    ...

    select calc(dat);
    select calc(basic*);

is there a way?

--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html

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

pgsql-general by date:

Previous
From: Joel Burton
Date:
Subject: Re: Re: BETWEEN clause
Next
From: Joseph Shraibman
Date:
Subject: Re: IBM to buy Informix