Inherit trouble

From: David Gianonatti <david(at)web-tribu(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Inherit trouble
Date: 2011-07-06 19:52:47
Message-ID: CAPQWqp2B1=_6bNC6-jtKa_aodx4ThffMKVxUdwc1DKyjj0Z37A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Everyone,

I got trouble with inherit and foreign key.

I give you example of what's it likes.

I got 4 tables :

- order
- order_details
- product
- hard_drive

Hard_drive inherit product
order_details got order on foreign key
order_details got product on foreign key

When I try to add an order_details line, with a hard drive product_id, I got
message "SQL Error : an instruction insert or update on the table
order_details fail on the integrity constraint of the foreign key pk_product
detail : the key (id)=(9) does not exists on the table product"

The product 9 is a hard drive, so it's inserted in the hard drive table, but
as it inherits product, I see it in product table too.

Why do i Have this message ? Can you help me ?

Thank you

David

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-07-06 22:13:22 Re: Inherit trouble
Previous Message Tomas Vondra 2011-07-06 19:41:02 Re: Performance Monitoring of PostGRE