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

From Japin Li
Subject Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
Date
Msg-id MEYP282MB1669B5146A97FCD8D18A75EFB6239@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
List pgsql-bugs
On Tue, 11 Oct 2022 at 21:16, Richard Guo <guofenglinux@gmail.com> wrote:
> On Tue, Oct 11, 2022 at 8:29 PM Japin Li <japinli@hotmail.com> wrote:
>
>>
>> On Tue, 11 Oct 2022 at 20:09, Richard Guo <guofenglinux@gmail.com> wrote:
>>
>> Yeah, I also notice this, attch a patch to fix it.
>
>
> +1 for the idea. We need to identify the right target relation for each
> product query and rt_entry_relation is not the right one.
>

After some more thinking, I find the previous cannot work correctly.
For example:

    CREATE OR REPLACE v1_r AS ON INSERT TO t1 DO ALSO SELECT * FROM t2;

> A minor comment is can we know the product query is not CMD_SELECT?
> If so I suggest we add an assertion before fetching the target relation,
> something like:
>
> Assert(pt->resultRelation != 0);
>

Oh, I think this might not be true.  The product query comes from rules,
which might be a SELECT query, IIUC.  See above example.


--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17634: Inconsistent view_definition in information_schema.views
Next
From: Tom Lane
Date:
Subject: Re: BUG #17634: Inconsistent view_definition in information_schema.views