Skip site navigation (1) Skip section navigation (2)

Inheritance, foreign key constraint

From: "Verena Ruff" <lists(at)triosolutions(dot)at>
To: pgsql-novice(at)postgresql(dot)org
Subject: Inheritance, foreign key constraint
Date: 2005-06-12 21:44:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I have a question relation inherited tables and foreign key constraints:

Following situation:
Table Person, PK pers_id
Table Customer, PK kun_id, inherited from Person
Table Contact, FK pers_id from Person

I insert a record into Customer. "SELECT * FROM Person" gives now a part of
this new record. Now I try to insert a record into Contact, using pers_id from
the newly inserted record of Customer. pgsql rejects because of violence of
the foreign key constraint.

I understood inheritance that every record of Customer is a Person, too. But
this looks like I only could take a "pure" record of Person to fullfill this
constraint. Is this right? 

Thanks in advance,

pgsql-novice by date

Next:From: Volkan YAZICIDate: 2005-06-13 07:37:19
Subject: Steps taken through while transmitting binary data
Previous:From: stig eriksonDate: 2005-06-12 10:17:12
Subject: allowing ',' (comma) in float8

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group