From: Tom Lane <tgl@sss.pgh.pa.us>
To: Japin Li <japinli@hotmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: jiye_sw@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
Date: Tue, 11 Oct 2022 11:07:45 -0400
Message-ID: <312797.1665500865@sss.pgh.pa.us> (raw)
In-Reply-To: <MEYP282MB1669B5146A97FCD8D18A75EFB6239@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <17633-98cc85e1fa91e905@postgresql.org>
<CAMbWs49K+LkBFTu3XqJgso=_BTJ81NJv9N5Bx0_4XikkmG-qdA@mail.gmail.com>
<CAMbWs4-Z8hSnHOTrCV4-Pp1+H9+i34O68pSkhEHLyDpYfPyqpQ@mail.gmail.com>
<MEYP282MB1669B7492DAFE6913C127ED8B6239@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
<CAMbWs491JOKxnc3f3XGj1oYAzi=OJP6=YjUZnQ=hAUxo3BF+hQ@mail.gmail.com>
<MEYP282MB1669B5146A97FCD8D18A75EFB6239@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
Japin Li <japinli@hotmail.com> writes:
> On Tue, 11 Oct 2022 at 21:16, Richard Guo <guofenglinux@gmail.com> wrote:
>> +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.
Yeah. The product query might not be an INSERT at all, yet
rewriteValuesRTE is assuming it is --- that whole business of
scanning the targetlist for referencing Vars and then saving
their resnos doesn't make sense otherwise.
I think the basic problem is that the two calls of rewriteValuesRTE
are really dealing with fundamentally different cases, and we should
probably not have tried to make the same function do both. I'm going
to try splitting it into two functions, one for the force_nulls case
and one for the !force_nulls case. The force_nulls case shouldn't
really need a target_relation parameter in the first place (since it
has no business assuming that the query is an INSERT). I think it
should just replace each SetToDefault with a NULL of the same type
as the SetToDefault, and call it good.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, japinli@hotmail.com, guofenglinux@gmail.com, jiye_sw@126.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.
In-Reply-To: <312797.1665500865@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox