Re: feature request for Postgresql Rule system.

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: feature request for Postgresql Rule system.
Date: 2006-12-18 23:23:49
Message-ID: 1166484229.4422.43.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2006-12-18 at 15:06 -0800, Richard Broersma Jr wrote:
> > None of A, C, I, or D say that you need to report a truthful update
> > count.
> >
> > The fact that the update count is wrong with updatable views is a known
> > deficiency.
>
> I see. However, my my case I would like all of the sql statments in the rule to succeed and if
> they don't I would want none of them to succeed so that at least my data isn't partially changed.
> Is there anyway to catch this?
>

What I was trying to explain is that all of your statements *are*
succeeding. A WHERE clause in an UPDATE may match zero or more rows. The
second UPDATE in your rule matches zero rows.

For instance, you can do an UPDATE like:

UPDATE foo SET i = 1 WHERE ( 11 = 12 );

And that statement will succeed, but nothing in foo will change, because
eleven is never equal to twelve.

Similarly, your second UPDATE is succeeding but not changing anything,
thus PQcmdTuples() returns 0, and you see an "UPDATE 0".

You need to examine that UPDATE, because it's not doing what you expect.
Perhaps you have several int fields in each table, and you're comparing
against the wrong one in the WHERE clause? We need to see your table
definitions and perhaps some sample content to help you further.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma Jr 2006-12-18 23:30:08 Re: feature request for Postgresql Rule system.
Previous Message Richard Broersma Jr 2006-12-18 23:06:39 Re: feature request for Postgresql Rule system.