dbTalk Databases Forums  

PostgreSQL Inheritance

comp.databases.postgresql.questions comp.databases.postgresql.questions


Discuss PostgreSQL Inheritance in the comp.databases.postgresql.questions forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe
 
Posts: n/a

Default PostgreSQL Inheritance - 02-09-2004 , 07:29 PM






I'm a PostgreSQL newbie and I had a quick question concerning a setup that I
have. I current have three tables, a, b, and c. On my create table
statement for table a, I have the following:

create table a (
id VARCHAR(3) NOT NULL,
name VARCHAR(15) NOT NULL,
CONSTRAINT a_pk PRIMARY KEY (id)
) INHERITS (b);

For b, I have a similar table structure minus the inherits keyword, so all
data I enter for table a will appear in a select call for table b.

Now let's say I have a third table, table c. This table actually has a
foreign key relation to the id column for table b. My question is, since
data that is in table a can be viewed in table b, how can I enforce the
referential integrity using both a and b's id column via the inheritance???
or with PostgreSQL, can I only do this with the ids that are directly stored
in table b and not the inherited ids from a? The latter question seems to
reflect how PostgreSQL handles it now, but I wanted to see if I could do it
with the inherited data as well....

Alright, thanks guys
J



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.