How to tell PostgreSQL about a relationship - Mailing list pgsql-general

From Thomas
Subject How to tell PostgreSQL about a relationship
Date
Msg-id 55da14450810260244nb03c79drb5bf64274fb02c97@mail.gmail.com
Whole thread Raw
Responses Re: How to tell PostgreSQL about a relationship  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: How to tell PostgreSQL about a relationship  (Niklas Johansson <pgmailings@codecraft.se>)
List pgsql-general
Hi,

I have jumped from MySQL to PostgreSQL, and I wanted to know how we
declare that a table depends on another one.

Currently I have 3 tables:

Product(id, title, price)
Item(id, product_id, order_id, quantity)
Order(id, amount, paid)

In pgAdmin I have removed a few order entries, but the items
associated to them are still here, now I have zombie items floating
around that don't belong to any order. So how do I tell PgSQL that
when I remove a given order, it should remove all associated items
also?

Best regards,

pgsql-general by date:

Previous
From: "Tony Wasson"
Date:
Subject: Re: a LEFT JOIN problem
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: How to tell PostgreSQL about a relationship