Re: [GENERAL] Supertypes?

2001-03-27 Thread Jason Earl

I believe that what you are looking for is
inheritance.

http://postgresql.readysetnet.com/devel-corner/docs/user/inherit.html

I hope this is helpful,
Jason Earl

--- Christian Marschalek <[EMAIL PROTECTED]> wrote:
> In school we've learned about supertypes. I don't
> know if the raw
> translation is correct so here is an example:
> Supertype human with the attributes name,age,size.
> Now I can derrive types from it... For example ->
> employe with even more
> attributes like personal id.
> 
> Can I realise this in PostgreSQL? And if yes, would
> anybody please
> explain how, or point me to the right documentation?
> 
> Thanks and regards, Christian Marschalek
> 
> 
> ---(end of
> broadcast)---
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html


__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [GENERAL] Supertypes?

2001-03-27 Thread will trillich

On Tue, Mar 27, 2001 at 03:58:39PM +0200, Christian Marschalek wrote:
> > Pg DOES support it!
> Oh... My fault :o)
> 
> > However, it doesn't really have anything
> > to do with data redundancy.  Data redundancy means storing 
> > the same DATA in more than one table meaning that if it 
> > changes in one table, you have to update all of the other 
> > tables.  That's not the same as inheritance which means you 
> > can use a common base_table with additions to child tables as 
> > necessary.
> Well we've learned that when you have lets say five tables which all
> contain name, adresse, city and so on you also have a form of
> redundancy... Can be wrong, though ;o)

there's also this construct -- i don't know the name --
exemplified below by using the table ADDR (very u.s.centric, i
know) as a DATATYPE in table PERSON:

create table addr(
street varchar(30),
city varchar(30),
state char(2),
zip char(5)
);
create table person(
loc addr,  --  how about them apples?
phone char(10),
name varchar(30)
);
\d person
   Table "person"
 Attribute |Type | Modifier 
---+-+--
 loc   | addr| 
 phone | char(10)| 
 name  | varchar(30) | 


the trick, is, how do you insert data into person.addr?

-- 
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
-- Isaac Asimov, 'The Genetic Code'

[EMAIL PROTECTED]
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly