Re: Violation of principle that plan trees are read-only

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Violation of principle that plan trees are read-only
Date: 2025-05-20 20:40:34
Message-ID: fzagqihkdohubzcph5z6pntp4madlwb7ehzgxfiomj23txltsb@g26qpt32t54z
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2025-05-20 16:18:57 -0400, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> >> I'm tempted to back-patch this: the plan tree damage seems harmless at
> >> present, but maybe it'd become less harmless with future fixes.
>
> > There are *some* cases where this changes the explain output, but but the new
> > output is more correct, I think:
> > ...
> > I suspect this is an argument for backpatching, not against - seems that
> > deparsing could end up creating bogus output in cases where it could matter?
> > Not sure if such cases are reachable via views (and thus pg_dump) or
> > postgres_fdw, but it seems possible.
>
> I don't believe that we guarantee EXPLAIN output to be 100% valid SQL,
> so I doubt there's a correctness argument here; certainly it'd not
> affect pg_dump.

I wasn't thinking of EXPLAIN itself, but was wondering whether it's possible
to create a view, rule or such that is affected by the output change. Would be
a weird case, if it existed.

> I'm curious though: what was the test case you were looking at?

It's a modified query from our regression tests, I had added some debugging to
find cases where the targetlists differed. I attached the extracted, somewhat
modified, sql script.

Greetings,

Andres Freund

Attachment Content-Type Size
repro-dml-returning.sql application/sql 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nico Williams 2025-05-20 20:43:55 Re: Violation of principle that plan trees are read-only
Previous Message Laurenz Albe 2025-05-20 20:36:54 Re: proposal: schema variables