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

Re: View's rule on delete problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Stanislaw Tristan" <stas7775(at)i(dot)com(dot)ua>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: View's rule on delete problem
Date: 2004-10-31 15:29:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
"Stanislaw Tristan" <stas7775(at)i(dot)com(dot)ua> writes:
> It's 2 commands, but executing only first. Why?

You didn't show us the view, but I suppose it's an inner join of the two
tables?  As soon as you delete the row from the first table, there's no
longer any matching row in the view, so the second command finds no OLD
row to join against.

Consider making the view a LEFT JOIN and being sure to delete from the
righthand table first.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Tom LaneDate: 2004-10-31 15:31:06
Subject: Re: Interpolation of environment variables in SQL at runtime?
Previous:From: Tom LaneDate: 2004-10-31 15:25:36
Subject: Re: Replicating sequences

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