Re: BUG #18812: Conditional rule: inconsistent check for statement

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18812: Conditional rule: inconsistent check for statement
Дата
Msg-id 3914796.1739573714@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #18812: Conditional rule: inconsistent check for statement  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18812: Conditional rule: inconsistent check for statement
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> I've two rules for a view - unconditional INSTEAD (skip) and conditional
> INSTEAD (always FALSE). But if I trying to insert a type mismatched data to
> the view, I've got a type constraint error.

[ shrug... ]  The WHERE FALSE condition is evaluated later than it
would need to be to prevent this error.  If we use a value that
doesn't trigger the error:

=# explain verbose INSERT INTO v (c) VALUES ('testtest');
                      QUERY PLAN                      
------------------------------------------------------
 Insert on public.t  (cost=0.00..0.01 rows=0 width=0)
   ->  Result  (cost=0.00..0.01 rows=1 width=14)
         Output: 'testtest'::character varying(10)
         One-Time Filter: false
(4 rows)

we can see that the "false" is actually applied at runtime, but the
value coercion happened during planner constant-folding.  In general
the order of application of WHERE clauses is not guaranteed, so
there's not a good argument that this outcome is wrong.

We get variants of this complaint from time to time, but few of
them present use-cases that seem compelling enough to justify the
performance costs of not doing constant-folding.

            regards, tom lane



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