inheritance

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: inheritance
Date: 2001-04-24 22:34:58
Message-ID: 20010424173458.M30699@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2001-04-24 23:28:35 Re: IBM to buy Informix
Previous Message Joel Burton 2001-04-24 22:22:10 Re: Re: BETWEEN clause