From: | Dusan Misic <promisic(at)gmail(dot)com> |
---|---|
To: | manidegr8 <engineer(dot)usman(at)ymail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Deleting entries from multiple tables |
Date: | 2010-11-30 08:15:41 |
Message-ID: | AANLkTikwr3Reg_iDKT4zL5=CDfgVSFCDEmOc1yd49NJC@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
What is ON DELETE part of the foreign key constraint?
If you set it to CASCADE, then your delete from the parent table will
cascade to child tables (to put it simpler, when you delete record in table
A, then PostgreSQL will delete any rows in tables B and C that are
referencing original row (or column) in table A).
If you used defaults when you created your FOREIGN KEY constraint, the
default is to restrict ANY deletion in table A if it is being referenced in
table B or C.
On Tue, Nov 30, 2010 at 6:59 AM, manidegr8 <engineer(dot)usman(at)ymail(dot)com> wrote:
>
> i am trying to run a query but its not working may be due to constraint
> conflicts
>
> i have table A, B and C
> B and C have a foreign key linked with A's primary key
>
> so i want to delete an entry from A
> for that i hav to delete child records first
>
> can u design a query which wont conflict the constraints..?
>
> Thanks...
> Regards.
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/Deleting-entries-from-multiple-tables-tp3285654p3285654.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
From | Date | Subject | |
---|---|---|---|
Next Message | Dusan Misic | 2010-11-30 08:19:04 | Re: Deleting entries from multiple tables |
Previous Message | manidegr8 | 2010-11-30 05:59:01 | Deleting entries from multiple tables |