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-14 22:45:53
Message-ID: 3637295.1602715553@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
commit c6679e4fca21d253ced84c51ac1a31c1b2aec72f
Author: Peter Eisentraut <peter(at)eisentraut(dot)org>
Date: Mon Feb 17 15:19:58 2020 +0100

Optimize update of tables with generated columns

When updating a table row with generated columns, only recompute those
generated columns whose base columns have changed in this update and
keep the rest unchanged. This can result in a significant performance
benefit. The required information was already kept in
RangeTblEntry.extraUpdatedCols; we just have to make use of it.

Reviewed-by: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/b05e781a-fa16-6b52-6738-761181204567(at)2ndquadrant(dot)com

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-10-14 23:05:47 BUG #16672: Postgres user passwords are corrupted during migration
Previous Message Tom Lane 2020-10-14 21:49:34 Re: BUG #16671: "generated always as" is ignored when updating table through view