Re: Does rewriteTargetListIU still need to add UPDATE tlist entries? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Does rewriteTargetListIU still need to add UPDATE tlist entries?
Date
Msg-id 2259044.1619448942@sss.pgh.pa.us
Whole thread Raw
In response to Re: Does rewriteTargetListIU still need to add UPDATE tlist entries?  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Does rewriteTargetListIU still need to add UPDATE tlist entries?
List pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On Mon, 26 Apr 2021 at 15:09, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Thanks for looking at that.  On reflection I think this must be so,
>> because those rewriter mechanisms were designed long before we had
>> trigger-updatable views, and rewriteTargetListIU has never added
>> tlist items like this for any other sort of view.  So the ability
>> to insert the original view output column has necessarily been there
>> from the beginning.  This is just getting rid of a weird implementation
>> difference between trigger-updatable views and other views.

> FWIW, I had a look at this too and came to much the same conclusion,
> so I think this is a safe change that makes the code a little neater
> and more efficient.

Again, thanks for looking!

I checked into the commit history (how'd we ever survive without "git
blame"?) and found that my argument above is actually wrong in detail.
Before cab5dc5da of 2013-10-18, rewriteTargetListIU expanded non-updated
columns for all views not only trigger-updatable ones.  However, that
behavior itself goes back only to 2ec993a7c of 2010-10-10, which added
triggers on views; before that there was indeed no such expansion.
Of course the view rewrite mechanisms are ten or so years older than
that, so the conclusion that they weren't designed to need this still
stands.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: compute_query_id and pg_stat_statements
Next
From: David Christensen
Date:
Subject: Issue in recent pg_stat_statements?