Re: Bug in query rewriter - hasModifyingCTE not getting set

From: Greg Nancarrow <gregn4422(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in query rewriter - hasModifyingCTE not getting set
Date: 2021-09-08 01:30:24
Message-ID: CAJcOf-eQDUnHpAeuL3T21u+tvkWqy3XvgPc5Q-FCCFz9a2QSbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 8, 2021 at 8:00 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> writes:
> > The attached patch is based on your version. It includes cosmetic
> > changes to use = instead of |= for boolean variable assignments.
>
> Now, we could potentially make this work if we wrote code to run
> through the copied rtable entries (recursively) and increment the
> appropriate ctelevelsup fields by one. That would essentially
> have to be a variant of IncrementVarSublevelsUp that *only* acts
> on ctelevelsup and not other level-dependent fields. That's
> what I meant when I spoke of moving mountains: the amount of code
> that would need to go into this seems out of all proportion to
> the value. I think we should just throw an error, instead.
> At least till such time as we see actual field complaints.
>

[I don't think Tsunakawa-san will be responding to this any time soon]

I proposed a patch for this issue in a separate thread:
https://www.postgresql.org/message-id/CAJcOf-f68DT=26YAMz_i0+Au3TcLO5oiHY5=fL6Sfuits6r+_w@mail.gmail.com

The patch takes your previously-reverted patch for this issue and adds an
error condition, so it does throw an error for that test case in your
previous post.
It also affects one existing regression test, since that uses an
INSERT...SELECT rule action applied to a command with a data-modifying CTE
(and we shouldn't really be allowing that anyway).

Regards,
Greg Nancarrow
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2021-09-08 01:37:30 Re: The Free Space Map: Problems and Opportunities
Previous Message Fujii Masao 2021-09-08 00:34:14 Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)