Re: Rulese Bug: Instead of reporting incorrect insert count.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Rulese Bug: Instead of reporting incorrect insert count.
Дата
Msg-id 21645.1205177830@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Rulese Bug: Instead of reporting incorrect insert count.  ("Shawn Chasse" <schasse@exagrid.com>)
Список pgsql-bugs
"Shawn Chasse" <schasse@exagrid.com> writes:
> According to the documentation:

> "If there is any unconditional INSTEAD rule for the query, then the
> original query will not be executed at all. In this case, the server
> will return the command status for the last query that was inserted by
> an INSTEAD rule (conditional or unconditional) and is of the same
> command type (INSERT, UPDATE, or DELETE) as the original query. If no
> query meeting those requirements is added
> by any rule, then the returned command status shows the original query
> type and zeroes for the row-count and OID fields."

> My understanding (and that of at least several others) indicates that
> only those conditional rules that are true should be added to the query
> plan. So if there are 3 rules, and 2 of them are false and only one is
> true, then the rule that met the "WHERE" criteria should be the only one
> added to the query plan.

This is mere wishful thinking, I'm afraid.  You're supposing that the
WHERE clause is evaluated to decide whether to insert the rule query
into the plan, which is not the case --- it could not work in any
situation where the WHERE clause depends on runtime data.  All rules
applicable to the query type are inserted in the plan, and their WHERE
clauses are applied at query runtime; as indeed is described in the
manual.

            regards, tom lane

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

Предыдущее
От: "Shawn Chasse"
Дата:
Сообщение: Rulese Bug: Instead of reporting incorrect insert count.
Следующее
От: "Giovani Murilo Dantas Correa"
Дата:
Сообщение: BUG #4023: The transaction control does not work for sequences