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

How to tell PostgreSQL about a relationship

From: Thomas <iamkenzo(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to tell PostgreSQL about a relationship
Date: 2008-10-26 09:44:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general

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

Best regards,


pgsql-general by date

Next:From: hubert depesz lubaczewskiDate: 2008-10-26 12:44:41
Subject: Re: How to tell PostgreSQL about a relationship
Previous:From: ThomasDate: 2008-10-26 09:10:47
Subject: Re: a LEFT JOIN problem

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