Re: BUG #16671: "generated always as" is ignored when updating table through view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: rad(at)killian(dot)email, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16671: "generated always as" is ignored when updating table through view
Date: 2020-10-27 23:38:08
Message-ID: 1211658.1603841888@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
>> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
>>> [ updating via a view fails to recalculate GENERATED columns ]

>> Yeah, that's surely a bug. In fact, it's a regression, because
>> the test case works as-expected in v12. Not sure where we broke it.

> git bisect blames
> c6679e4fca21d253ced84c51ac1a31c1b2aec72f is the first bad commit

On digging into this, I see that it's one of the issues I complained
about in [1]. Here is a patch that proposes to fix that by moving
calculation of extraUpdatedCols into the query rewriter.

(With this patch, stored extraUpdatedCols values would always be
null. But it wouldn't matter if we are working with a rule in which
the field isn't null, since the rewriter would just overwrite it.)

regards, tom lane

[1] https://www.postgresql.org/message-id/2351.1589824639%40sss.pgh.pa.us

Attachment Content-Type Size
fix-extraUpdatedCols.patch text/x-diff 10.9 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message greigwise 2020-10-28 00:43:08 Non-Materialized CTE bug?
Previous Message Pavel Biryukov 2020-10-27 13:55:17 Re: posgres 12 bug (partitioned table)