Re: keeping 3 tables in sync w/ each other

From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: "Ow Mun Heng" <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: keeping 3 tables in sync w/ each other
Date: 2007-09-19 10:05:06
Message-ID: 92869e660709190305k4e9a1924j5fa320b6bcd9078f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2007/9/19, Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>:

(...)

> simulate a delete
> => delete from parent where id in (select id from child);
> DELETE 6
>
> => select * from parent;
> id | data1
> ----+---------
> 2 | parent2
> 3 | parent3
> 4 | parent4
>
> => select * from child;
> id | data1
> ----+-------
> (0 rows)
>
Yes. You can however try

SELECT FROM ... ONLY parent ...
(that's what I used in example)

and
DELETE FROM ... ONLY parent ...

--
Filip Rembiałkowski

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message son 2007-09-19 10:36:02 how to know the current size of a database
Previous Message Ow Mun Heng 2007-09-19 09:47:12 Re: keeping 3 tables in sync w/ each other