Bug list?
Hi,
I [think I] found a bug, and tried to send a report to pgsql-bugs and it
never showed up there.
The *very brief* version:
I have a hierarchy of tables using Postgres's inheritance feature. In the
root table I have a serial type which is a primary key. Another table (not
in the hierarchy) has a foreign key to the primary key of the top table in
the hierarchy.
When I insert a record with a foreign key that references an object in a
descendent table, I get a referential integrity error. But when it
references an item that is simply a member of the top class, no problem - the
foreign key works then.
If I select * from the top class, both records show up, along with their id
primary key. So why can't a foreign key refer to the one that is a member of
a subclass?
I'm using 7.1.2
Thanks,
Micah
--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com
The answer is that the referential integrity constraint doesn't span across subclasses. So your foreign key is valid only for the root class that it directly references and not its children.
cheers,
thalis
ps check list archives, same question answered last week
On Sun, 24 Jun 2001, Micah Yoder wrote:
Show quoted text
Hi,
I [think I] found a bug, and tried to send a report to pgsql-bugs and it
never showed up there.The *very brief* version:
I have a hierarchy of tables using Postgres's inheritance feature. In the
root table I have a serial type which is a primary key. Another table (not
in the hierarchy) has a foreign key to the primary key of the top table in
the hierarchy.When I insert a record with a foreign key that references an object in a
descendent table, I get a referential integrity error. But when it
references an item that is simply a member of the top class, no problem - the
foreign key works then.If I select * from the top class, both records show up, along with their id
primary key. So why can't a foreign key refer to the one that is a member of
a subclass?I'm using 7.1.2
Thanks,
Micah--
Like to travel? http://TravTalk.org
Micah Yoder Internet Development http://yoderdev.com---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?