By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,789 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,789 IT Pros & Developers. It's quick & easy.

PostgreSQL Inheritance

P: n/a
Joe
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
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.