Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: jiye_sw(at)126(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
Date: 2022-10-11 10:05:09
Message-ID: CAMbWs49K+LkBFTu3XqJgso=_BTJ81NJv9N5Bx0_4XikkmG-qdA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Oct 11, 2022 at 5:48 PM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> Just execute as follow sql:
>
> drop view v1;
> drop table t1;
> drop table t2;
> create table t1(i int, j int);
> create table t2(a int, b int, c int, d int);
> create or replace rule t1_r as on insert to t1 do also insert into t2(c,d)
> values (new.i, new.j);
> insert into t1 values (1,default);
> insert into t1 values (1,default),(2, default);
> -- create rule on t1 directly no issue
> drop rule t1_r on t1;
> create view v1 as select * from t1;
> — create rule on view query t1 will trigger this issue
> create or replace rule v1_r as on insert to v1 do also insert into t2(c,d)
> values (new.i, new.j);
> insert into v1 values (1,default);
> -- must multi values.
> insert into v1 values (1,default),(2, default);
> => it will trigger cache lookup failed for type.

Thanks for the report! I can reproduce this issue.

Apparently there is something wrong when we process the DEFAULT marker
in rewriteValuesRTE, because the contents inside att_tup are invalid.

p /x att_tup->atttypid
$13 = 0x7f7f7f7f

Thanks
Richard

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2022-10-11 12:09:30 Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
Previous Message PG Bug reporting form 2022-10-11 09:27:38 BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.