Re: feature request for Postgresql Rule system.

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: feature request for Postgresql Rule system.
Дата
Msg-id 1166484229.4422.43.camel@dogma.v10.wvs
обсуждение исходный текст
Ответ на Re: feature request for Postgresql Rule system.  (Richard Broersma Jr <rabroersma@yahoo.com>)
Ответы Re: feature request for Postgresql Rule system.  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: feature request for Postgresql Rule system.
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: feature request for Postgresql Rule system.