470,581 Members | 2,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,581 developers. It's quick & easy.

PostgreSQL Inheritance

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
0 1564

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Otis Green | last post: by
reply views Thread by Bill J. | last post: by
22 posts views Thread by Marc G. Fournier | last post: by
29 posts views Thread by Paul Ganainm | last post: by
3 posts views Thread by Robert Abi Saab | last post: by
1 post views Thread by phil campaigne | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.