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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: rad@killian.email
Cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Date: 2020-10-14T21:49:34Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.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.

> I could be ignorant of some limitations that views have, but I have neither
> looked for them nor seen them in the documentation. I just assumed in good
> faith that updating rows through a view would be safe in simple cases. Is
> this a dangerous assumption?

Assuming that a dot-zero release is bug-free can be dangerous :-(

			regards, tom lane



Commits

  1. Calculate extraUpdatedCols in query rewriter, not parser.

  2. Optimize update of tables with generated columns