Re: keeping 3 tables in sync w/ each other

From: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(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 11:31:29
Message-ID: 1190201489.15764.28.camel@neuromancer.home.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2007-09-19 at 11:05 +0100, Filip Rembiałkowski wrote:
> 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 ...

Here's the obigatory Ooohhh or the simpson's "Doh!"

Let me re-try this and see how it goes.

Many thanks for the Ooo... ( I feel like the "green aliens" in Toy
Story)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Farhan Mughal 2007-09-19 11:54:09 Re: how to know the current size of a database
Previous Message Bjørn T Johansen 2007-09-19 11:30:28 Is this good spec for a PostgreSQL server?